Repository navigation
Conversation
This branch has not been deployed
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.
Written-by: HugoXK
Fixes #1236
What changed
scripts/lib/rotationDrill.ts— the drill core. It mints a job token and an instance token, proves both resolve through the sameauthenticateApiTokenthe gateway and the credential endpoint call, revokes and replaces them, re-seals a bridge token with a throwaway key, and returns a failure unless both old values are refused and both replacements work. Each step writes onerotation.drill.*audit row naming the job and repository; no token value is printed or stored.scripts/rotation-drill.ts— the CLI. The default is a dry run that prints the steps and writes nothing;--applycreates a throwaway database underos.tmpdir()and runs the drill.--db <path>is allowed only inside the temporary root;NODE_ENV=production, the configuredDB_PATHandDATA_DIR, and any path outside the temporary root are refused before the file is opened.--keepkeeps the default temporary directory for inspection.package.json—npm run rotate:drill(tsx, so the drill runs from source without a build).docs/security.md— a Rotation drill section, beside the production instance-token rotation.changelog.d/1236.security.md— one paragraph.test/rotationDrill.test.ts— the happy path and audit rows, a rotation that leaves an old token live (the drill must fail and recordrotation.drill.failed), and the production/live/outside-temp refusals.Ran:
npx tsx --test test/rotationDrill.test.ts— 3 pass, 0 failnpm run rotate:drill— dry run, nothing writtennpm run rotate:drill -- --apply—rotation: drill passednpm run lint— 11 baseline warnings, unchangednpm run typecheck— passnpm run build— passnpm test— 3321 pass / 9 fail. The same 9 fail on the untouchedv0.5.0tree in a second worktree:deployAutomation(5),gateBaseTree(1),nginxCheck(2),securityHeaders(1). They are macOS host/tool failures, not this diff.Not run:
scripts/rotate-instance-tokens.mjs, which remains the production rotation.Risks
--dbit creates and removes a temporary directory, and--dbis refused outside the temporary root or on the configured live path.package.json,scripts/). The tip needs a PASS fromHugoXK-bot; the author of the tip may not PASS it. I have not posted one.Docs updated:
docs/security.md— Rotation drill.