Skip to content

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

Merged
JoernBerkefeld merged 1 commit intomainfrom
alert-autofix-37
Feb 11, 2026
Merged

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

Conversation

@JoernBerkefeld
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/Accenture/sfmc-devtools/security/code-scanning/37

In general, the fix is to define explicit permissions for the GITHUB_TOKEN so that the workflow does not rely on repository or organization defaults. This is done by adding a permissions: block either at the root of the workflow (applying to all jobs) or under the specific job that uses the token. We should grant only the scopes required by the action that closes issues related to merged pull requests.

Specifically for this workflow, ldez/gha-mjolnir closes issues that are referenced from merged pull requests. That requires write access to issues and at most read access to pull requests and repository contents. We can therefore add a job-level permissions block under closeIssueOnPrMergeTrigger that sets:

  • contents: read (to mirror minimum recommended access),
  • pull-requests: read (to inspect the merged PR), and
  • issues: write (to close/update related issues).

No changes to existing steps or environment variables are needed. The only change is to insert the permissions mapping just under closeIssueOnPrMergeTrigger: and aligned with runs-on:.

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>
@JoernBerkefeld JoernBerkefeld added this to the 8.4.0 milestone Feb 11, 2026
@JoernBerkefeld JoernBerkefeld self-assigned this Feb 11, 2026
@github-actions
Copy link
Copy Markdown

Coverage Report

Commit:e34e019
Base: main@0f40991

Type Base This PR
Total Statements Coverage  70.96%  70.96%  (+0%)
Total Branches Coverage  70.71%  70.71%  (+0%)
Total Functions Coverage  83.75%  83.75%  (+0%)
Total Lines Coverage  70.96%  70.96%  (+0%)
Details (changed files):
File Statements Branches Functions Lines

@JoernBerkefeld JoernBerkefeld marked this pull request as ready for review February 11, 2026 22:14
@JoernBerkefeld JoernBerkefeld merged commit 332233d into main Feb 11, 2026
10 checks passed
@JoernBerkefeld JoernBerkefeld deleted the alert-autofix-37 branch February 11, 2026 22:14
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