Skip to content

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

Merged
qdequippe merged 1 commit intomainfrom
alert-autofix-4
Jan 2, 2026
Merged

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

Conversation

@qdequippe
Copy link
Member

Potential fix for https://github.com/qdequippe-tech/yousign-php-api/security/code-scanning/4

In general, to fix this issue you explicitly declare a permissions block either at the workflow root (applies to all jobs) or at the job level, and grant only the minimum scopes required. For this workflow, the main sensitive operation is the Create Pull Request step using peter-evans/create-pull-request@v8. According to the action’s documentation and GitHub’s permission model, it needs contents: write to push branches/commits and pull-requests: write to open/update PRs. The earlier steps (checkout, dependency install, code generation, formatting) only need read access to repository contents.

The minimal, non-breaking change is to add a permissions block under the check-spec job, at the same indentation level as name and runs-on. That way, we don’t affect any other workflows and we ensure this job has exactly the needed permissions. Concretely, in .github/workflows/diff-spec.yml, after line 11 (runs-on: ubuntu-latest), insert:

        permissions:
            contents: write
            pull-requests: write

No imports or additional methods are needed because this is pure YAML configuration. Existing functionality is preserved: the job can still push generated changes and create/update pull requests, while no broader permissions are implicitly granted.

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>
@qdequippe qdequippe marked this pull request as ready for review January 2, 2026 12:23
@qdequippe qdequippe merged commit 1042abe into main Jan 2, 2026
3 checks passed
@qdequippe qdequippe deleted the alert-autofix-4 branch January 2, 2026 12:24
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