Commit Graph

83 Commits

Author SHA1 Message Date
Jonathan Barrow
9838fb314f
feat: add grace period for account deletions 2026-01-20 21:02:17 -05:00
Jonathan Barrow
ceffbac2e9
fix(nnas): wrap all errors in an "errors" block
the NNAS client expects all errors to be in a "errors" block. this was not previously done, and some instances were missed when updating the error handling. this likely fixes many 102-2402 errors
2025-12-02 19:33:28 -05:00
Jonathan Barrow
42a15a3aaf
chore: move certificate device ID check close to other certificate checks 2025-10-12 15:02:30 -04:00
Daniel López Guimaraes
915b7b62b2
feat(nasc): Add enforcement of custom patches to required titles
If the supplied game server ID doesn't match the one present on the
server database, then assume the title requires patches on the user's
end. Give this behavior a custom error code 002-0152 to facilitate
support to unaware users.

Also drop the legacy fallback of the friends server to the test
environment, since the server should be available to anyone anyway, and
we already have the production config for it.

Alongside that, update the maintenance error code to use the proper
002-0101 as expected.
2025-07-30 17:11:00 +01:00
Ash Logan
b9cf3194fc fix: Seperate token checks by type
Some checks failed
Build and Publish Docker Image / Build and Publish Docker Image (amd64) (push) Has been cancelled
Build and Publish Docker Image / Build and Publish Docker Image (arm64) (push) Has been cancelled
Give each expected token type a seperate function and un-export the "generic" one.

This required deciding what the "expected" token type is for all endpoints. Possibly contraversial choices are:

- API tokens only on the HTTP API (no service tokens)
- API tokens only on the gRPC APIs
- API tokens only on ExchangeTokenForUserData (I could only find 1 user of this API - BOSS - and they use API tokens here)

