Skip to content

ci: add CodeQL and Trivy container scanning#58

Merged
maff merged 3 commits into
mainfrom
ci/security-scanning
Mar 14, 2026
Merged

ci: add CodeQL and Trivy container scanning#58
maff merged 3 commits into
mainfrom
ci/security-scanning

Conversation

@maff
Copy link
Copy Markdown
Owner

@maff maff commented Mar 14, 2026

Summary

  • Add CodeQL workflow for JavaScript/TypeScript static analysis (runs on push, PR, and weekly schedule)
  • Add Trivy container scan to the docker-build job, scanning the built image for OS and dependency vulnerabilities
  • Both upload SARIF results to the GitHub Security tab

Both are free for public repositories.

Test plan

  • CodeQL workflow runs on this PR
  • Trivy scan step runs after Docker image build
  • Results appear in the Security tab

- Add CodeQL workflow for JavaScript/TypeScript code scanning on push,
  PR, and weekly schedule
- Add Trivy scan step to docker-build job, uploading SARIF results to
  GitHub Security tab
Copilot AI review requested due to automatic review settings March 14, 2026 22:10
@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automated security scanning in CI by introducing a CodeQL workflow for JS/TS analysis and extending the Docker build workflow to run a Trivy container vulnerability scan, with SARIF uploads to GitHub’s Security tab.

Changes:

  • Add a new .github/workflows/codeql.yml workflow for CodeQL JS/TS analysis on push/PR and a weekly schedule.
  • Extend .github/workflows/build.yml docker-build job to run Trivy on a built container image and upload SARIF results.
  • Update workflow permissions to allow SARIF uploads (security-events: write).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/codeql.yml Introduces CodeQL workflow and SARIF upload permissions for JS/TS code scanning.
.github/workflows/build.yml Adds Trivy image scanning + SARIF upload and expands job permissions to support security reporting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/codeql.yml
Comment thread .github/workflows/build.yml Outdated
maff added 2 commits March 14, 2026 23:14
Fixes Node.js 20 deprecation warnings.
- Pin trivy-action to 0.35.0 instead of @master
- Use trivy fs scan instead of rebuilding the Docker image
- Skip CodeQL on fork PRs (no security-events: write token)
- Gate Trivy SARIF upload on non-fork PRs
@maff maff requested a review from Copilot March 14, 2026 22:18
@maff maff merged commit 6c79fa3 into main Mar 14, 2026
9 checks passed
@maff maff deleted the ci/security-scanning branch March 14, 2026 22:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automated security scanning to the repository’s CI so findings show up in GitHub’s Security tab (CodeQL for JS/TS and Trivy SARIF upload).

Changes:

  • Introduces a new CodeQL workflow for JavaScript/TypeScript analysis on push/PR and a weekly schedule.
  • Extends the Docker build workflow with a Trivy scan step and SARIF upload permissions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/codeql.yml New CodeQL workflow to analyze JS/TS and publish results to GitHub Security.
.github/workflows/build.yml Adds security-events: write, runs Trivy, and uploads Trivy SARIF output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +228 to +233
- name: Trivy container scan
uses: aquasecurity/trivy-action@0.35.0
with:
scan-type: fs
scan-ref: .
format: sarif

- name: Upload Trivy results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v4
if: always() && github.event.pull_request.head.repo.full_name == github.repository
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.

3 participants