mirror of
http://github.com/valkey-io/valkey
synced 2024-11-21 16:46:15 +00:00
Set permissions for Github Actions in CI (#312)
This sets the default permission for current CI workflows to only be able to read from the repository (scope: "contents"). When a used Github Action require additional permissions (like CodeQL) we grant that permission on job-level instead. This means that a compromised action will not be able to modify the repo or even steal secrets since all other permission-scopes are implicit set to "none", i.e. not permitted. This is recommended by [OpenSSF](https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions). This PR includes a small fix for the possibility of missing server logs artifacts, found while verifying the permission. The `upload-artifact@v3` action will replace artifacts which already exists. Since both CI-jobs `test-external-standalone` and `test-external-nodebug` uses the same artifact name, when both jobs fail, we only get logs from the last finished job. This can be avoided by using unique artifact names. This PR is part of #211 More about permissions and scope can be found here: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions --------- Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
This commit is contained in:
parent
7b58f080a8
commit
1c282a9306
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -2,6 +2,9 @@ name: CI
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
test-ubuntu-latest:
|
test-ubuntu-latest:
|
||||||
|
5
.github/workflows/codeql-analysis.yml
vendored
5
.github/workflows/codeql-analysis.yml
vendored
@ -6,11 +6,16 @@ on:
|
|||||||
# run weekly new vulnerability was added to the database
|
# run weekly new vulnerability was added to the database
|
||||||
- cron: '0 0 * * 0'
|
- cron: '0 0 * * 0'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
name: Analyze
|
name: Analyze
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name != 'schedule' || github.repository == 'valkey-io/valkey'
|
if: github.event_name != 'schedule' || github.repository == 'valkey-io/valkey'
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
2
.github/workflows/coverity.yml
vendored
2
.github/workflows/coverity.yml
vendored
@ -6,6 +6,8 @@ on:
|
|||||||
- cron: '0 0 * * *'
|
- cron: '0 0 * * *'
|
||||||
# Support manual execution
|
# Support manual execution
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
jobs:
|
jobs:
|
||||||
coverity:
|
coverity:
|
||||||
if: github.repository == 'valkey-io/valkey'
|
if: github.repository == 'valkey-io/valkey'
|
||||||
|
2
.github/workflows/daily.yml
vendored
2
.github/workflows/daily.yml
vendored
@ -28,6 +28,8 @@ on:
|
|||||||
description: 'git branch or sha to use'
|
description: 'git branch or sha to use'
|
||||||
default: 'unstable'
|
default: 'unstable'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
|
7
.github/workflows/external.yml
vendored
7
.github/workflows/external.yml
vendored
@ -6,6 +6,9 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * *'
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-external-standalone:
|
test-external-standalone:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -29,7 +32,7 @@ jobs:
|
|||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: test-external-server-log
|
name: test-external-standalone-log
|
||||||
path: external-server.log
|
path: external-server.log
|
||||||
|
|
||||||
test-external-cluster:
|
test-external-cluster:
|
||||||
@ -81,5 +84,5 @@ jobs:
|
|||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: test-external-server-log
|
name: test-external-nodebug-log
|
||||||
path: external-server.log
|
path: external-server.log
|
||||||
|
3
.github/workflows/reply-schemas-linter.yml
vendored
3
.github/workflows/reply-schemas-linter.yml
vendored
@ -8,6 +8,9 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'src/commands/*.json'
|
- 'src/commands/*.json'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
reply-schemas-linter:
|
reply-schemas-linter:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
3
.github/workflows/spell-check.yml
vendored
3
.github/workflows/spell-check.yml
vendored
@ -9,6 +9,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Spellcheck
|
name: Spellcheck
|
||||||
|
Loading…
Reference in New Issue
Block a user