hardening: boot secret validation + req.user.chain + shared csvCell util (#129, #130, #134)#164
Merged
Merged
Conversation
Three release-hardening fixes: - #129: validate ADMIN_SESSION_SECRET at boot via assertSessionSecret(), called in server.js startup, instead of lazily on the first admin sign-in. - #130: requireAdmin and requireTeamMemberOrAdmin now set req.user.chain on every grant path (admin + team-member), so audit logging has the chain. - #134: factor csvCell + formula-injection defense into a shared api/utils/csv.js (csvCell + csvRow); program-inbox CSV export now imports it so future exports inherit the same RFC-4180 quoting + injection guard. Tests: csv util (formula injection + quoting), assertSessionSecret (missing / short / ok), and middleware req.user.chain assertions. Full suite 293 pass.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Three quick hardening wins for the first official release.
ADMIN_SESSION_SECRETat boot. AddedassertSessionSecret()(calls the existinggetSecret()), invoked at the top ofstartServer()inserver.js, so a missing/short secret fails fast at boot instead of at the first admin sign-in.req.user.chainin admin middleware.requireAdminandrequireTeamMemberOrAdminnow setchainon every grant path (admin + team-member), so audit logging / forensics has the chain.csvCellutil. FactoredcsvCell+ the formula-injection defense out ofprogram-inbox.service.jsintoserver/api/utils/csv.js(csvCell+csvRow). The inbox export now imports it; future CSV exports inherit the same RFC-4180 quoting + injection guard.Test plan
npm test(server) — 293 pass (new: csv util formula-injection/quoting,assertSessionSecretmissing/short/ok, middlewarereq.user.chainassertions)node --check server.jscd client && npm run build— cleancd client && npm run lint— clean (0 warnings)Closes #129
Closes #130
Closes #134
Draft, targeting
develop, not merging (per CLAUDE.md §6).