Skip to content

Commit 837cf5f

Browse files
[docs] docs: Remove bloat from permissions.md (#3575)
1 parent 15fc225 commit 837cf5f

2 files changed

Lines changed: 28 additions & 125 deletions

File tree

.github/workflows/schema-consistency-checker.lock.yml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/content/docs/reference/permissions.md

Lines changed: 24 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ The `permissions:` section controls what GitHub API operations your workflow can
1010
```yaml wrap
1111
permissions:
1212
contents: read
13-
issues: write
14-
pull-requests: write
13+
actions: read
14+
safe-outputs:
15+
create-issue:
16+
add-comment:
1517
```
1618
1719
## Permission Model
@@ -20,30 +22,15 @@ permissions:
2022
2123
Agentic workflows follow a principle of least privilege:
2224
23-
- **Read-only by default**: Workflows run with minimal permissions
25+
- **Read-only by default**: Main job runs with minimal read permissions only
2426
- **Write through safe outputs**: Write operations happen in separate jobs with sanitized content
25-
- **Explicit permissions**: All permissions must be declared in frontmatter
27+
- **No direct write permissions**: Use safe-outputs instead of `write` permissions in the main job
2628

2729
This model prevents AI agents from accidentally or maliciously modifying repository content during execution.
2830

2931
### Permission Scopes
3032

31-
GitHub Actions permissions control access to different GitHub resources:
32-
33-
| Permission | Read Access | Write Access |
34-
|------------|-------------|--------------|
35-
| `contents` | Read repository code | Push code, create releases |
36-
| `issues` | Read issues | Create/edit issues, add comments |
37-
| `pull-requests` | Read pull requests | Create/edit PRs, add reviews |
38-
| `discussions` | Read discussions | Create/edit discussions |
39-
| `actions` | Read workflow runs | Cancel runs, approve deployments |
40-
| `checks` | Read check runs | Create status checks |
41-
| `deployments` | Read deployments | Create deployments |
42-
| `packages` | Read packages | Publish packages |
43-
| `pages` | Read Pages settings | Deploy to GitHub Pages |
44-
| `statuses` | Read commit statuses | Create commit statuses |
45-
46-
See [GitHub's permissions reference](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) for the complete list.
33+
Key permissions include `contents` (code access), `issues` (issue management), `pull-requests` (PR management), `discussions`, `actions` (workflow control), `checks`, `deployments`, `packages`, `pages`, and `statuses`. Each has read and write levels. See [GitHub's permissions reference](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) for the complete list.
4734

4835
## Configuration
4936

@@ -54,148 +41,61 @@ Specify individual permission levels:
5441
```yaml wrap
5542
permissions:
5643
contents: read
57-
issues: write
58-
```
59-
60-
### Read-All Permissions
61-
62-
Grant read access to all scopes:
63-
64-
```yaml wrap
65-
permissions: read-all
44+
actions: read
45+
safe-outputs:
46+
create-issue:
6647
```
6748

68-
Equivalent to setting all permissions to `read`. This is useful for workflows that need to inspect various repository data without making changes.
49+
### Shorthand Options
6950

70-
### Write-All Permissions (Not Recommended)
51+
- **`read-all`**: Read access to all scopes (useful for inspection workflows)
52+
- **`{}`**: No permissions (for computation-only workflows)
7153

7254
:::caution
73-
Avoid `write-all` in agentic workflows. Use specific permissions with safe outputs instead.
55+
Avoid using `write-all` or direct write permissions in agentic workflows. Use [safe outputs](/gh-aw/reference/safe-outputs/) instead for secure write operations.
7456
:::
7557

76-
```yaml wrap
77-
permissions: write-all
78-
```
79-
80-
This grants write access to all scopes and should only be used when absolutely necessary, such as for administrative automation tasks with strict access controls.
81-
82-
### No Permissions
83-
84-
Disable all permissions:
85-
86-
```yaml wrap
87-
permissions: {}
88-
```
89-
90-
Useful for workflows that only perform computation without accessing GitHub APIs.
91-
9258
## Common Patterns
9359

94-
### IssueOps Workflow
95-
96-
Read repository content, write to issues:
60+
All workflows should use read-only permissions with safe outputs for write operations:
9761

9862
```yaml wrap
99-
on:
100-
issues:
101-
types: [opened]
63+
# IssueOps: Read code, comment via safe outputs
10264
permissions:
10365
contents: read
104-
issues: write
66+
actions: read
10567
safe-outputs:
10668
add-comment:
10769
max: 5
108-
```
109-
110-
The main AI job runs with `contents: read`. Comment creation happens in a separate safe output job with `issues: write`, ensuring AI-generated content is sanitized before posting.
111-
112-
### PR Review Workflow
11370
114-
Read pull requests, add review comments:
115-
116-
```yaml wrap
117-
on:
118-
pull_request:
119-
types: [opened, synchronize]
71+
# PR Review: Read code, review via safe outputs
12072
permissions:
12173
contents: read
122-
pull-requests: write
74+
actions: read
12375
safe-outputs:
12476
create-pr-review-comment:
12577
max: 10
126-
```
127-
128-
### Scheduled Analysis
12978
130-
Read-only analysis that creates issues:
131-
132-
```yaml wrap
133-
on:
134-
schedule:
135-
- cron: "0 9 * * 1"
79+
# Scheduled: Analysis with issue creation via safe outputs
13680
permissions:
13781
contents: read
138-
issues: write
82+
actions: read
13983
safe-outputs:
14084
create-issue:
14185
max: 3
142-
```
14386
144-
### Manual Workflow
145-
146-
Maximum permissions for administrative tasks:
147-
148-
```yaml wrap
149-
on:
150-
workflow_dispatch:
87+
# Manual: Admin tasks with approval gate
15188
permissions: read-all
15289
manual-approval: production
15390
```
15491

155-
Uses manual approval gate for human oversight before execution.
156-
15792
## Safe Outputs
15893

159-
Write operations should use safe outputs rather than direct API access:
160-
161-
```yaml wrap
162-
permissions:
163-
contents: read # AI job runs read-only
164-
safe-outputs:
165-
add-comment:
166-
max: 5 # Separate job with issues: write
167-
create-issue:
168-
max: 3 # Separate job with issues: write
169-
```
170-
171-
**Benefits:**
172-
- Content sanitization (removes unsafe content, @mentions)
173-
- Rate limiting (max outputs per run)
174-
- Audit trail (outputs shown in step summary)
175-
- Security isolation (write permissions separated from AI execution)
176-
177-
See [Safe Outputs](/gh-aw/reference/safe-outputs/) for complete documentation.
94+
Write operations use safe outputs instead of direct API access. This provides content sanitization, rate limiting, audit trails, and security isolation by separating write permissions from AI execution. See [Safe Outputs](/gh-aw/reference/safe-outputs/) for details.
17895

17996
## Permission Validation
18097

181-
The compiler validates permissions during compilation:
182-
183-
```bash
184-
gh aw compile workflow.md
185-
```
186-
187-
**Common validation errors:**
188-
- Undefined permissions (use explicit permission levels)
189-
- Write permissions without safe outputs (security risk)
190-
- Insufficient permissions for declared tools
191-
192-
Use `--strict` mode for additional permission validation:
193-
194-
```bash
195-
gh aw compile --strict workflow.md
196-
```
197-
198-
Strict mode refuses write permissions and requires explicit network configuration for all operations.
98+
Run `gh aw compile workflow.md` to validate permissions. Common errors include undefined permissions, direct write permissions in the main job (use safe outputs instead), and insufficient permissions for declared tools. Use `--strict` mode to enforce read-only permissions and require explicit network configuration.
19999

200100
## Related Documentation
201101

0 commit comments

Comments
 (0)