Security hardening from audit#1
Open
DROOdotFOO wants to merge 2 commits into
Open
Conversation
Fix API key timing leak (pad buffers to equal length), circuit breaker auto-reset after window, reject zero amounts, restrict audit log perms, rate limit /status, type-safe receipt handling, non-localhost TLS warning, Docker HEALTHCHECK. Noir contract: limit validation, admin reset_daily_spent, recompiled artifact. Rate limiter exported with 8 new tests.
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
Security hardening pass based on audit against 2026 threat landscape ($482M stolen YTD, 76% infrastructure attacks).
Critical/High fixes:
timingSafeEqualtests/rate-limiter.test.ts)/statusnow rate-limitedas unknown as Recordcasts with runtime guards^[1-9]\d*$)0o600permissionsNoir contract hardening:
initialize_public_stateandapply_limitsvalidatedaily_limit >= max_per_txand u64 rangereset_daily_spent()admin function for epoch stall recoverynargo compileProduction readiness:
Test plan
npm run typecheck-- cleannpm test-- 127/127 pass (8 files, including new rate-limiter tests)nargo compile-- Noir artifact valid (1.65MB)