-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: separate documents about policies (#216)
- Loading branch information
1 parent
04b99d4
commit a2bfca1
Showing
7 changed files
with
275 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# job_permissions | ||
|
||
All jobs should have `permissions` | ||
|
||
## Why? | ||
|
||
For least privilege. | ||
|
||
## Exceptions | ||
|
||
- workflow's `permissions` is empty `{}` | ||
- workflow has only one job and the workflow has `permissions` | ||
|
||
## Examples | ||
|
||
:x: | ||
|
||
```yaml | ||
permissions: | ||
contents: read | ||
jobs: | ||
foo: | ||
runs-on: ubuntu-latest | ||
# Without permissions | ||
steps: | ||
- run: echo hello | ||
bar: | ||
runs-on: ubuntu-latest | ||
# Without permissions | ||
steps: | ||
- uses: actions/checkout@v3 | ||
``` | ||
:o: | ||
```yaml | ||
jobs: | ||
foo: | ||
runs-on: ubuntu-latest | ||
permissions: {} # Set permissions | ||
steps: | ||
- run: echo hello | ||
bar: | ||
runs-on: ubuntu-latest | ||
permissions: # Set permissions | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
``` | ||
Or | ||
```yaml | ||
permissions: {} # empty permissions | ||
jobs: | ||
foo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo hello | ||
bar: | ||
runs-on: ubuntu-latest | ||
permissions: # Set permissions | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# deny_read_all_permission | ||
|
||
`read-all` permission should not be used | ||
|
||
## Why? | ||
|
||
For least privilege. | ||
|
||
## Examples | ||
|
||
:x: | ||
|
||
```yaml | ||
name: test | ||
jobs: | ||
foo: | ||
runs-on: ubuntu-latest | ||
permissions: read-all # Don't use read-all | ||
steps: | ||
- run: echo foo | ||
``` | ||
:o: | ||
```yaml | ||
name: test | ||
jobs: | ||
foo: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- run: echo foo | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# deny_write_all_permission | ||
|
||
`write-all` permission should not be used. | ||
|
||
## Why? | ||
|
||
For least privilege. | ||
|
||
## Examples | ||
|
||
:x: | ||
|
||
```yaml | ||
name: test | ||
jobs: | ||
foo: | ||
runs-on: ubuntu-latest | ||
permissions: write-all # Don't use write-all | ||
steps: | ||
- run: echo foo | ||
``` | ||
:o: | ||
```yaml | ||
name: test | ||
jobs: | ||
foo: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- run: echo foo | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# deny_inherit_secrets | ||
|
||
`secrets: inherit` should not be used | ||
|
||
## Why? | ||
|
||
Secrets should be exposed to only required jobs. | ||
|
||
## Examples | ||
|
||
:x: | ||
|
||
```yaml | ||
jobs: | ||
release: | ||
uses: suzuki-shunsuke/go-release-workflow/.github/workflows/release.yaml@v0.4.4 | ||
secrets: inherit # `inherit` should not be used | ||
``` | ||
:o: | ||
```yaml | ||
jobs: | ||
release: | ||
uses: suzuki-shunsuke/go-release-workflow/.github/workflows/release.yaml@v0.4.4 | ||
secrets: # Only required secrets should be passed | ||
gh_app_id: ${{ secrets.APP_ID }} | ||
gh_app_private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
``` |
Oops, something went wrong.