Skip to content

Security: Add permissions: blocks to all GitHub Actions workflows to restrict GITHUB_TOKEN scope #665

Description

@LucasMaupin

Summary

None of the GitHub Actions workflow files in Eyevinn/intercom-frontend declare an explicit permissions: block at the workflow or job level. Every workflow run therefore receives the GitHub-default GITHUB_TOKEN permissions, which include write access to contents, pull-requests, packages, and more — far broader than most jobs need.

The workflow_dispatch workflow (run-dispatch.yml) is the highest-risk: it only needs to trigger a repository dispatch event but implicitly holds write access to the entire repository.

Affected Files

  • .github/workflows/run-dispatch.yml
  • .github/workflows/run-lint.yml
  • .github/workflows/run-prettier.yml
  • .github/workflows/run-typescript.yml
  • .github/workflows/run-unittests.yml
  • .github/workflows/run-e2e.yml
  • .github/workflows/run-publish.yml
  • .github/workflows/release-notes.yml

Risk

If any workflow step is compromised (e.g., via a malicious action or a script injection attack), the overly-permissive GITHUB_TOKEN can be used to push code, approve pull requests, modify releases, or read/exfiltrate secrets.

Recommended Fix

Add a top-level permissions: read-all default (or contents: read) to every workflow, then grant only the minimum required permissions at the job level.

Minimal read-only baseline (add to all CI workflows — lint, prettier, typescript, unittests, e2e):

permissions:
  contents: read

run-publish.yml (pushes to Docker Hub — GITHUB_TOKEN is not used for writes):

permissions:
  contents: read

release-notes.yml (creates a GitHub release):

permissions:
  contents: write

run-dispatch.yml (repository dispatch only — REPO_DISPATCH_TOKEN is a PAT, GITHUB_TOKEN unused):

permissions:
  contents: read

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MediumPriority: mediumsecuritySecurity vulnerability or hardening

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions