feat(worker): proxy security hardening — 7-layer defense-in-depth stack#62
Open
wgordon17 wants to merge 12 commits intogordon-code:mainfrom
Open
feat(worker): proxy security hardening — 7-layer defense-in-depth stack#62wgordon17 wants to merge 12 commits intogordon-code:mainfrom
wgordon17 wants to merge 12 commits intogordon-code:mainfrom
Conversation
- sealApiToken: add purpose parameter, include in POST body (CRIT-001, 6/7 reviewers) - ensureSession: wrap issueSession in try/catch, fallback to random sessionId on error (SEC-002, STRUCT-005) - handleProxySeal: add VALID_PURPOSES allowlist + 64-char max-length for purpose field (SEC-003, QA-002) - validateAndGuardProxyRoute: include CORS headers on validation error responses (SEC-004) - session.ts: cache derived HMAC keys at module level to avoid repeated HKDF derivation (PERF-001/002) - turnstile.ts: add 5s AbortController timeout to siteverify fetch (PERF-003) - proxy.test.ts: update sealApiToken calls with purpose, assert body.purpose field, add error field test - seal.test.ts: update purpose values to match VALID_PURPOSES allowlist - crypto.test.ts: add cross-purpose isolation test (F-003)
…path, adds rate limiter error test
- adds Turnstile token length guard (>2048) with boundary tests - adds seal key derivation cache (_sealKeyCache Map, bounded by VALID_PURPOSES) - passes pre-parsed pathname to validateAndGuardProxyRoute (eliminates redundant URL parse) - unifies session key cache into single Map (removes duplicate getSessionHmacPrevKey) - fixes structured error logging in ensureSession catch path - removes dead options parameter from validateProxyRequest - corrects HKDF key material descriptions in CryptoEnv and DEPLOY.md - fixes test key comments to match actual decoded values - adds 14 new tests covering previously-untested paths
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