Skip to content

Add a GitHub actor allow/deny guardrail to the notifications source#137

Open
polyglotAI-bot wants to merge 1 commit into
ClickHouse:mainfrom
polyglotAI-bot:polyglot/github-actor-allowlist
Open

Add a GitHub actor allow/deny guardrail to the notifications source#137
polyglotAI-bot wants to merge 1 commit into
ClickHouse:mainfrom
polyglotAI-bot:polyglot/github-actor-allowlist

Conversation

@polyglotAI-bot

Copy link
Copy Markdown
Contributor

Summary

Adds a deterministic actor allow/deny guardrail to the github notifications 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 github source 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 an actors metadata key and filters on it with the existing InboxFilter engine — 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 the actors metadata key. No new API calls — the logins are already fetched during enrichment.
  • nerve/config.pyGitHubSyncConfig gains allow_actors / deny_actors.
  • nerve/sources/registry.py — the github source's InboxFilter is now two ANDed FieldRules: repo_name and actors.
  • 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-empty allow_actors is fail-closed (a notification with no identifiable actor is dropped). Empty (the default) preserves existing behavior. The repo and actor rules AND together.

sync:
  github:
    allow_actors: ["alice", "bob"]   # only notifications involving these logins reach the inbox
    deny_actors:  ["noisy-bot"]

actors keys 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 passed
  • Full backend suite green except unrelated pre-existing failures (missing tests/fixtures/codex/... rollout fixtures)
  • Coverage: actor FieldRule allow / deny / deny-wins / case-insensitive / fail-closed; _collect_actors de-dup & ordering; config parsing; fetch() metadata emission incl. the enrichment-failure path (actors == []); and build_source_runners wiring (active filter, passthrough when unset).

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant