-
Notifications
You must be signed in to change notification settings - Fork 16
chore: add security scans #652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
.github/workflows/ci.yml
Outdated
| if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.run_security_scans =='true') | ||
| uses: ./.github/workflows/security-scans.yml |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 19 days ago
To fix this problem, add a permissions: block at the root level of the workflow (directly under the name line and before the on block). This will ensure all jobs use the minimal GitHub GITHUB_TOKEN permissions unless they (or a called workflow) further restrict or elevate permissions as needed. As a starting point, set contents: read, which is usually sufficient for most workflows unless they need to create issues, manage deployments, etc. Jobs or called workflows that need more permissions can override this with their own permissions block. Edit .github/workflows/ci.yml, inserting
permissions:
contents: readafter the name: CI line (as line 2), shifting all other lines down by one.
No new methods, imports, or definitions are required for this change.
-
Copy modified lines R2-R3
| @@ -1,4 +1,6 @@ | ||
| name: CI | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: |
.github/workflows/security-scans.yml
Outdated
| languages: python | ||
|
|
||
| - name: Setup uv | ||
| uses: astral-sh/setup-uv@v5 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow
.github/workflows/security-scans.yml
Outdated
| name: FOSSA Scan | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run FOSSA scan | ||
| uses: fossas/fossa-action@main | ||
| with: | ||
| api-key: ${{ secrets.FOSSA_API_KEY }} | ||
| debug: true | ||
|
|
||
| - name: Upload FOSSA artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: fossa.debug.json.gz | ||
| path: ./fossa.debug.json.gz | ||
|
No newline at end of file |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 19 days ago
To resolve this issue, set an explicit permissions block for the "fossa" job in .github/workflows/security-scans.yml. This restricts the GITHUB_TOKEN to only the minimal privileges needed for this job. The FOSSA scan job generally only requires reading the repository contents for scanning, so setting contents: read is appropriate. Insert the following block just after runs-on: ubuntu-latest and before steps: for the "fossa" job:
permissions:
contents: readNo imports, methods, or additional variable definitions are necessary. Only a one-block addition to the job definition inside the workflow YAML file is required.
-
Copy modified lines R41-R42
| @@ -38,6 +38,8 @@ | ||
| fossa: | ||
| name: FOSSA Scan | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 |
.github/workflows/security-scans.yml
Outdated
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run FOSSA scan | ||
| uses: fossas/fossa-action@main |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow
8f57495 to
accb0a7
Compare
e02976e to
85a1985
Compare
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
e1e3b40 to
82f9cf9
Compare
82f9cf9 to
ab9ed6b
Compare
Description
Add FOSSA and CODEQL scans to the CI pipeline. Scans should only run on merges to
mainand if the CI is manually run