Notably, there is now no way to get the account server to validate a service token - services must decrypt them locally. We should probably add an API for this for the benefit of third parties.
2025-06-22 19:54:27 +10:00
Ash Logan
545ef69727 Merge branch 'dev' into chore/token-update 2025-06-22 12:37:01 +10:00
Jonathan Barrow
2e5e692cef
fix: update remaining magic numbers for system/token types 2025-06-21 17:27:49 -04:00
Jonathan Barrow
209f95f20e
fix: update Node types 2025-06-18 18:13:51 -04:00
Daniel López Guimaraes
0209d8bb88
fix: Reapply restriction for NNAS only allowing console tokens 2025-06-08 23:51:07 +01:00
William Oldham
6c04fbd68c style: do eslint format 2025-05-19 23:44:21 +01:00
Jonathan Barrow
6434e7ce13
chore: revert pnid middleware token type check revert 2025-05-09 18:43:41 -04:00
William Oldham
1a3445db5b chore: revert auth-update changes and hotpatches related
Commits:
- f349b9de42
- b9966807c3
- 0bc3af0507
- 008a517947
2025-05-09 18:08:47 +01:00
William Oldham
0a234156c0 chore: add error logging to api middleware 2025-04-08 22:49:58 +01:00
Jonathan Barrow
6087dc68ce
fix(nnas): correct error message for missing country header 2025-04-07 14:37:15 -04:00
Jonathan Barrow
9c92cfda3b
chore(nnas): remove outdated TODO in PNID middleware
Some checks failed
Build and Publish Docker Image / build-publish (push) Has been cancelled
2025-02-03 16:56:59 -05:00
Jonathan Barrow
37971c006d
refactor(nnas): check headers and device status in all possible endpoints
Some checks are pending
Build and Publish Docker Image / build-publish (push) Waiting to run
2025-02-03 13:22:30 -05:00
Jonathan Barrow
2385caae55
chore: add missing device ID to 3DS consoles 2025-01-31 15:55:55 -05:00
Jonathan Barrow
302956d5f2
refactor: add explicit token handling functions 2025-01-31 15:53:18 -05:00
Jonathan Barrow
3e410ede7d
fix: validate padding in certificates 2025-01-31 15:53:17 -05:00
Jonathan Barrow
7f3b755b3a
fix: make NNAS middleware only allow Basic tokens on "devices" endpoints 2025-01-31 15:53:17 -05:00
Jonathan Barrow
8e557fc072
fix: make NNAS middleware only accept console tokens 2025-01-31 15:53:14 -05:00
Natsuki ツ
55dacc467b feat(error): add the correct ban error codes 2025-01-12 21:30:26 +01:00
William Oldham
0c03aa46ba Fix middleware logic 2024-09-24 20:42:19 +01:00
William Oldham
0a8c6789f0 Remove newline 2024-09-24 11:57:17 +01:00
William Oldham
8f9b17447b
Apply suggestions from code review
Co-authored-by: Jonathan Barrow <jonbarrow1998@gmail.com>
2024-09-24 11:47:07 +01:00
William Oldham
7a0c2e4231 Add full configurability to each service for domain routing - remove express-subdomain 2024-09-23 21:28:14 +01:00
Jonathan Barrow
96d220cb39
chore: remove reuse of ban error code in NASC 2024-04-27 09:16:08 -04:00
Jonathan Barrow
ca5ea2e302
nasc: remove MAC check. MAC is allowed to be changed 2024-04-16 12:22:12 -04:00
Jonathan Barrow
eb0b4aba00
nnas: update console status middleware 2024-04-14 21:17:12 -04:00
Jonathan Barrow
7ff47d8e26
nnas: link 3ds device certificate to document from NASC 2024-04-14 20:56:33 -04:00
Jonathan Barrow
82d353357b
chore: updated comments to use Better Comments syntax 2024-04-14 19:41:47 -04:00
Jonathan Barrow
6d3f516612
chore: update Id -> ID 2024-04-14 19:19:37 -04:00
Jonathan Barrow
cb10a16668
chore: removed unnecessary type declarations 2024-04-14 19:16:25 -04:00
Daniel López Guimaraes
603b209cb5
nasc: Add more integrity checks 2024-04-13 22:37:29 +01:00
Daniel López Guimaraes
20eed7fc96 Fix NASC registration path 2024-04-13 22:10:42 +01:00
Daniel López Guimaraes
dc7d44baf0 Remove redundant transactions
We can update the data directly without a transaction.
2024-04-13 22:10:42 +01:00
Daniel López Guimaraes
aa480673d2 Better handling of system transfered devices
If a user performs a system transfer, we can't guarantee the validity of
the linked PIDs to a device, not this device's existance on the
database. Add them to the database if necessary.
2024-04-13 22:10:42 +01:00
Jonathan Barrow
06c9cc9c01
[NNID] - Update certificate middleware header checks. Closes #22 2023-07-13 14:52:41 -04:00
Jonathan Barrow
cb89fb925b
Removed is_emulator field from device document schema 2023-06-13 23:21:01 -04:00
Jonathan Barrow
b36c63a0b3
Added better console tracking 2023-06-11 07:46:27 -04:00
Jonathan Barrow
15b6f1f4a3
Renamed getPNIDByBearerAuth to getPNIDByTokenAuth (not all tokens are bearer) 2023-05-31 21:31:48 -04:00
Jonathan Barrow
8b578c750a
Removed password change from PNID.scrub and added 0112 error on deleted accounts 2023-05-03 12:19:55 -04:00
Jonathan Barrow
9f68827337
Generate 3DS friend code when registering 3DS NEX account 2023-05-02 14:37:11 -04:00
Jonathan Barrow
d269258b61
Added token checksum to non-access/refresh tokens 2023-05-01 15:02:04 -04:00
Jonathan Barrow
20ddbe7552
Explicitly set each non-200 status on each response 2023-04-29 17:50:56 -04:00
Jonathan Barrow
60b6392153
Added return types to route handlers 2023-04-29 17:40:54 -04:00
Jonathan Barrow
b9481892e0
Removed unsafe .get() calls from Mongoose documents 2023-04-29 15:39:20 -04:00
Jonathan Barrow
4f19993889
Only use fcdcert as the source of truth for 3DS consoles 2023-04-29 13:27:39 -04:00
Jonathan Barrow
b8f1486fbf
Fixed NASC errors not being sent correctly in middleware 2023-03-31 12:11:36 -04:00
Jonathan Barrow
39ccd942cb
Convert Maps to JSON objects on request body 2023-03-19 16:21:30 -04:00