Skip to content

Harden /capabilities: authorization + same-repo + exit handling - #63

Merged
madhuchavva merged 1 commit into
mainfrom
harden/capabilities-authz
Aug 12, 2026
Merged

Harden /capabilities: authorization + same-repo + exit handling#63
madhuchavva merged 1 commit into
mainfrom
harden/capabilities-authz

Conversation

@madhuchavva

Copy link
Copy Markdown
Contributor

Addresses the three Greptile P1 findings (all verified legitimate against the code):

  1. Lacks authorization → new authorize job: commenter must be OWNER/MEMBER/COLLABORATOR (author_association, unspoofable, no token-permission needed).
  2. PR code receives write credentials → same-repo-only gate (skip isCrossRepository), so fork code is never run with the write token. Same-repo sdk-version/* branches require write access to push, so the residual is insider-only. Least-privilege: default token is read-only; only the capabilities job gets write.
  3. Structural failure reports success → apply exit 1 now fails the run (red) with a comment; unknown-capability (exit 3) is softened to a green run + rejection comment.

Merge to main and I'll re-run a /capabilities to confirm the authz gate passes for a trusted commenter and the flow still works end-to-end.

Same hardening applied to the main-app PR growthbook/growthbook#6626.

- authorize job: commenter must be OWNER/MEMBER/COLLABORATOR (unspoofable
  author_association) and the PR must be same-repo (no fork code run with the
  write token) — addresses the two P1 security findings.
- handle apply exit 1 (structural) as a red failure with a comment; soften
  unknown-capability (exit 3) to a green run with a rejection comment.
- least privilege: read-only default token; only the capabilities job gets write.
@madhuchavva
madhuchavva force-pushed the harden/capabilities-authz branch from 31646aa to ce1daf8 Compare August 12, 2026 20:59
@madhuchavva
madhuchavva merged commit d78aa0a into main Aug 12, 2026
1 check passed
@madhuchavva
madhuchavva deleted the harden/capabilities-authz branch August 12, 2026 21:00
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