Add a GitHub actor allow/deny guardrail to the notifications source#137
Open
polyglotAI-bot wants to merge 1 commit into
Open
Add a GitHub actor allow/deny guardrail to the notifications source#137polyglotAI-bot wants to merge 1 commit into
polyglotAI-bot wants to merge 1 commit into
Conversation
…source The github notifications source already fetched every login involved in a notification (issue/PR author, assignees, comment & review authors) during enrichment but only rendered them into content. Surface them as an `actors` metadata key and add `allow_actors`/`deny_actors` to GitHubSyncConfig, wired as a second InboxFilter rule in build_source_runners alongside the existing repo guardrail. This lets a deployment deterministically restrict *who* can put a GitHub notification in front of the worker, dropping drive-by @mentions from untrusted accounts at ingest — before the agent (and the prompt-injection surface) ever sees them. Matching is list-valued (kept if any involved login matches), deny-wins, and a non-empty allow_actors is fail-closed. Empty (the default) preserves existing behavior. Tests: actor FieldRule semantics (allow/deny/deny-wins/case-insensitive/ fail-closed), _collect_actors de-dup & ordering, config parsing, fetch() metadata emission incl. the enrichment-failure path, and registry wiring. Docs updated.
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
Adds a deterministic actor allow/deny guardrail to the
githubnotifications source, so a deployment can restrict which GitHub logins may put a notification in front of an autonomous worker — closing the gap where any GitHub user can drive the agent simply by @-mentioning it.The
githubsource already fetched every login involved in a notification (issue/PR author, assignees, comment & review authors) during enrichment, but only rendered them into the record content. This surfaces them as anactorsmetadata key and filters on it with the existingInboxFilterengine — at ingest, before records persist to the inbox (and before the LLM / prompt-injection surface sees them).Changes
nerve/sources/github.py—_collect_actors(...)unions every involved login (de-duped case-insensitively, skipping empty/?placeholders); the fetch loop adds it as theactorsmetadata key. No new API calls — the logins are already fetched during enrichment.nerve/config.py—GitHubSyncConfiggainsallow_actors/deny_actors.nerve/sources/registry.py— the github source'sInboxFilteris now two ANDedFieldRules:repo_nameandactors.docs/sources.md— documents the actor guardrail.Semantics
Mirrors
allow_repos/deny_repos: case-insensitive globs, deny wins, list-valued (kept if any involved login matches), and a non-emptyallow_actorsis fail-closed (a notification with no identifiable actor is dropped). Empty (the default) preserves existing behavior. The repo and actor rules AND together.actorskeys off the real enrichment author fields (comment/review authors), not body @-mention text, so it can't be spoofed by mentioning a trusted login.Test plan
pytest tests/test_source_filters.py tests/test_github_source_actors.py— 31 passedtests/fixtures/codex/...rollout fixtures)FieldRuleallow / deny / deny-wins / case-insensitive / fail-closed;_collect_actorsde-dup & ordering; config parsing;fetch()metadata emission incl. the enrichment-failure path (actors == []); andbuild_source_runnerswiring (active filter, passthrough when unset).