Skip to content

Potential fix for code scanning alert no. 6: Workflow does not contain permissions#26

Merged
achamayou merged 2 commits intomainfrom
alert-autofix-6
Feb 12, 2026
Merged

Potential fix for code scanning alert no. 6: Workflow does not contain permissions#26
achamayou merged 2 commits intomainfrom
alert-autofix-6

Conversation

@achamayou
Copy link
Member

Potential fix for https://github.com/microsoft/merklecpp/security/code-scanning/6

To fix the problem, the workflow should explicitly declare the least-privilege permissions required for the job, rather than relying on repository or organization defaults. In this case, the job needs to be able to push commits to the gh-pages branch, which requires contents: write. There is no evidence that it needs any other scopes (issues, pull-requests, etc.), so we should keep those omitted (defaulting to none).

The single best fix without changing functionality is to add a permissions block to the build job in .github/workflows/build-docs.yml, directly under the job’s name or runs-on. For example:

jobs:
  build:
    name: Sphinx Build
    runs-on: ubuntu-latest
    permissions:
      contents: write

This constrains the GITHUB_TOKEN used by the job (including in actions/checkout and ad-m/github-push-action) to repository contents write access only, matching the workflow’s needs. No additional imports or external methods are required, as this is purely a YAML configuration change within the existing workflow file.

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

achamayou and others added 2 commits February 5, 2026 11:40
…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@achamayou achamayou marked this pull request as ready for review February 12, 2026 11:25
@achamayou achamayou merged commit c148d5a into main Feb 12, 2026
10 checks passed
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