Skip to content

Suppress RGS-004 runner-guard false positives for activation-gated jobs - #50370

Merged
pelikhan merged 3 commits into
mainfrom
copilot/rgs-004-remove-workflow-author-check
Aug 4, 2026
Merged

Suppress RGS-004 runner-guard false positives for activation-gated jobs#50370
pelikhan merged 3 commits into
mainfrom
copilot/rgs-004-remove-workflow-author-check

Conversation

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

runner-guard's RGS-004 rule reports 113 findings against ai-moderator.lock.yml, claiming comment-triggered jobs access secrets without an author authorization check.

Verdict: false positive

The compiled job graph is:

pre_activation (if: ...author_association guard...)
  └─ activation → agent → {evals, unlock, safe_outputs, push_evals_state} → conclusion

pre_activation carries a static guard compiled from skip-author-associations:

pre_activation:
  if: >
    ((!(github.event_name == 'issue_comment') || !contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) && ...)

Every other job transitively needs: pre_activation, so all downstream jobs are skipped when the gate fails. Probing runner-guard 3.1.5 with synthetic workflows confirms it recognizes a step-level if: referencing author_association, but ignores job-level if: conditions and never follows needs: edges. No step ordering fix is required.

Changes

  • pkg/cli/runner_guard.go — parse job_id from findings; filter before display and before the strict-mode count. Strict mode no longer errors on exit code 1 when every finding was filtered.
  • pkg/cli/runner_guard_activation_gate.go (new) — reconstructs the job dependency graph from the lock file and computes the transitive closure of jobs gated by an author_association check. Drops RGS-004 findings for gated jobs only.
  • pkg/cli/runner_guard_activation_gate_test.go (new) — gate propagation through needs:, ungated workflows retaining findings, unresolvable/escaping paths, needs: scalar/list normalization.

Generalized across all compiled workflows rather than hardcoded for ai-moderator, and fail-safe: findings are retained whenever the lock file cannot be resolved, read, or parsed, and paths are validated to stay within the git root.

Replaying the real scan output through the filter yields 118 → 5 findings: all 113 RGS-004 suppressed, the 5 unrelated RGS-005 ("Excessive Permissions on Untrusted Trigger") findings retained. Those are pre-existing and out of scope here.

Copilot AI and others added 2 commits August 4, 2026 19:26
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix comment-triggered workflow without author authorization check Suppress RGS-004 runner-guard false positives for activation-gated jobs Aug 4, 2026
Copilot AI requested a review from pelikhan August 4, 2026 19:43
@pelikhan
pelikhan marked this pull request as ready for review August 4, 2026 19:50
Copilot AI balanced review requested due to automatic review settings August 4, 2026 19:50
@pelikhan
pelikhan merged commit 275111f into main Aug 4, 2026
8 of 9 checks passed
@pelikhan
pelikhan deleted the copilot/rgs-004-remove-workflow-author-check branch August 4, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds filtering for runner-guard RGS-004 false positives on activation-gated compiled workflows.

Changes:

  • Parses finding job IDs and filters gated RGS-004 findings.
  • Reconstructs transitive workflow job dependencies.
  • Adds filtering, path-resolution, and dependency tests.
Show a summary per file
File Description
pkg/cli/runner_guard.go Integrates filtering and strict-mode handling.
pkg/cli/runner_guard_activation_gate.go Implements gate detection and finding suppression.
pkg/cli/runner_guard_activation_gate_test.go Tests gate propagation and fail-safe behavior.
.github/skills/agentic-workflows/SKILL.md Removes an invalid documentation reference.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/4 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread pkg/cli/runner_guard.go
Comment on lines +174 to +176
// Exit code 1 with no remaining findings means every reported finding was
// a known false positive that was filtered out, so the scan passes.
return nil
Comment on lines +138 to +139
if hasAuthorAssociationCheck(job.If) || anyJobGated(gated, jobNeeds(job.Needs)) {
gated[jobID] = true

gatedJobs, ok := gatedJobsByFile[finding.File]
if !ok {
gatedJobs = authorAssociationGatedJobs(resolveRunnerGuardFilePath(gitRoot, finding.File))
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.85.0

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.

[static-analysis] RGS-004: Comment-Triggered Workflow Without Author Authorization Check in ai-moderator.lock.yml

3 participants