Skip to content

Potential fix for code scanning alert no. 3: Workflow does not contain permissions#423

Merged
reMRKableDev merged 1 commit intomainfrom
alert-autofix-3
Mar 13, 2026
Merged

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

Conversation

@reMRKableDev
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/reMRKableDev/react-omdb-api/security/code-scanning/3

In general, the fix is to explicitly declare a permissions block that scopes the GITHUB_TOKEN to the least privileges the workflow needs. For this workflow, it only needs to read repository contents (for actions/checkout) and does not appear to need to write anything back to GitHub, so contents: read at the workflow or job level is sufficient. Other permissions like pull-requests, issues, etc. are not used here, so they should not be granted.

The single best fix with minimal impact is to add a permissions section at the top level of .github/workflows/test-coverage.yml, right after the name: and on: block or before jobs:. This will apply to all jobs that lack their own permissions block (here, the build job). We’ll set:

permissions:
  contents: read

No additional imports or methods are required, since this is purely a configuration change within the workflow YAML.

Concretely:

  • Edit .github/workflows/test-coverage.yml.
  • Insert a permissions: block between the on: section (lines 3–7) and the jobs: section (line 9), or directly above jobs:.
  • Ensure indentation is correct (top-level keys, no extra spaces).

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>
@sonarqubecloud
Copy link
Copy Markdown

@reMRKableDev reMRKableDev marked this pull request as ready for review March 13, 2026 20:43
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.55%. Comparing base (1e1ad7b) to head (ba72ff8).
⚠️ Report is 42 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #423   +/-   ##
=======================================
  Coverage   96.55%   96.55%           
=======================================
  Files           8        8           
  Lines          58       58           
  Branches        9        9           
=======================================
  Hits           56       56           
  Misses          2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@reMRKableDev reMRKableDev merged commit f2210c3 into main Mar 13, 2026
9 of 10 checks passed
@reMRKableDev reMRKableDev deleted the alert-autofix-3 branch March 13, 2026 21:13
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