Skip to content

Potential fix for code scanning alert no. 9: Workflow does not contain permissions#2960

Closed
kaitlynnefuery wants to merge 1 commit intomainfrom
copilot-generated-alert-autofix-9
Closed

Potential fix for code scanning alert no. 9: Workflow does not contain permissions#2960
kaitlynnefuery wants to merge 1 commit intomainfrom
copilot-generated-alert-autofix-9

Conversation

@kaitlynnefuery
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/hashicorp/dev-portal/security/code-scanning/9

In general, to fix this category of issue you add a permissions block either at the workflow root or within each job to explicitly scope what the automatically provided GITHUB_TOKEN can do. For a workflow that only checks out code and runs local tooling without calling GitHub APIs to modify resources, contents: read is typically sufficient and aligns with GitHub’s recommended minimal baseline.

For this specific workflow (.github/workflows/register-preview-url.yml), the on-deploy job checks out the repository and runs Node-based tooling. None of the shown steps require write access to repository contents, issues, PRs, or other GitHub resources via GITHUB_TOKEN. The least-privilege fix is therefore to add a permissions block under jobs.on-deploy specifying contents: read. This directly addresses CodeQL’s warning and keeps existing behavior unchanged, since read access is already required to perform actions/checkout. Concretely, insert:

    permissions:
      contents: read

between runs-on: ubuntu-latest and if: ... in the on-deploy job. No imports or additional definitions are needed, as this is purely a 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>
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dev-portal Error Error Feb 10, 2026 1:03am

Request Review

@github-actions
Copy link
Copy Markdown

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

This PR introduced no changes to the javascript bundle 🙌

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