Skip to content

Commit 615e35b

Browse files
henriettelienrebnorgithub-advanced-security[bot]daghovland
authored
Potential fix for code scanning alert no. 2: Workflow does not contain permissions (#169)
This PR fixes [AB#379924](https://dev.azure.com/EquinorASA/bb9bd8cb-74f7-4ffa-b0cb-60eff0a0be58/_workitems/edit/379924) Potential fix for [https://github.com/equinor/Dexpi2Imf/security/code-scanning/2](https://github.com/equinor/Dexpi2Imf/security/code-scanning/2) To fix this issue, we should explicitly add a `permissions` block to the workflow. This block can be added either at the workflow root or specifically within the relevant job (in this case, `dotnet-tests`). The permissions should be as restrictive as possible while still allowing the workflow to function. For this workflow, the only actions observed are checking out code, downloading a secret, setting up .NET, restoring dependencies, building, testing, and deleting a file. None of these require write access to repository contents or pull requests. The minimal required permissions should be `contents: read` (to checkout code) and allowing secrets (which do not require an entry here). Thus, we should add: ```yaml permissions: contents: read ``` at the workflow root, immediately after the `name:` and before the `on:` block. --- _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> Co-authored-by: Dag Hovland <dhovl@equinor.com>
1 parent e7abcd4 commit 615e35b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

.github/workflows/pull_request_tester.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: "Run tests (required)"
2+
permissions:
3+
contents: read
24
on:
35
workflow_dispatch:
46
pull_request:

0 commit comments

Comments
 (0)