Repository navigation
Spam requests to nodejs.org from Artifactory deployments #3223
Copy link
Copy link
Closed
Labels
Description
Our server has been consistently bombarded by requests to inexistent paths which correspond to npm package names.
For example:
2023/03/15 11:31:13 [error] 8929#8929: *67745 open() "/home/dist/nodejs/release/yargs" failed (2: No such file or directory), client: 162.158.62.202, server: nodejs.org, request: "GET /dist/yargs HTTP/1.1", host: "nodejs.org"
2023/03/15 11:31:13 [error] 8930#8930: *60355 open() "/home/dist/nodejs/release/cli-truncate" failed (2: No such file or directory), client: 162.158.63.149, server: nodejs.org, request: "GET /dist/cli-truncate HTTP/2.0", host: "nodejs.org"
2023/03/15 11:31:13 [error] 8930#8930: *61845 open() "/home/dist/nodejs/release/karma-parallel" failed (2: No such file or directory), client: 162.158.63.150, server: nodejs.org, request: "HEAD /dist/karma-parallel HTTP/2.0", host: "nodejs.org"
2023/03/15 11:31:13 [error] 8932#8932: *60398 open() "/home/dist/nodejs/release/is-running" failed (2: No such file or directory), client: 162.158.63.149, server: nodejs.org, request: "HEAD /dist/is-running HTTP/2.0", host: "nodejs.org"
2023/03/15 11:31:13 [error] 8929#8929: *67745 open() "/home/dist/nodejs/release/is-url" failed (2: No such file or directory), client: 162.158.62.202, server: nodejs.org, request: "HEAD /dist/is-url HTTP/1.1", host: "nodejs.org"
2023/03/15 11:31:13 [error] 8930#8930: *60365 open() "/home/dist/nodejs/release/npm-run-path" failed (2: No such file or directory), client: 162.158.62.240, server: nodejs.org, request: "HEAD /dist/npm-run-path HTTP/2.0", host: "nodejs.org"
2023/03/15 11:31:13 [error] 8929#8929: *67745 open() "/home/dist/nodejs/release/ms/-/ms-0.7.2.tgz" failed (2: No such file or directory), client: 162.158.62.202, server: nodejs.org, request: "HEAD /dist/ms/-/ms-0.7.2.tgz HTTP/1.1", host: "nodejs.org"
2023/03/15 11:31:13 [error] 8933#8933: *61259 open() "/home/dist/nodejs/release/is2" failed (2: No such file or directory), client: 162.158.63.150, server: nodejs.org, request: "HEAD /dist/is2 HTTP/2.0", host: "nodejs.org"
2023/03/15 11:31:13 [error] 8933#8933: *33223 open() "/home/dist/nodejs/release/@rollup/plugin-typescript" failed (2: No such file or directory), client: 162.158.62.240, server: nodejs.org, request: "HEAD /dist/@rollup%2Fplugin-typescript HTTP/2.0", host: "nodejs.org"
2023/03/15 11:31:13 [error] 8933#8933: *60282 open() "/home/dist/nodejs/release/dedent" failed (2: No such file or directory), client: 162.158.63.150, server: nodejs.org, request: "GET /dist/dedent HTTP/2.0", host: "nodejs.org"
I used the Cloudflare Instant Logs to monitor the 404 requests for a few seconds and identified two sources:
"ClientRequestUserAgent": "Artifactory/7.41.7 74107900",
"ClientIP": "198.203.175.175",
IP belongs to UnitedHealth Group Incorporated.
"ClientRequestUserAgent": "Artifactory/6.23.13",
"ClientIP": "200.220.180.71",
IP belongs to Banco Santander (Brasil) S.A.
I don't really know what we can do at this point but ideally we should find a way to make them stop.
Reactions are currently unavailable
Activity
targos commentedon Mar 15, 2023
There are also requests for Java libraries:
For example:
richardlau commentedon Mar 15, 2023
I suppose in the worst case scenario we could probably block those IP addresses at CloudFlare level.
domdomegg commentedon Mar 15, 2023
I suspect someone has entered
nodejs.orgin theURLfield for their upstream NPM registry: https://www.jfrog.com/confluence/display/JFROG/npm+Registry(and possibly somehow for their Java libraries)
Blocking the IPs at the CloudFlare level proably works if it's just these two.
If it's more people getting confused then maybe:
registry.npmjs.org. Then serve these with nginx for NPM registry-looking URLs and hope the message gets read once their builds start failing.rvagg commentedon Mar 16, 2023
This has been going on for years IIRC, logs full of requests for Java components from garbage Artifactory deployments, I've never tried to do anything about it because I've not had a great deal of faith in getting anything sensible out of that ecosystem but maybe someone should!
ovflowd commentedon Mar 16, 2023
+1 on blocking the known IP addresses
targos commentedon Mar 16, 2023
Just for monitoring, I created a CF firewall rule to block 198.203.175.175. After a few minutes it already blocked 3.15k requests.
How about replacing it with this:

ovflowd commentedon Mar 16, 2023
+1 for user agent filtering
targos commentedon Mar 16, 2023
Do we need some kind of consensus to do this? @nodejs/build
richardlau commentedon Mar 16, 2023
I'm +1 to trying User Agent filtering.
targos commentedon Mar 16, 2023
Stats for that single IP:

