Skip to content

Conversation

@jonaseberle
Copy link
Member

Potential fix for https://github.com/ddev/github-action-setup-ddev/security/code-scanning/2

To fix the problem, explicitly set the minimal required permissions for the workflow. Since the workflow does not perform any actions that require write permissions (e.g., it does not comment on PRs, update statuses, or push commits), setting permissions: contents: read at the workflow level (the root) is the preferred solution. This restricts the GITHUB_TOKEN to read-only access to repository contents, greatly reducing the attack surface.

Specifically, add the following at the top level of .github/workflows/main.yml, after the name: and before the on: block:

permissions:
  contents: read

No changes are required to the existing jobs or steps, as none are observed to require greater permissions.

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

@jonaseberle jonaseberle marked this pull request as ready for review September 30, 2025 13:53
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@jonaseberle jonaseberle force-pushed the 2025-09-30_permissions_for_tests branch from 2913048 to a20e749 Compare October 1, 2025 14:59
@jonaseberle jonaseberle changed the title Potential fix for code scanning alert no. 2: Workflow does not contain permissions chore(tests): Restrict repository permissions for the test workflow Oct 1, 2025
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.

2 participants