-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User agent format when connecting to s2s API #9
Comments
That's really weird. When did this start happening? I did update the user agent format in the last version, it should look like this now (from my server logs, the commit information shouldn't be included for release builds):
The nxapi-app bit will be different from the command line or if anyone's using this as a library. I'm using a development version but I'll check if it's working properly in the release version (maybe I broke something with Rollup?). |
@samuelthomas2774 The earliest instance of it was 2022-07-06 07:27:19 UTC, so just very recently. Recent logs show a mix of users making requests I'd estimate 1/3 of the time with I'm happy to provide you with a more full (sanitized, no IPs or info on other clients) log from the past ~24h if you want. (Also an aside but jeez, you have a lot of users, just saying lol… doesn't look like it's just a couple haywire clients as has sometimes happened before with other projects using the API… now s2s users keep getting the "too many requests" error so I had to increase the # of global requests allowed per minute from 4 to 10 just now.) |
Just tested the release build of the app straight from GitHub, and also with some debug logs and it all seems to be sending properly formed user agents... That should be sent from 78.32.231.153/2001:470:6d29:51:5472:173:9b2a:564e/2001:470:6d29:57:346c:b76d:9f81:3d1b (screenshot timestamp was 15:09:14 UTC). Are you seeing any other versions reported? 0.2.0 is quite old now (and I didn't release that until I added an update check), plus there should be quite a few other versions between 0.2.0 and 1.2.0. I'll check older versions as well just in case it's any of those. I don't know why this would only be appearing today though, even if it is to do with the new format in 1.2.0, as that was released Saturday. Sorry about this, those user agents are obviously very wrong so please do block them if it's causing issues. |
Yep, I see a line from I'm seeing pretty much only 0.2 and then all the weird lots-of-numbers ones in recent logs. Your request mentioned above is the only one made in the past hour since I opened this issue using the new parenthesis format. Looks like it is actually only three users over and over sending the 0.2 user agent strings, with multiple requests every minute – I'll go ahead and block those IPs server-side since clearly something's going haywire there and they're not aware of what their client is doing. FWIW there are older logs, e.g. from June where I see 1.1.0 and 0.3.0 (and 0.3… which is different?) showing up, and a couple 1.0.0s. I don't have a ton of time to look into this now as I'm on vacation this week but I can confirm it's not on my end – the logging works just by using PHP to pull |
My bad, @samuelthomas2774, I was wrong about this. The earliest instance looks like it was:
They started immediately after that – like, various different ones from multiple IPs, all starting that exact minute. |
I'm not sure I do... GitHub doesn't show download stats for release asset downloads, but according to the repository traffic stats (from I think the last two weeks?) there's only been 5 unique visitors to the releases page, so if these are legitimate nxapi users they didn't download the app from here. npm download stats (cli-only/library use) are a bit higher but I think that includes lots of bots (e.g. for malware/vulnerability scanning?). I'd like to have my own analytics for actual app use but I also don't really want to be collecting anything, plus that doesn't really work as nxapi is at it's core just a library for the API stuff (the CLI and Electron app are just built on top of it). Of course ideally I wouldn't be sending you/NexusMine anything as well, then this wouldn't ever be a problem. I'm still trying to figure out how
The number of downloads I can see certainly doesn't match up with the request volume you're getting, so I have no idea where those requests are coming from. Sorry this is taking up some of your holiday. If you want to send me some logs I'll have a look and see if I can figure out what this is, but comparing my download stats with the number of users I can see from just the partial IP addresses in the screenshot (plus having no idea how these user agents could be generated) I'm not sure these actually are nxapi users (but then I don't know why they'd be fake either). It might be worth having a look at the IP addresses, as e.g. they shouldn't be Tor or other TCP/HTTP proxy exits because nxapi uses node-fetch which by default can't use a proxy (not that I wouldn't want to support Tor users, just it would be suspicious as it shouldn't actually be possible now). Edit: Those numbers do look like they're (in the higher range of) valid safe numbers in JavaScript, so even if not nxapi, I'd say these requests are probably coming from a Node.js program. Edit: Just so you know, other than misusing nxapi as a library, the only things that should cause nxapi to request more tokens than normal are: launching web services in the Electron app (as those tokens can't really be cached regardless of how long they're valid for), the |
I've tested some older versions (with added debug logs) and they're all sending correct user agents. 1.2.0 app, Windows 10, GitHub Releases
They should show up in your logs between 15:15-15:33 UTC from 78.32.231.153/2001:470:6d29:51:f108:ec21:54a3:404b/2001:470:6d29:57:f108:ec21:54a3:404b (there should be 5 requests, I forgot to edit one version to log the user agent). I'm very sure now there's no way those user agents could actually be generated by nxapi. Even if used as a library, the user agent will always start with
I was going to test 0.2.0 but tested 0.3.0 instead because it changes the Edit: I am aware of one project, NSO-FriendStatus, that depends on nxapi (via the CLI). Possibly that could cause logins to be attempted every minute if it fails? |
Hi @frozenpandaman, are you still getting these randomised requests to your API? Still really confused by this 😕. I've been working on some changes (haven't pushed anything yet) to try and prevent excessive API requests even if nxapi is used by someone in an automated script. |
This only affects scripts - running this nxapi command in a terminal and the Electron app will ignore this limit. #9
Hi @frozenpandaman, is this still an issue? Since v1.3.0 nxapi will refuse to authenticate (and thus possibly contact your API) more than 4 times per hour (e12bb36), and will also append Also just a few other updates:
|
@samuelthomas2774 Sorry for the late reply! Thanks so much for all your help here. I just checked the logs and the version numbers seem to now be working correctly. I'm seeing recent requests from versions 1.3.0 and 0.2 which is fine by me. Thanks for the other updates as well, will be keeping my eye on that other discussion & I joined the server! |
Thanks for checking, it's good to hear that whatever was causing this is resolved now. I've seen that you've just switched to @JoneWang's imink API in splatnet2statink; I'll switch the default in nxapi to imink as well then, as the imink API seems to be more stable than flapg. I'll leave the option to use s2s+flapg until you shut down your API. (@JoneWang, my last comment applies to you as well - feel free to join my Discord server, and you might be interested in #10, and #11 if you're planning to add support for Splatoon 3 to imink.) Edit: @JoneWang, I just saw your tweet - this looks amazing, I'd love to hear more about how this is set up! |
Hi! Nice to talk together! I have plans to develop imink for Splatoon 3. The information you put together is great. And I have joined your Discord server. |
Can you help me figure out why the "version" part of many of the user agents coming from your application here seem to be randomly generated numbers? This isn't what I'd expect to see or how stuff should be set up.
Thanks!
The text was updated successfully, but these errors were encountered: