[PR #215·216·218] First Three Security Review Fixes: Rate Limits Before Login, a Server Dependency Bump, and a Secret Length Check
On 2026-11-12 I had all of server parts 1 and 2 reviewed for security only (read-only). It found 0 high, 4 medium and 8 low findings, and I approved the first batch. This post covers that batch, fixed in three PRs. Findings 1, 2 and 9 went to PR 215, finding 3 to PR 216, and finding 5 to PR 218.
All three ran on my Windows computer. A Claude Code session (Claude Fable 5.2) did the security review, the work orders, the implementation, the checks and the PRs. Codex (gpt-6.1-terra) wrote the tests for PR 215 and 218, and the implementation side did not edit the test files. PR 216 changed no code or test files, so Codex was not used. The final review of PR 215 and 218 was done by codex exec review; the model name of the review for PR 218 could not be confirmed.
This post contains no real keys or tokens. It names only files, settings and behavior.
What was wrong
-
PR 215, no rate limits before login (findings 1, 2, 9): Six endpoints that someone who is not logged in can call (adding a login method, Kakao and Apple login, login refresh, invitation accept, password reset) had no rate limit (a guard that caps requests from the same source).
- Adding a login method ran a password hash (a heavy calculation that makes a password unreadable) before checking the code ticket. Someone could slow the server by sending fake tickets. When Claude timed the service function alone, one fake ticket took 35 ms and 40 at once took 389 ms.
- Kakao and Apple login left one history row for every fake token, and for Kakao the server also made one request to Kakao.
-
PR 216, security advisories on server dependencies (finding 3):
npm audit(a command that reports known security problems in the parts you use) flagged two server parts that ship in the service with denial-of-service advisories (attacks that crash or freeze a server).Part Advisory Does it apply to our server? body-parser2.3.0 (reads request bodies)GHSA-27r3-jxmh-p828 We use the default settings, so the condition is met. It was not confirmed that it actually crashes multer2.4.0 (receives file uploads)GHSA-q7qp-rjg7-q26m Not applicable. It affects only an async fileFilter, and photo upload does not usefileFilter -
PR 218, signing secret length (finding 5): At startup the server checks its environment variables (settings supplied from outside the server). The photo-URL signing key refuses to start if it is shorter than 32 characters, but
JWT_SECRET(signs access tokens and similar),REFRESH_SECRET(signs refresh tokens) andCODE_HMAC_SECRET(hash for storing one-time codes) were only checked for “not empty”. A short value can be guessed, which lets someone forge tokens.
What we chose and what we dropped
- PR 215, reuse the existing guard: We attached the
RateLimitGuardthat login and code confirmation already use to the six endpoints, with the same limits (10 per minute per IP and device value, 30 per minute per IP, counted separately for each endpoint). Going over returns429 too_many_requests. Adding a login method now checks password length, then the code ticket and link table signature, then hashes.- Dropped: a rate limit on the whole app (it could block requests after login and goes beyond the scope), and a separate limit for refresh only (the app normally refreshes once every 15 minutes, so the same value is enough, and one value keeps the explanation and tests simple).
- Not done:
GET /invitations/current(it is light and needs a signed ticket).
- PR 216, only
body-parserwas upgraded:npm update body-parserchanged only the lock file (package-lock.json, which records the exact versions to install).expresstakesbody-parseras a range, sopackage.jsondid not change, and 12 lines of the lock file did. The 2.4.0 release notes list the advisory fix and zstd body decompression, with no breaking change marked.- Why
multerwas left: photo upload does not meet the advisory’s condition, and getting the fixed version needs@nestjs/platform-express12.3.0 or later. Between 12.2.0 and 12.5.0, default behavior for reading requests and uploads changes (nesting-depth and part-count limits, status codes for some errors). The work order said to stop and report options to the owner if default behavior changes, so Claude stopped instead of deciding alone. - Dropped: forcing
multerup withoverrides(a setting that forces a nested part’s version), which makes a combination NestJS has not tested, andnpm audit fix --force, which also takes major upgrades all at once.
- Why
- PR 218, one check became a loop: The existing photo-URL signing key check in
apps/server/src/config/env.tsbecame a loop over four names. The error says only the name and length, likeJWT_SECRET must be at least 32 characters, and never shows the value.- Dropped: reporting all short names at once (it would change the existing error format), and checking “how random it is” (complex, and it would make long but obvious example values unusable in tests).
How we checked
- PR 215: Codex wrote 18 new tests first. In the tests-only commit, 15 failed and 3 passed, as expected. After the implementation all 18 passed. They check that the 11th request (same device) and the 31st (changing the device value) to each of the six endpoints get 429, that blocked requests create no history rows and no Kakao or Apple calls, and that a fake ticket never calls the hash. No existing test was changed. The full
npm run verify(admin web 325, customer app 463, server 665), 12 tests ofnpm run e2e:app, andcodex exec reviewall passed with no findings. - PR 216:
npm audit --omit=devwent from 23 findings (9 high) to 22 (8 high), and thebody-parserline disappeared.npm lsshowedexpress → body-parser@2.4.0. The 665 server tests, the fullnpm run verifyand 12npm run e2e:apptests passed. Claude also briefly put the four NestJS packages at 12.5.0 (not committed, then reverted) and saw type checks, lint and the 665 server tests pass. A standalone full verification was not run. - PR 218: Claude found every place that uses these three names. The test setup and
env.spec.tsall read values from.env.example, and those values were already 32 characters or longer, so nothing needed fixing. My computer has no.envfile that the server reads, so no value would be blocked from starting. In the tests-only commit, 6 of the 13 new tests failed (a 31-character value gave no error), and the other 7 describe behavior that is still correct, so passing was expected. After the implementation, 19env.spec.tstests, the fullnpm run verify(server 678) and 12npm run e2e:apptests passed, andcodex exec reviewhad no findings. Codex has no Docker and cannot run the server tests itself, so the Claude session confirmed the failures.
Step by step
| PR | What it did | Key point |
|---|---|---|
| 215 | Rate limits on six pre-login endpoints; hash only after the ticket check | Reuses the existing RateLimitGuard |
| 216 | body-parser 2.3.0 → 2.4.0 |
Lock file only; multer does not apply, so it stays |
| 218 | Refuse to start if three signing secrets are under 32 characters | Reuses the existing check format |
Who did what
- I: approved the first batch of review findings and ran the work on my Windows computer.
- Claude (Fable 5.2): did the security review, work orders, implementation, checks and PRs. It timed the service function and read the advisories’ conditions and the release notes.
- Codex (
gpt-6.1-terra): wrote the tests for PR 215 and 218. - Codex review (
codex exec review): did the final review of PR 215 and 218 with no findings. the model name for 218 could not be confirmed.
What we could not confirm
- PR 216: Claude could not confirm that the server actually crashes on the old version. A request with extra characters after a gzip body got a 400 from both 2.3.0 and 2.4.0 and did not crash. The advisory’s exact condition may not have been met, so this does not mean it was safe.
- PR 215: Nobody checked on a real phone that the app stays logged in when refresh gets a 429. Only the code was checked, and it does not delete the refresh key.
- PR 215 and 218: during the tests, the automatic verification failed once each. It happened while test writing or package installation overlapped, and the failing stream’s output was cut off, so the cause could not be confirmed. The standalone full verification run afterward passed.
What I learned
- Put heavy calculations after you know the request is real. When you add an endpoint that can be called before login, it is worth adding “did we attach a rate limit?” to the checklist.
- A proxy (a device that receives requests on the server’s behalf) makes every request look like it comes from the same IP. Without a
trust proxysetting, an IP-based limit hits everyone at once. - Before upgrading to the version
npm auditsuggests, read the advisory’s applicability condition and the release notes of the new version. This time one advisory closed with the lock file alone, and the other did not apply to our settings. - Run long tests to the end before finishing your reply. Automatic verification runs when a reply ends, so a test left running in the background can overlap and wipe each other’s build output.
- A length check blocks only short values. It does not stop someone from using the fake value from the example file, so real values must be generated fresh.