feat(enrichment): flag risky workflow permissions and triggers#2668
feat(enrichment): flag risky workflow permissions and triggers#2668jaso0n0818 wants to merge 2 commits into
Conversation
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - reject/close recommendedReview updated: 2026-07-03 05:49:26 UTC
🛑 Suggested Action - Reject/Close
Review summary Blockers
Nits — 4 non-blocking
Why this is blocked
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
6649205 to
d8f0567
Compare
9cc7d9f to
25de4b2
Compare
25de4b2 to
35e8354
Compare
JSONbored
left a comment
There was a problem hiding this comment.
Closing, see gittensory review for blockers.
AI reviewers agree on a likely critical defect: review-enrichment/src/analyzers/workflow-permissions.ts:129 resets `OnBlockTracker` at every hunk and only enters the block after seeing `on:`, so adding `pull_request_target:` or `- workflow_run` under an existing `on:` block whose `on:` line is outside the diff context produces no finding even though the PR claims those trigger declarations are detected. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.
What
A new local REES analyzer,
workflowPermissions, that flags changes to.github/workflows/*which grant broad or sensitive permissions, or add high-risk event triggers — thepull_request_target+ write-token supply-chain class, where untrusted fork code runs with the base repo's secrets and a write token.Detections (the fixed GitHub Actions schema — a bounded enum)
permissions: write-allid-token: write(OIDC cloud-credential exchange)secrets: inherit(forwards all of the caller's secrets to a reusable workflow)contents/packages/actions/deployments/security-events: write(reports the scope)pull_request_targetandworkflow_runtriggers, matched only as a trigger declaration — anon:line naming it, a mapping key, or a-list item — so the token merely appearing in a name/value is not flaggedWhy it is bounded / merge-safe
It matches the fixed GitHub Actions workflow schema (a documented enum of permission scopes and event names), never arbitrary code, so it has no unbounded parsing edge cases. YAML
#comments are stripped before matching. It mirrors the existingactions-pinandiac-misconfigline-cited patch analyzers (per-line scan, hunk tracking,MAX_FINDINGS/MAX_LINE_CHARScaps, dedup by kind+line, fail-safe on abort).Value
No existing analyzer covers workflow permission escalation or dangerous event triggers. A PR that adds
pull_request_target(running untrusted fork code with the base repo's secrets) or a broadwrite-allgrant is a well-known supply-chain vector worth surfacing before merge.Tests
review-enrichment/test/workflow-permissions.test.tscovers every kind, each sensitive scope, YAML-comment stripping, read-grant andactions/*uses-ref non-matches, new-file line tracking across removed/context lines, per-kind dedup, the budget/abort paths, and the workflow-path filter. Analyzer metadata is regenerated and committed.No linked issue
No linked issue because this is a net-new analyzer; there is no tracking issue to link.