Repository navigation
feat(#6042): support Prow OWNERS file authorization for slash commands - #6051
Conversation
E2E tests are runningAuthorization passed for this commit. See the E2E Tests workflow for results. |
PR Summary by QodoSupport opt-in Prow OWNERS authorization for slash-command dispatch
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1.
|
|
Adding more bash is always technical debt (we're on a journey to move much of it into the go binary), but - that said, the cli entrypoint you'd need to use here (imagine - a new I think we should file a backlog issue to centralize that in a new subcommand and replace this - meaning that, I think I'm ok with moving forwards with adding more bash here for now. I'd love to hear from others in @fullsend-ai/core before moving forwards though. |
waynesun09
left a comment
There was a problem hiding this comment.
Multi-model review (Claude ×2 + Grok, with maintainer verification). Review-only — no approve/request-changes action. Posting the unique MEDIUM-and-above findings inline; qodo's #4 (givenOwnersAliasesFile missing OwnersAuthActivated) and #5 (resetScenarioWorld doesn't reset it) are confirmed and deepened — a stale/true flag makes later scenarios commit empty OWNERS files to their leased slot — so they're not re-posted here. qodo #1 (guide placement) is a false positive: there is no docs/guides/admin/ and the file pre-dates this PR.
The gate itself is sound
The has_repo_permission / _owners_has_user bash was traced by all three reviewers and executed against yq v4 with injection probes: username (^[a-zA-Z0-9-]+$) and alias-entry (^[a-zA-Z0-9_-]+$) are validated before any yq interpolation, key is always a literal, it fails closed on every malformed input, and the ;;& fallthrough correctly gives approvers write+triage while reviewers can never reach write. The inline-bash choice is not itself a defect — @RaphaelBut, your instinct to ask was right, and the answer is that the logic is safe as written.
Must-fix before merge
- H1 — the
pull_request_reviewcheckout ref makes the "cannot self-authorize" invariant false on that path (workflow-level; not fixed by any refactor). One-line pin fix inline. - H2 — the OWNERS-auth e2e scenarios exercise the auth path in zero cases and have never run on this fork PR. Inline.
- M1 — case-sensitive matching silently denies the non-collaborator Prow users this feature targets. Inline.
Direction — bash vs. Go package vs. CEL
This is the real decision, and it needs a core-team call (see @ifireball below). Summary of the analysis:
- CEL is not reachable for this feature yet. CEL authorization runs host-side in Go, but only in the
harness-dispatchjob for custom agents, and its env exposes onlyevent(no OWNERS data / API). The built-in stages this PR targets (triage/code/fix/review) are routed by the bashRoutejob, which is checkout + one bash step and has nofullsendbinary. Routing OWNERS auth through CEL would first require migrating built-in stages onto harness-dispatch — the "default agents not on CEL" gap. - The Go package is the right home for the logic (parsing, alias resolution, actor→role, policy): typed, unit-testable, and it makes M1 and the M5/typo gap correct by construction. Its durable consumer is the
IsAuthorized/ normalized-event layer that already runs Go — after the built-in-stages migration. - But wiring a
fullsend owners-checksubcommand into theRoutejob now would add a binary install/build step to the highest-frequency path (every comment/label/review across all repos), and it's throwaway once the migration lands — the exact cost @RaphaelBut flagged in the PR description.
Recommended sequencing: land this as the reviewed bash interim after H1 + H2 + M1; extract internal/owners/ (logic + tests) as the immediate follow-up so the resolver exists and is reusable; let the built-in-stages→harness-dispatch/CEL migration — not this PR — be what moves the call site into Go. That path fixes the review's real concerns without gating a first contribution behind a core dispatch-path migration.
@ifireball — flagging you as fullsend core / CEL owner
The substantive open question here isn't the bash correctness (verified) but the direction above: whether OWNERS authorization should be built toward the CEL / harness-dispatch authorization path — and whether/when built-in stages migrate onto it — or ship as the interim bash gate and be revisited during that migration. That's your call as CEL feature owner; the recommendation above is a proposal, not a decision. H1 (the security-invariant/checkout-ref fix) also warrants a core-team eye since it touches the dispatch trust boundary.
7621199 to
4c93fe3
Compare
|
Thanks @waynesun09 and @ralphbean for the thorough review! Highlights beyond what's visible in the diff:
|
waynesun09
left a comment
There was a problem hiding this comment.
Review-only sweep — no approve/request-changes action taken. Posting one additional finding not already covered by existing review threads; the OWNERS-auth CI-coverage gap I'd flagged is already tracked in more depth by the existing HIGH comment on e2e/behaviour/features/dispatch/owners-auth.feature (skipped as a substantive duplicate).
|
im working on the OWNERS-auth CI-coverage gap |
Site previewPreview: https://014006ed-site.fullsend-ai.workers.dev Commit: |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
waynesun09
left a comment
There was a problem hiding this comment.
Approving. Re-reviewed at 62efb214: H1 (pull_request_review checkout ref) is fixed in both workflow files, and M1/M3/M4/M5 plus the config-setter finding are all resolved — with scaffold parity and unit tests added on top.
I also verified the OWNERS grant/deny logic executes correctly against the shipped bash locally: approver→write, reviewer→triage-only (no escalation), alias resolution, case-insensitive matching, and injection blocked. The ;;& privilege boundary is now pinned by a running test across both workflow files.
Only remaining item is live behaviour/e2e coverage, which is fail-closed and non-blocking — fine as a follow-up alongside the CI-coverage work you're already on. Nice work for a first contribution.
ifireball
left a comment
There was a problem hiding this comment.
Needs to add an implementation of this to the custom agent dispatch path as well (inside the Go binary)
To @waynesun09 about wither CEL expressions should come into play - wither the hard-wired auth will be replaced by the expressions is an open question (has to do with wither we ever want to allow agent use by less privileged actors). I do not think it is in scope for this.
|
Thank you so much for all of your reviews <3 Pushed 659e568 to adress review comments and add a denial test, although I am not quite sure if we should go a bit further still with adding more tests around this.
If you decide this PR is far enough to let the CI run, we can take a look at how my tests break :D |
waynesun09
left a comment
There was a problem hiding this comment.
Review-only sweep (multi-agent, verified against the live PR head and CI). No approve/request-changes action taken. Findings below are all newly introduced or newly-relevant as of the final commit (659e568c) and were checked for overlap with existing review threads before posting; the write-denial CI failure was reproduced live against the exact head SHA.
|
@RaphaelBut rebase is needed to resolve conflicts |
ralphbean
left a comment
There was a problem hiding this comment.
Nice work carrying this through so many rounds of review — the OWNERS/alias resolution logic and the new Go package are solid, and the earlier H1/H2/M1 findings all look genuinely fixed.
One thing I noticed poking around outside the diff: route and harness-dispatch now pin their config checkout to the base SHA for pull_request_review events, but fix (and triage/code/review/retro/prioritize/harness-run) still only pin for pull_request_target. fix is the one stage pull_request_review actually dispatches, so its kill-switch/config checks can still read from the PR head there. It's not part of this diff so I can't point at a line directly, but it'd be worth fixing.
A couple more notes inline.
659e568 to
75cb622
Compare
|
Thanks again! Rebased on main and addressed all review comments in a single commit. I humbly request another CI run :D Summary of changes: Security fixes:
Test hardening:
Code:
Docs:
Deferred: Provider-list config schema tracked in #6072. |
waynesun09
left a comment
There was a problem hiding this comment.
Review-only pass (no approve/request-changes action) — one additional MEDIUM finding not covered by the existing threads on this PR.
waynesun09
left a comment
There was a problem hiding this comment.
Review-only pass (no approve/request-changes action taken) — 2 findings not covered by existing threads on this PR.
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 11:35 PM UTC · Completed 11:56 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $9.88 |
A login equal to a nested alias key still matched: with `team-b: [team-a, carol]`, a GitHub user named team-a was treated as a member of team-b and got its role. Both the Go resolver and the bash matcher now return no match for any login that equals an OWNERS_ALIASES key, wherever the key appears. Nested aliases are not expanded, as before. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
…nterfaces OWNERS-file authorization is per-repo only, so move the accessor and setter from the shared ConfigReader/ConfigWriter to PerRepoConfigReader/PerRepoConfigWriter and drop the orgConfig stubs. Rename them to IsOwnersFileAuthEnabled/SetOwnersFileAuthEnabled to match the package's predicate names. ParsePerRepoConfigWriter now returns PerRepoConfigWriter; existing callers are unaffected. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 12:05 AM UTC · Completed 12:29 AM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $9.84 |
…pplies The Go harness-dispatch path admits write-level roles only, so an OWNERS reviewer's triage-level grant covers /fs-triage and /fs-review but not custom agents. Say so in the config reference and the layered config reference instead of implying both paths behave the same. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
…gates The merge queue's behaviour run failed one scenario because the collaborator API answered 404 for halfsend-03/test-repo-10 right after the repo was recreated; a later ensure of the same repo granted it without error. Retry AddCollaborator on 404 with exponential backoff (six attempts, about 30 seconds) before failing the allocation. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
Summary
Adds opt-in Prow OWNERS file authorization for slash command dispatch. Repos that use Prow/OWNERS instead of GitHub collaborator roles can add
owners_fileto theauthorizationproviders list in.fullsend/config.yamlto letOWNERS-listed users trigger fullsend agents without needing GitHub write/triage collaborator access. Approvers get write-equivalent access; reviewers get triage-equivalent only. OWNERS is checked first; if it authorizes the user,
the collaborator API is not consulted. If the user isn't in OWNERS, it falls through to the collaborator API.
Changes
fallthrough mapping the role hierarchy
filepath.Dir(ConfigDir), not bare working-directory paths
workflow contracts documents the OWNERS sync contract and parity test coverage
Known limitations
Related
Testing
Checklist