Skip to content

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

Merged
Simek merged 1 commit intomainfrom
alert-autofix-1
Apr 8, 2026
Merged

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

Conversation

@Simek
Copy link
Copy Markdown
Member

@Simek Simek commented Apr 8, 2026

Potential fix for https://github.com/react-native-community/directory/security/code-scanning/1

In general, the fix is to explicitly define a permissions block that grants the minimal required scopes to GITHUB_TOKEN. For this workflow, the job only needs read access to the repository contents for actions/checkout@v6; all deployment credentials come from secrets, so no additional write permissions are required.

The best minimal fix without changing existing functionality is to add a permissions block with contents: read. We can add it either at the root of the workflow (applying to all jobs) or at the build job level. To keep the change tightly scoped to the CodeQL-highlighted job, we’ll add it under jobs.build, aligned with runs-on. Concretely, in .github/workflows/code-deploy-producition-quick.yml, between lines 10 and 11 (between build: and runs-on:), insert:

    permissions:
      contents: read

No imports or additional definitions are needed, since this is a YAML configuration change only.

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

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Simek Simek marked this pull request as ready for review April 8, 2026 10:20
@Simek Simek merged commit a25290d into main Apr 8, 2026
5 checks passed
@Simek Simek deleted the alert-autofix-1 branch April 8, 2026 10:37
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