Commit 615e35b
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
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
0 commit comments