Skip to content

Commit 3310588

Browse files
timdittlerclaude
andauthored
docs: apply deny-by-default permissions to all README examples (#425)
* docs: add top-level permissions: {} to secret-scan example Completes the per-job permissions pattern by denying all permissions at the workflow level by default, then granting only contents: read to the trufflehog job. Prevents consumers of the reusable workflow from inheriting permissive GITHUB_TOKEN defaults. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: add top-level permissions: {} to all README examples Applies deny-by-default permissions at the workflow level across every template example (intro + 17 workflows). Per-job permissions already existed and were left unchanged. GitHub does not auto-zero workflow-level permissions when job-level permissions are set; jobs without their own block still inherit the workflow-level scope (or the repo default, often write-all). The top-level {} ensures that any job without an explicit permissions block gets nothing instead of the repo default, protecting consumers against future job additions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ada67d3 commit 3310588

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ You can find all possible template workflows in the directory `.github/workflows
99
```yml
1010
name: <your name>
1111

12+
permissions: {}
13+
1214
on: ...
1315

1416
jobs:
@@ -38,6 +40,8 @@ At Staffbase, [staffbase-actions](https://github.com/apps/staffbase-actions) is
3840
```yml
3941
name: Enable Dependabot Auto-Merge
4042
43+
permissions: {}
44+
4145
on:
4246
pull_request:
4347
@@ -68,6 +72,9 @@ jobs:
6872

6973
```yml
7074
name: Autodev
75+
76+
permissions: {}
77+
7178
on:
7279
push:
7380
branches-ignore:
@@ -117,6 +124,9 @@ jobs:
117124

118125
```yml
119126
name: Changeset Check
127+
128+
permissions: {}
129+
120130
on:
121131
pull_request:
122132
types: [opened, reopened, synchronize]
@@ -141,6 +151,8 @@ jobs:
141151
```yml
142152
name: Release Changesets
143153
154+
permissions: {}
155+
144156
on:
145157
push:
146158
branches:
@@ -181,6 +193,8 @@ jobs:
181193
```yml
182194
name: Find flaky tests
183195

196+
permissions: {}
197+
184198
on:
185199
# At 05:00 on Monday.
186200
schedule:
@@ -221,6 +235,9 @@ jobs:
221235
222236
```yml
223237
name: GitOps
238+
239+
permissions: {}
240+
224241
on: [push]
225242

226243
jobs:
@@ -308,6 +325,9 @@ Then the jira issues will be updated with a release date and the labels will be
308325
309326
```yml
310327
name: Annotate Jira Issues
328+
329+
permissions: {}
330+
311331
on:
312332
push:
313333
tags: ['**']
@@ -342,6 +362,9 @@ The action can be used to collect and push code references for LaunchDarkly feat
342362
343363
```yml
344364
name: Find LaunchDarkly flag code references
365+
366+
permissions: {}
367+
345368
on:
346369
push:
347370
branches:
@@ -370,6 +393,8 @@ jobs:
370393
```yml
371394
name: Merge Block
372395

396+
permissions: {}
397+
373398
on:
374399
pull_request:
375400
types: [opened, labeled, unlabeled]
@@ -399,6 +424,8 @@ More information on how to configure this file can be found [here](https://githu
399424
```yml
400425
name: Release Drafter
401426
427+
permissions: {}
428+
402429
on:
403430
push:
404431
branches:
@@ -447,6 +474,8 @@ You can remove all other version resolver from your configuration.
447474
```yml
448475
name: Release Version Detector
449476
477+
permissions: {}
478+
450479
on:
451480
push:
452481
branches:
@@ -487,13 +516,15 @@ on:
487516
```yml
488517
name: Secret Scan
489518
519+
permissions: {}
520+
490521
on: [pull_request]
491522
492523
jobs:
493524
trufflehog:
494-
uses: Staffbase/gha-workflows/.github/workflows/template_secret_scan.yml@963c984dde02b0a8711f0d098aa9f8a7f2e50bca # v12.0.1
495525
permissions:
496526
contents: read
527+
uses: Staffbase/gha-workflows/.github/workflows/template_secret_scan.yml@963c984dde02b0a8711f0d098aa9f8a7f2e50bca # v12.0.1
497528
```
498529

499530
</details>
@@ -506,6 +537,8 @@ jobs:
506537
```yml
507538
name: Stale PRs
508539
540+
permissions: {}
541+
509542
on:
510543
schedule:
511544
- cron: '0 0 * * 1-5'
@@ -542,6 +575,8 @@ jobs:
542575
```yml
543576
name: TechDocs
544577
578+
permissions: {}
579+
545580
on:
546581
push:
547582
branches:
@@ -573,6 +608,8 @@ jobs:
573608
```yml
574609
name: TechDocs
575610
611+
permissions: {}
612+
576613
on:
577614
push:
578615
branches:
@@ -612,6 +649,8 @@ jobs:
612649
```yml
613650
name: Terraform
614651
652+
permissions: {}
653+
615654
on: [pull_request]
616655
617656
jobs:
@@ -643,6 +682,8 @@ jobs:
643682
```yml
644683
name: YAMLlint
645684
685+
permissions: {}
686+
646687
on:
647688
push:
648689
branches:

0 commit comments

Comments
 (0)