security: fail-closed on revoked/out-of-policy memory activity and propagate revocation load errors - #85
Merged
BunsDev merged 2 commits intoAug 26, 2026
Conversation
Signed-off-by: Codex <codex@openai.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens the coven-github worker’s memory-governance enforcement by failing closed when the runtime reports revoked/out-of-policy memory activity, and by ensuring revocation list load failures no longer silently degrade into an “allow all” posture. This fits the adapter’s responsibility to enforce governance at the publication boundary before any GitHub-facing output is emitted.
Changes:
- Add
enforce_memory_activityto refuse publishing when anymemory::MemoryRejectionis present. - Propagate revocation-store lookup errors (with
anyhow::Context) instead of defaulting to an empty denial list. - Add unit tests to assert rejected memory activity blocks publication while accepted activity remains publishable.
Suppressed comments (1)
crates/worker/src/lib.rs:771
- This test asserts the full error string exactly, which is brittle if the error message is adjusted (e.g., to add counts or other safe context). It’s sufficient to assert that the failure contains the key refusal text.
assert_eq!(
error.to_string(),
"runtime reported out-of-policy memory activity; refusing to publish result"
);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+840
to
+845
| .with_context(|| { | ||
| format!( | ||
| "failed to load memory revocations for installation {}", | ||
| task.installation_id | ||
| ) | ||
| })? |
Comment on lines
+746
to
+750
| anyhow::ensure!( | ||
| rejections.is_empty(), | ||
| "runtime reported out-of-policy memory activity; refusing to publish result" | ||
| ); | ||
| Ok(()) |
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
Description
enforce_memory_activitywhich fails publication when anymemory::MemoryRejectionis present, and call it before any GitHub-facing publication path so a runtime result influenced by revoked or out-of-policy memory is refused (run_and_publish).revocations_for(...).await.with_context(...)?).Contextfromanyhowto support richer error context when revocation lookup fails.memory_enforcement_tests) that assert rejected memory activity blocks publishing and that accepted activity remains publishable.Testing
cargo check --all-targetsandcargo clippy --all-targets -- -D warnings, both completed successfully.cargo test -p coven-github-worker memory_enforcement_tests -- --nocapture, and the new tests passed (2 passed).cargo test --allwhere all non-worker suites passed; the worker crate overall ran many tests (75 passed, 21 failures) — the failing worker integration tests reflected shared-environment GitHub mock403 Forbiddenresponses in this environment and are not regressions of the memory-enforcement logic; the targeted regression tests introduced here passed.Codex Task