Repository navigation
Drop the audit log's IP and user agent columns - #75
Merged
Merged
Conversation
#74 stopped anything writing `ip_address` and `user_agent`, and that code is deployed. Dropping the columns is now safe, because the image currently serving does not name them in its INSERTs. Doing both at once would have broken production: `deploy.sh` migrates while the previous backend is still serving, and the rollback path restores that same image against the already-migrated schema. ## What changed The migration drops both columns, taking whatever history they held with them. The schema stops declaring them. The comment left in their place says why they are gone, so the next person to reach for a convenient `req.ip` finds the reasoning rather than an absence. The migration uses `DROP COLUMN IF EXISTS`. CI re-applies every migration against an already-migrated database to prove idempotency, and drizzle-kit generates a bare `DROP COLUMN`, which succeeds once and then errors - that is how the first attempt at this failed. ## Tests The assertion moves from values to schema. Reading `information_schema` is the stronger guarantee: deleting the code that writes a column leaves the column behind, and the test now fails if it ever comes back. It also checks the table did not simply vanish, which is how that kind of assertion passes for the wrong reason. ## The deck, and a claim it was going to get wrong Slide 10 disclosed the IP and browser string. That is now false, so it says what is actually kept: an email, and which group they work with. The "what is not there" line widens to **IP addresses or cookies in anything Relay stores**, which is narrower than the phrasing I first wrote. "For anyone at all" would have been wrong: `authLoginRateLimiter` and `authVerifyRateLimiter` use express-rate-limit's default key generator, which keys on raw `req.ip` and holds it in memory for the full fifteen-minute window. The file's own comment says so. Rather than quietly narrow the wording, that now appears in the slide's known-limits line, next to the routing metadata Relay already volunteers: the login rate limiter holds a caller address in memory for fifteen minutes to make brute-forcing a sign-in expensive, and neither is written down. `docs/prd_to_mvp_plan.md` still listed `ip_address` in its record of the schema. Removed. ## Verification - test database dropped and rebuilt from scratch, then every migration re-applied by hand: no failures, and `audit_log` ends with neither column - 152 backend tests pass, lint and typecheck clean
Four findings. The first is not a deck wording problem, it is a live violation of a constraint CLAUDE.md calls non-negotiable. nginx's stock access log format ends with $http_user_agent and $http_x_forwarded_for, and Caddy appends the real client address to X-Forwarded-For before proxying. Only the health-check location set access_log off. So every page load wrote the visitor's IP and browser string to stdout, which Docker's default json-file driver persists on the host unrotated - no logging options are set in the compose file. Verified by request rather than by reading: GET /directory logged "Mozilla/5.0 TestBrowser" "203.0.113.77". That is who browsed the public directory, which CLAUDE.md forbids in as many words, and the deck was about to deny it in the same release. A log_format carrying only time, request, status, size and duration replaces it. Same request now logs none of the three identifying strings. $remote_addr is omitted as well: it is only ever Caddy's container address, so it identifies nothing while reading as though it might. The deck also lost a disclosure it should have kept. Trimming the organizer line to an email and a group removed the activity trail along with the IP - auditMiddleware still records every authenticated write plus sign-in and sign-out against a user id and timestamp, and nothing prunes it. The line says so again. The known-limits sentence contradicted itself inside one clause: it said the routing metadata is stored in the clear and then that neither limit is written down, immediately before an existing sentence using the same phrase to mean documented. Rewritten. And an assertion in the new test could not fail: db.select projects whatever the Drizzle model declares, so checking the returned keys lack ipAddress would pass even if the migration had never run. Removed, with a note pointing at the information_schema assertion that is the real guarantee.
This was referenced Aug 30, 2026
Flatts3000
added a commit
that referenced
this pull request
Aug 30, 2026
…76) * Close the same access-log leak in the config that ships in the image `frontend/nginx.conf` had no `access_log` directive, so it inherited nginx's stock format - which ends with `$http_user_agent` and `$http_x_forwarded_for`. The root `docker-compose.yml` runs the frontend image with **no bind mount**, so that config is the one actually serving there, and every page load recorded who was asking. CLAUDE.md rules that out in as many words: no tracking of who browses the public directory, no IP logging on anonymous routes. This is the same drift the `/deck` header block guards against, and the comment says so: production bind-mounts `deploy/nginx.prod.conf` over this file, so this copy never serves a real visitor - but if the two disagree, the protection disappears the moment that mount is dropped. Verified the same way as #75, by request rather than by reading. `GET /deck/` with `X-Forwarded-For: 203.0.113.55` and a distinctive user agent: ``` [30/Aug/2026:18:22:14 +0000] "GET /deck/ HTTP/1.1" 200 1147551 0.000 ``` Zero identifying strings in the log, against two before the change. * Scope the privacy comment to the access log The comment claimed the log carries nothing identifying, which is true of the access log and not of the error log beside it. Verified: an upstream refusing a connection writes 'client: 172.17.0.1' on every error-level event. Production is largely insulated - nginx only ever sees Caddy's container address there - but the root docker-compose.yml publishes the frontend directly on 3001, so client: is the real peer for anyone running the stack locally. Both configs now say what the claim covers, and #77 tracks the error log and the fact that neither compose file rotates anything.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #70. Part two, and the reason it is a separate release is in #74.
#74 stopped anything writing
ip_addressanduser_agent, and that code is deployed. Dropping the columns is now safe, because the image currently serving does not name them in its INSERTs. Doing both at once would have broken production:deploy.shmigrates while the previous backend is still serving, and the rollback path restores that same image against the already-migrated schema.What changed
The migration drops both columns, taking whatever history they held with them. The schema stops declaring them. The comment left in their place says why they are gone, so the next person to reach for a convenient
req.ipfinds the reasoning rather than an absence.The migration uses
DROP COLUMN IF EXISTS. CI re-applies every migration against an already-migrated database to prove idempotency, and drizzle-kit generates a bareDROP COLUMN, which succeeds once and then errors - that is how the first attempt at this failed.Tests
The assertion moves from values to schema. Reading
information_schemais the stronger guarantee: deleting the code that writes a column leaves the column behind, and the test now fails if it ever comes back. It also checks the table did not simply vanish, which is how that kind of assertion passes for the wrong reason.The deck, and a claim it was going to get wrong
Slide 10 disclosed the IP and browser string. That is now false, so it says what is actually kept: an email, and which group they work with.
The "what is not there" line widens to IP addresses or cookies in anything Relay stores, which is narrower than the phrasing I first wrote. "For anyone at all" would have been wrong:
authLoginRateLimiterandauthVerifyRateLimiteruse express-rate-limit's default key generator, which keys on rawreq.ipand holds it in memory for the full fifteen-minute window. The file's own comment says so.Rather than quietly narrow the wording, that now appears in the slide's known-limits line, next to the routing metadata Relay already volunteers: the login rate limiter holds a caller address in memory for fifteen minutes to make brute-forcing a sign-in expensive, and neither is written down.
docs/prd_to_mvp_plan.mdstill listedip_addressin its record of the schema. Removed.Verification
audit_logends with neither column