Skip to content

Conversation

@KenLSM
Copy link
Contributor

@KenLSM KenLSM commented Nov 3, 2025

Potential fix for https://github.com/opengovsg/formsg-javascript-sdk/security/code-scanning/6

To fix the problem, we should explicitly set a restrictive permissions block in the workflow configuration. The best approach is to add a permissions: block at the top-level of the workflow configuration (after name: and before on: or after on: and before jobs:). This will apply to all jobs unless a job-specific block is set. For typical CI workflows like this, contents: read is sufficient, as the jobs only check out code and interact with packages, not with repository contents in a write capacity. If future jobs require more, they can override at the job level.

The only change required is adding the following at the root of .github/workflows/ci.yml:

permissions:
  contents: read

No additional methods, imports, or definitions are necessary.


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>
@KenLSM KenLSM marked this pull request as ready for review November 3, 2025 07:25
@KenLSM KenLSM changed the title Potential fix for code scanning alert no. 6: Workflow does not contain permissions chore(workflow): explicitly set permissions on workflow Nov 3, 2025
@KenLSM KenLSM merged commit e317d8e into develop Nov 3, 2025
10 checks passed
@KenLSM KenLSM deleted the alert-autofix-6 branch November 3, 2025 08:00
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