Skip to content

Commit d15e279

Browse files
Potential fix for code scanning alert no. 6: Workflow does not contain permissions (#10)
Potential fix for [https://github.com/CodeWithSushil/json-db/security/code-scanning/6](https://github.com/CodeWithSushil/json-db/security/code-scanning/6) To fix this problem, you should add an explicit `permissions` block to the workflow, specifying only the least privilege required. In this case, the job checks out code and runs local tests: it does not need any write access. Thus, the minimal required permissions are `contents: read`. You can add the `permissions` block either to the root of the workflow file (affecting all jobs), or to the specific `phpunit` job. Following GitHub best practices and your provided background, adding it at the root of `.github/workflows/tests.yml` is preferred, just below the `name:` and before the `on:` block. No additional imports or changes are needed—this is a declarative YAML configuration fix. _Suggested fixes powered by Copilot Autofix. Review carefully before merging._
2 parents c6ad19b + 74047f2 commit d15e279

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Tests
2+
permissions:
3+
contents: read
24

35
on: [push, pull_request]
46

0 commit comments

Comments
 (0)