Skip to content

Potential fix for code scanning alert no. 35: Workflow does not contain permissions#4311

Merged
biglittlebigben merged 1 commit intomasterfrom
benjamin/docker_permissions
Feb 10, 2026
Merged

Potential fix for code scanning alert no. 35: Workflow does not contain permissions#4311
biglittlebigben merged 1 commit intomasterfrom
benjamin/docker_permissions

Conversation

@biglittlebigben
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/livekit/livekit/security/code-scanning/35

In general, the fix is to declare an explicit permissions: block either at the workflow root or for the specific job, limiting GITHUB_TOKEN to the minimal scopes needed. For a build-and-push-to-Docker workflow like this, the only GitHub interaction is checking out the code, which needs contents: read. All DockerHub interactions use secrets.DOCKERHUB_* and do not require GITHUB_TOKEN write access.

The best minimal fix without changing functionality is to add a root-level permissions: block after the name: (or under on:) that sets contents: read. This will apply to all jobs (currently only docker) unless overridden. No steps need write access to repository contents, issues, or pull requests, and no extra scopes are required, so contents: read is sufficient. Concretely, in .github/workflows/docker.yaml, add:

permissions:
  contents: read

at the top workflow level (e.g., between name: Release to Docker and on:). No imports or further definitions are needed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@biglittlebigben biglittlebigben marked this pull request as ready for review February 10, 2026 22:56
@biglittlebigben biglittlebigben merged commit cbd2f82 into master Feb 10, 2026
7 checks passed
@biglittlebigben biglittlebigben deleted the benjamin/docker_permissions branch February 10, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants