fix(api): prevent denied requests from growing the audit store - #83
Open
BunsDev wants to merge 1 commit into
Open
fix(api): prevent denied requests from growing the audit store#83BunsDev wants to merge 1 commit into
BunsDev wants to merge 1 commit into
Conversation
Signed-off-by: Codex <codex@openai.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the tenant-scoped GitHub task API against unauthenticated resource exhaustion by ensuring denied requests no longer write durable api_audit rows (avoiding SQLite growth and lock contention), while keeping authenticated reads durably auditable.
Changes:
- Removed
record_api_read(..., "denied")writes from the denied branches of tenant-scoped API endpoints and replaced them withwarn!logging. - Updated tenancy-mode regression tests to assert denied/unauthenticated requests do not create durable audit entries.
- Updated documentation to clarify that only authenticated reads are durably audited.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| README.md | Updates security posture wording to state only authenticated reads are audited. |
| docs/security.md | Clarifies that unauthorized calls are logged (no durable-store writes) and authenticated reads are durably audited. |
| crates/webhook/src/routes.rs | Removes durable audit writes from denied branches, adds logging, and updates tests accordingly. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Motivation
GET /api/github/*requests wrote durableapi_auditrows and could be abused to fill the shared SQLite store and cause lock contention.Description
record_api_read("anonymous", "none", … "denied")calls from the denied branches of the tenant-scoped endpoints (list_tasks,list_memory,revoke_memory,usage,audit, androuting) and replace them with structuredwarn!log entries that do not touch the shared store.record_api_readcalls for successful and error outcomes of authenticated requests so authenticated reads remain auditable.README.mdanddocs/security.mdto state that only authenticated reads are durably audited.Testing
cargo check --all-targetswhich completed successfully.cargo clippy --all-targets -- -D warningswhich completed successfully.cargo test -p coven-github-webhook token_mode_fails_closed_and_reveals_nothingwhich passed and now verifies that unauthenticated denials create no durable audit rows.cargo test --all; webhook and store suites passed, but several worker HTTP-mock tests failed in this environment due to proxy-generated403 Forbiddenresponses for localhost requests and are unrelated to the audit-write change.Codex Task