Skip to content

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

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

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

Conversation

@tlimoncelli
Copy link
Collaborator

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

In general, the fix is to add an explicit permissions block that grants only the minimal scopes required for the workflow. For this workflow, the jobs need to (a) check out code, which requires contents: read, and (b) interact with the actions runtime (artifacts, cache) which uses the internal actions permission that is enabled by default and does not need to be specified. They do not appear to modify repository contents, issues, or pull requests. The best non-breaking change is to add a workflow-level permissions block after the on: section, setting contents: read. This will apply to both jobs since neither currently defines its own permissions block. No other functionality needs to change.

Concretely, in .github/workflows/pr_integration_tests.yml, insert:

permissions:
  contents: read

between the on: block (ending at line 15) and the env: block (starting at line 18). This explicitly restricts the GITHUB_TOKEN permissions for all jobs in this workflow while keeping all current behavior intact. No imports or additional methods are needed because this is a pure YAML configuration change within the workflow file.

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. 35: Workflow does not contain permissions CICD: Restrict permissions in .github/workflows/pr_integration_tests.yml Mar 2, 2026
@tlimoncelli tlimoncelli merged commit 781e3e0 into main Mar 2, 2026
23 of 30 checks passed
@tlimoncelli tlimoncelli deleted the alert-autofix-35 branch March 2, 2026 17:53
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