Skip to content

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#10

Merged
gitricko merged 1 commit intomainfrom
alert-autofix-1
Mar 26, 2026
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#10
gitricko merged 1 commit intomainfrom
alert-autofix-1

Conversation

@gitricko
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/gitricko/openclaw-webtop/security/code-scanning/1

In general, the problem is fixed by explicitly specifying permissions for the GITHUB_TOKEN either at the workflow root (applies to all jobs without their own permissions) or per job. Here, push-to-ghcr already declares permissions, but build-test (and the workflow root) do not. To avoid changing existing behavior while enforcing least privilege, we should add a root-level permissions block with contents: read, which is sufficient for actions/checkout and does not interfere with push-to-ghcr (its own permissions block will override the root).

Concretely:

  • Edit .github/workflows/docker-publish.yml.
  • After the name: line and before on:, add:
    permissions:
      contents: read
  • Leave the existing permissions block in push-to-ghcr unchanged.

No other methods, imports, or definitions are needed; this is a pure YAML configuration change.

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

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@gitricko gitricko marked this pull request as ready for review March 26, 2026 12:16
@gitricko gitricko merged commit d7edee5 into main Mar 26, 2026
4 checks passed
@gitricko gitricko deleted the alert-autofix-1 branch March 26, 2026 12:16
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.

1 participant