Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the permissions of GitHub actions #2681

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
name: recurrent-audit

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch: # Allow triggering through the UI

permissions:
contents: read
issues: write

jobs:
audit:
runs-on: ubuntu-latest
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci-post-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
types:
- completed

permissions: read-all

jobs:
# This job is run after a pull request workflow has completed, potentially from a fork
# repository. It downloads the artifact output of the workflow, then comments in the pull
Expand All @@ -18,6 +20,12 @@ jobs:
wasm-node-size-diff:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' }}
permissions:
- actions: read
# Giving write access to PRs means that a malicious action could be a nuisance, but in
# practice this is unlikely to happen, would have no major consequences, and would likely
# be quickly detected.
- pull-requests: write
steps:
# TODO: use download-artifact action
- uses: actions/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ on:
branches:
- main # Running the CI on the main branch is important in order to fill the caches that pull requests will pick up.

# Disables all permissions apart from reading. While no secret is used anywhere, disabling just in case doesn't hurt.
permissions: read-all

jobs:
test-64bits:
runs-on: ubuntu-latest
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ on:
branches:
- main

permissions: read-all

jobs:
build-push-docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # TODO: problematic, as a malicious action could hijack the packages
steps:
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
Expand Down Expand Up @@ -71,12 +76,14 @@ jobs:
# Warning: this GitHub action doesn't seem to run prepublish scripts, hence
# the `npm publish --dry-run` done right above is important to ensure this.
with:
token: ${{ secrets.NPM_TOKEN }}
token: ${{ secrets.NPM_TOKEN }} # TODO: problematic to pass this, in case the npm-publish action gets hijacked
package: ./bin/wasm-node/javascript/package.json
access: public

deno-publish:
runs-on: ubuntu-latest
permissions:
contents: write # Necessary because Deno publication works by pushing tags. # TODO: improve security here by doing everything manually
# This action checks if a certain git tag exists. If not, it compiles the JavaScript package,
# then commits the compilation artifacts, tags the commit, and pushes the tag.
steps:
Expand Down