ovflowd commentedon Mar 16, 2023
These artifactory requests are indeed being problematic.
ovflowd commentedon Mar 16, 2023
Glad to hear we're tackling this ❤️
nschonni commentedon Mar 16, 2023
Wouldn't Artifactory also be downloading the actual Node binaries on correctly configured instances? I'm not sure about blocking the user agent
targos commentedon Mar 16, 2023
I don't know. Is Artifactory supposed to download Node binaries?
14 remaining items
dansisan commentedon Mar 17, 2023
@targos We're unblocked now too - thank you!
TimothyTitan commentedon Jun 27, 2023
Our artifactory instance suddenly started receiving 403 responses for metadata requests. Were there any changes to the firewall rules to specifically block artifactory?
Requests via nvm directly through to nodejs.org/ and curl requests from the same servers are successful, so it appears as though only requests from artifactory are blocked.
ovflowd commentedon Jun 27, 2023
Hey, @TimothyTitan please refer to srs/gradle-node-plugin#127 as this is intended and not a bug.
This is pretty much (probably) because you have a misconfigured Artifactory installation. If you read the related issue it is explained there.
Thanks!
tim-goto commentedon Jul 6, 2023
could you please add
tgzto the allowed matches?targos commentedon Jul 6, 2023
@tim-goto Can you please give an example of legit URL that ends with
tgz?francis-goto commentedon Jul 6, 2023
@targos https://nodejs.org/dist/npm/npm-1.4.9.tgz
ovflowd commentedon Jul 6, 2023
That is not a legit use case. Actually that’s exactly what we’re trying to block :)
francis-goto commentedon Jul 6, 2023
We're trying to proxy cache everything under https://nodejs.org/dist/ with Artifactory. The volta utility downloads node on every pipeline run.
ovflowd commentedon Jul 6, 2023
So the
nodejs.org/distis not a repository for NPM packages. It is just where our Node.js binaries live.If you configured your Artifactory installation for using
nodejs.orgas a repository, that's incorrect and should not be done 🙇ovflowd commentedon Jul 6, 2023
I'm not sure what your goals are with this comment. You can easily filter what Artifactory should be searching for (Through Regular Expressions, etc). Give a read on srs/gradle-node-plugin#127
jmccann commentedon Jul 6, 2023
This comment didn't make much sense to me. @TimothyTitan commented on trying to mirror node binaries from https://nodejs.org (which exist at https://nodejs.org/dist/) and was directed to a gradle plugin issue. I looked through the issue and wasn't sure how it related to mirroring https://nodejs.org/dist/ from an Artifactory instance. Sorry if its obvious but could use more direction on what I'm looking for in that issue.
This feels also like what @TimothyTitan's comment above was asking for, mirroring everything under https://nodejs.org/dist/ in Artifactory for node binaries.
Are you saying we should not mirror https://nodejs.org/dist/ internally with Artifactory? Or do you think the other person is trying to setup an NPM mirror using https://nodejs.org/dist/ (instead of a NODE binaries mirror)? I think they are just trying to mirror NODE binaries (like we are).
Our use case is basically https://sionwilliams.com/posts/2020-12-09-node-n-npm-mirror
This would allow use to reduce traffic hitting https://nodejs.org/dist/ directly by being able to use our internal mirror.
We had tried to use it and it was working until as @TimothyTitan pointed out we now intermittently get 403 responses back from https://nodejs.org/dist/. This causes the mirror to become unreliable. We've had to revert to having everything use https://nodejs.org/dist/ directly again.
ovflowd commentedon Jul 6, 2023
@francis-goto gave an example of an
npm.tgzfile, which I said they should not attempt to mirror. I have no knowledge of Artifactory and Volta, so I have no recollection of what you should do for A, B, C.I've only stated that those tools should not be used for whatever means of "scanning"
nodejs.org/distfor NPM packages, only Node binaries.Sorry, but this issue is inappropriate for requesting support for either of those tools (Artifactory, Volta, or whatever 😅). (not saying you are, but it's just not the best place for that)
The second statement. Most people affected over here are trying to setup (accidentally, just because they followed StackOverflow, etc.) NPM mirrors.
As mentioned, the current rules are there to enforce an intended behaviour. I'd recommend reaching out to Artifactory folks for a better understanding of how they internally attempt to "mirror" Node binaries.
We cannot, and will not, update the rules to allow
.tgzfiles as they are virtually used for NPM packages. (The reasons are all documented on this issue)ovflowd commentedon Jul 6, 2023
I'm also sorry for not being of better use, the best I can recommend is to reach out the maintainers of the tools that you use :)
ovflowd commentedon Jul 6, 2023
This issue can also be closed as it is because we've already implemented the rules to block Artifactory for NPM packages.
Updating the rules to fine-tune even more for some exceptions (such as for some reason Artifactory (or whatever) requesting
npm-1.XXX.tgzonnodejs.org/dist) could be explored, but it's tricky, and I wouldn't recommend at all anyone to be using NPM 1.0 as it was released in 2011 and it has no use (I doubt it even works with the current NPM registry)Also, support questions directed to the downstream libraries, such as Artifactory, Gradle and Volta, should be done on their respective repositories. We have no control over what they do and why they do X.
We want to avoid this issue from becoming a spam/off-topic nightmare.