You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[plan] Add compile-time warning when write permissions appear directly on agent job #19541
Add a validation warning during gh aw compile (or make compile) when write permissions (e.g., issues: write, pull-requests: write, contents: write) are found directly in the agent job's permissions block. The correct pattern is to keep the agent job read-only and route all writes through safe-outputs.
Background
Discussion #19488 (Agent Persona Exploration report) identified that one AI-generated workflow placed issues: write directly on the agent job instead of relying exclusively on safe-outputs. This is a security anti-pattern: the agent job should stay read-only, and writes should be performed by the safe-outputs system using a scoped GitHub App token.
Approach
In pkg/workflow/permissions_validation.go (or pkg/workflow/compiler.go in validateWorkflowData()), add a check that iterates the agent job's permissions block.
If any write-level permission is found on the agent job itself, emit a console.FormatWarningMessage (not a hard error, since there may be valid edge cases).
The warning message should explain the preferred pattern:
⚠️ Agent job has issues: write permission. Best practice is to keep the agent job read-only and use safe-outputs for all writes. See docs/safe-outputs.md.
Add a unit test in the relevant *_test.go file covering:
Agent job with write permission → warning emitted
Agent job with only read permissions → no warning
Agent job with safe-outputs configured + write permission → warning still emitted (pattern clarification)
@copilot there is no valid edge case to have a write permission in the agent container (aside from id-token: write). So raise an error. This is a compiler bug.
Activity
pelikhan commentedon Mar 4, 2026
@copilot there is no valid edge case to have a write permission in the agent container (aside from id-token: write). So raise an error. This is a compiler bug.