Skip to content

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

Merged
ismailtsdln merged 1 commit intomainfrom
alert-autofix-1
Jan 25, 2026
Merged

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

Conversation

@ismailtsdln
Copy link
Member

Potential fix for https://github.com/offsec-toolkit/domainguardian/security/code-scanning/1

In general, the fix is to explicitly declare a permissions block that scopes down the default GITHUB_TOKEN permissions to only what this workflow needs. Because this workflow is a standard Go CI pipeline (checkout, cache, lint, build, test, upload coverage) and does not appear to modify repository contents, open issues, or PRs, the safest least-privilege setting is contents: read. If later steps need more (e.g., PR comments), additional specific permissions can be added.

The single best way to fix this without changing functionality is to add a top-level permissions section just under the name: line (before on:). This will apply to all jobs in the workflow (currently just ci) that do not override permissions, and it constrains GITHUB_TOKEN to read-only access to repository contents. No imports or other definitions are necessary because this is a YAML configuration change only. Specifically, in .github/workflows/go.yml, insert:

permissions:
  contents: read

immediately after line 1 (name: Go CI / Test / Lint).

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>
@ismailtsdln ismailtsdln marked this pull request as ready for review January 25, 2026 20:09
@ismailtsdln ismailtsdln merged commit 4555702 into main Jan 25, 2026
2 of 4 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