Security update 3: continuous assurance - #45
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c26996841c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ($replayProtection) { | ||
| fvplus_security_consume_nonce($state, $nonce, $endpoint, $action, $now); | ||
| fvplus_security_consume_transaction($state, $transactionId, $endpoint, $action, $now); | ||
| } | ||
| fvplus_security_enforce_rate_limit($state, $contract, $now); |
There was a problem hiding this comment.
Record failed authorization decisions in the audit ledger
When a mutation has an invalid/reused nonce, duplicate transaction ID, or exceeds its rate limit, one of these calls throws and execution never reaches the sole fvplus_append_security_audit_event() call below. Consequently, the new security ledger records only successful authorizations and omits the rejected/replayed requests that are most relevant to abuse investigation; append a sanitized failure event before propagating these authorization errors.
Useful? React with 👍 / 👎.
| $events = readJsonObjectFile(fvplus_security_audit_path()); | ||
| if (!is_array($events)) { | ||
| $events = recoverJsonObjectFromLastGood(fvplus_security_audit_path()); | ||
| } |
There was a problem hiding this comment.
Report an unreadable audit ledger instead of silently restoring it
If tampering or truncation makes security.audit.json invalid JSON, this fallback calls recoverJsonObjectFromLastGood(), which rewrites the primary file from its mirror; verification then reports the restored chain as healthy. Thus malformed-ledger tampering is silently repaired and never appears as a critical audit-integrity finding, unlike a valid-JSON alteration. Preserve/report the parse failure before any durability recovery.
Useful? React with 👍 / 👎.
Implements replay-resistant mutation authorization, runtime integrity and privacy-safe audit verification, dependency review, OpenSSF Scorecard, CodeQL v4, package 2026.07.28.05, documentation, and regression coverage.\n\nThis PR is the protected-branch delivery path because GitHub requires CodeQL results before accepting the commit on dev.