Skip to content

CICD: Restrict permissions in .github/workflows/pr_integration_tests.yml#4123

Merged
tlimoncelli merged 1 commit intomainfrom
alert-autofix-38
Mar 2, 2026
Merged

CICD: Restrict permissions in .github/workflows/pr_integration_tests.yml#4123
tlimoncelli merged 1 commit intomainfrom
alert-autofix-38

Conversation

@tlimoncelli
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/StackExchange/dnscontrol/security/code-scanning/38

In general, this issue is fixed by adding an explicit permissions block for the GITHUB_TOKEN at the workflow root or at each job, restricting it to the minimum scopes needed. For a typical test workflow that only checks out code, uses cache, and uploads artifacts, contents: read is sufficient.

For this specific workflow in .github/workflows/pr_integration_tests.yml, the simplest non-invasive fix is to add a top-level permissions block right after the name: (or before jobs:). The jobs use actions/checkout, actions/cache, and actions/upload-artifact, none of which require write access to repository contents. Therefore, we can safely set:

permissions:
  contents: read

This will apply to all jobs (integration-test-providers and integration-tests) since they do not define their own permissions. No other changes, imports, or definitions are needed.

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

…in permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@tlimoncelli tlimoncelli marked this pull request as ready for review March 2, 2026 17:46
@tlimoncelli tlimoncelli changed the title Potential fix for code scanning alert no. 38: Workflow does not contain permissions CICD: Restrict permissions in .github/workflows/pr_integration_tests.yml Mar 2, 2026
@tlimoncelli tlimoncelli merged commit a6c82d7 into main Mar 2, 2026
24 of 30 checks passed
@tlimoncelli tlimoncelli deleted the alert-autofix-38 branch March 2, 2026 17:54
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