Skip to content

ci(security): add CodeQL and OSV-Scanner workflows#302

Merged
tobyhede merged 3 commits intomainfrom
automations
Feb 25, 2026
Merged

ci(security): add CodeQL and OSV-Scanner workflows#302
tobyhede merged 3 commits intomainfrom
automations

Conversation

@tobyhede
Copy link
Contributor

@tobyhede tobyhede commented Feb 25, 2026

Add static analysis (CodeQL) and dependency vulnerability scanning (OSV-Scanner) to CI. Both run on push/PR to main and weekly on Monday 08:00 UTC. Results upload to GitHub Security tab via SARIF.

Summary by CodeRabbit

  • Chores
    • Added automated CodeQL security analysis to run on pushes, pull requests, and a weekly schedule to help detect code-level vulnerabilities.
    • Added automated OSV vulnerability scanning to run on pushes, pull requests, and a weekly schedule to help identify known dependency vulnerabilities.

@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

⚠️ No Changeset found

Latest commit: 7c9bd48

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

Adds two GitHub Actions workflows: CodeQL analysis configured for javascript-typescript and an OSV-Scanner reusable workflow. Both trigger on pushes to main, pull requests to main, and weekly schedules, and set permissions security-events: write, contents: read, and actions: read.

Changes

Cohort / File(s) Summary
Security workflows
​.github/workflows/codeql.yml, ​.github/workflows/osv-scanner.yml
Adds a CodeQL analysis workflow (checkout, initialize CodeQL for javascript-typescript, autobuild/analyze) and an OSV-Scanner reusable-workflow call (google/osv-scanner-action@v2.3.3 with fail-on-vuln=false and --recursive). Both trigger on push/PR to main and weekly cron; set security-events: write, contents: read, actions: read permissions.

Sequence Diagram(s)

sequenceDiagram
    participant Event as GitHub Event
    participant Runner as Actions Runner
    participant Repo as Repository
    participant CodeQL as CodeQL Action
    participant OSV as OSV Scanner

    Event->>Runner: push/PR to main or weekly cron
    Runner->>Repo: actions/checkout
    Runner->>CodeQL: initialize (languages=javascript-typescript)
    CodeQL->>Runner: autobuild/analyze
    Runner->>OSV: call reusable google/osv-scanner-action (--recursive)
    OSV->>Runner: run scan and report results
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hoppity-hop, workflows take flight,
CodeQL peers in, shining its light,
OSV scans each hidden lane,
Together they watch the rabbit's domain,
🥕 Safe commits make me delight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding two security-related CI workflows (CodeQL and OSV-Scanner) to the repository.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch automations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-advanced-security
Copy link

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
.github/workflows/codeql.yml (1)

21-21: Same Blacksmith runner label — suppressing the actionlint false positive in actionlint.yaml (see comment in osv-scanner.yml) will fix both workflows.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/codeql.yml at line 21, The workflow uses the same
Blacksmith runner label ("runs-on: blacksmith-4vcpu-ubuntu-2404") and is
triggering a duplicate actionlint false positive; add a suppression for this
workflow in the actionlint configuration (the same style used for
osv-scanner.yml) so actionlint ignores the duplicate-runner warning for the
.github/workflows/codeql.yml workflow. Update actionlint.yaml to include an
entry that targets the codeql.yml workflow path and the duplicate-runner rule
(matching the suppression format used for osv-scanner.yml) so the false positive
is suppressed without changing the runs-on value.
🧹 Nitpick comments (1)
.github/workflows/codeql.yml (1)

23-27: fail-fast: false is a no-op with a single-language matrix.

With only javascript-typescript in the matrix, fail-fast has no effect. It's harmless to keep for future-proofing if more languages are planned, but can be removed to keep the config tidy.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/codeql.yml around lines 23 - 27, The workflow contains a
no-op "fail-fast: false" under the strategy block because the matrix only
defines a single language ("javascript-typescript"); remove the "fail-fast:
false" line from the strategy section in the codeql.yml to tidy the config (or
alternatively keep it commented with a note if you intend to expand the matrix
later), ensuring you edit the "strategy" / "matrix" -> "language" area where
"javascript-typescript" is defined.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/osv-scanner.yml:
- Around line 27-31: Replace the direct action usage with the reusable workflow
so SARIF is uploaded: swap the job step that currently uses
"google/osv-scanner-action/osv-action@v2" (the "Run OSV-Scanner" step) to call
the reusable workflow
"google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml" and
ensure the input "scan-args" includes the target directory (e.g., "--recursive
./") so scanning behaves as documented; keep the step name "Run OSV-Scanner" and
the "scan-args" input key so the change is localized and clear.

---

Duplicate comments:
In @.github/workflows/codeql.yml:
- Line 21: The workflow uses the same Blacksmith runner label ("runs-on:
blacksmith-4vcpu-ubuntu-2404") and is triggering a duplicate actionlint false
positive; add a suppression for this workflow in the actionlint configuration
(the same style used for osv-scanner.yml) so actionlint ignores the
duplicate-runner warning for the .github/workflows/codeql.yml workflow. Update
actionlint.yaml to include an entry that targets the codeql.yml workflow path
and the duplicate-runner rule (matching the suppression format used for
osv-scanner.yml) so the false positive is suppressed without changing the
runs-on value.

---

Nitpick comments:
In @.github/workflows/codeql.yml:
- Around line 23-27: The workflow contains a no-op "fail-fast: false" under the
strategy block because the matrix only defines a single language
("javascript-typescript"); remove the "fail-fast: false" line from the strategy
section in the codeql.yml to tidy the config (or alternatively keep it commented
with a note if you intend to expand the matrix later), ensuring you edit the
"strategy" / "matrix" -> "language" area where "javascript-typescript" is
defined.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa2b85d and 6080cce.

📒 Files selected for processing (2)
  • .github/workflows/codeql.yml
  • .github/workflows/osv-scanner.yml

Add static analysis (CodeQL) and dependency vulnerability scanning
(OSV-Scanner) to CI. Both run on push/PR to main and weekly on Monday
08:00 UTC. Results upload to GitHub Security tab via SARIF.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
.github/workflows/osv-scanner.yml (2)

21-21: ⚠️ Potential issue | 🟠 Major

Same unknown runner label as codeql.yml — verify blacksmith-4vcpu-ubuntu-2404.

Same concern as flagged in codeql.yml Line 21.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/osv-scanner.yml at line 21, The workflow uses a
nonstandard runner label "blacksmith-4vcpu-ubuntu-2404" in the runs-on key which
matches the same unknown label flagged in codeql.yml; verify that this custom
runner name is intentional and available in your GitHub Actions self-hosted
fleet or replace it with a supported runner (e.g., "ubuntu-24.04" or another
approved label) so the workflow can run; update the runs-on value in
.github/workflows/osv-scanner.yml (and ensure consistency with the runs-on used
in codeql.yml) to the correct, existing runner label.

27-31: ⚠️ Potential issue | 🟠 Major

SARIF is still not uploaded; missing target directory in scan-args.

google/osv-scanner-action/osv-scanner-action@v2.3.3 is the low-level composite action — it is invoked internally by the reusable workflow osv-scanner-reusable.yml, which handles SARIF generation and upload. Using the composite action directly skips the upload step, so the PR description's claim of "Scan results are uploaded to the GitHub Security tab using SARIF" remains incorrect.

Additionally, scan-args should include the target directory (./) alongside --recursive; without it the scan may not behave as expected.

Replace the job with the reusable workflow:

🔧 Proposed fix: switch to reusable workflow for SARIF upload
 jobs:
-  osv-scan:
-    name: OSV Vulnerability Scan
-    runs-on: blacksmith-4vcpu-ubuntu-2404
-
-    steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
-
-      - name: Run OSV-Scanner
-        uses: google/osv-scanner-action/osv-scanner-action@v2.3.3
-        with:
-          scan-args: |-
-            --recursive
+  osv-scan:
+    uses: google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@v2.3.3
+    with:
+      scan-args: |-
+        --recursive
+        ./
+    permissions:
+      security-events: write
+      contents: read
+      actions: read
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/osv-scanner.yml around lines 27 - 31, The job currently
calls the low-level composite action
google/osv-scanner-action/osv-scanner-action@v2.3.3 which skips SARIF upload;
replace that job with the reusable workflow `osv-scanner-reusable.yml` (the
reusable workflow that handles SARIF generation and upload) and when supplying
scan-args ensure you include the target directory (add "./" alongside
`--recursive`) so the scanner runs the intended tree; update the job invocation
to call the reusable workflow and pass `scan-args: --recursive ./` (or the
equivalent multiline form) so SARIF is produced and uploaded to the Security
tab.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/osv-scanner.yml:
- Line 21: The workflow uses a nonstandard runner label
"blacksmith-4vcpu-ubuntu-2404" in the runs-on key which matches the same unknown
label flagged in codeql.yml; verify that this custom runner name is intentional
and available in your GitHub Actions self-hosted fleet or replace it with a
supported runner (e.g., "ubuntu-24.04" or another approved label) so the
workflow can run; update the runs-on value in .github/workflows/osv-scanner.yml
(and ensure consistency with the runs-on used in codeql.yml) to the correct,
existing runner label.
- Around line 27-31: The job currently calls the low-level composite action
google/osv-scanner-action/osv-scanner-action@v2.3.3 which skips SARIF upload;
replace that job with the reusable workflow `osv-scanner-reusable.yml` (the
reusable workflow that handles SARIF generation and upload) and when supplying
scan-args ensure you include the target directory (add "./" alongside
`--recursive`) so the scanner runs the intended tree; update the job invocation
to call the reusable workflow and pass `scan-args: --recursive ./` (or the
equivalent multiline form) so SARIF is produced and uploaded to the Security
tab.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6080cce and 2182c80.

📒 Files selected for processing (2)
  • .github/workflows/codeql.yml
  • .github/workflows/osv-scanner.yml

Copy link
Contributor

@calvinbrewer calvinbrewer left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@yujiyokoo yujiyokoo left a comment

Choose a reason for hiding this comment

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

Nice. Newly-added OSV is failing in CI

Set fail-on-vuln to false so vulnerability scan results are reported
to GitHub Security tab without failing CI. Current findings are all
low/medium severity in transitive dev dependencies.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.github/workflows/codeql.yml (2)

34-34: Upgrade github/codeql-action from v3 to v4.

Node.js 20.x — the runtime used by CodeQL Action v3 — reaches end-of-life on 30 April 2026; v4, which uses Node.js 24, has been released to address this. CodeQL Action v3 will be deprecated in December 2026, and the action now logs a warning for customers running v3 who could be running v4. GitHub recommends referencing the action using v4 to automatically pick up the latest bug fixes, new features, and updated CodeQL CLI versions.

⬆️ Proposed upgrade to CodeQL Action v4
-        uses: github/codeql-action/init@v3
+        uses: github/codeql-action/init@v4

-        uses: github/codeql-action/autobuild@v3
+        uses: github/codeql-action/autobuild@v4  # or remove entirely, see next comment

-        uses: github/codeql-action/analyze@v3
+        uses: github/codeql-action/analyze@v4

Also applies to: 39-39, 42-42

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/codeql.yml at line 34, The workflow is pinning CodeQL
Action to v3 (uses: github/codeql-action/init@v3), which is deprecated; update
every occurrence of that action reference (including other instances matching
"uses: github/codeql-action/init@v3" in the file) to use v4 (uses:
github/codeql-action/init@v4) so the workflow runs the CodeQL Action that uses
Node.js 24 and receives current fixes and updates; ensure both the init and any
other CodeQL action references in the file are consistently changed to `@v4`.

38-39: autobuild is unnecessary for javascript-typescript and can be replaced with build-mode: none.

The none build mode creates the database without building the source code and is available for all interpreted languages. The autobuild build mode attempts to automatically build the source code and is only available for compiled languages. Running autobuild on a JS/TS project adds unnecessary overhead and will be a no-op at best.

♻️ Proposed refactor to skip autobuild for interpreted language
       - name: Initialize CodeQL
         uses: github/codeql-action/init@v4
         with:
           languages: ${{ matrix.language }}
+          build-mode: none

-      - name: Autobuild
-        uses: github/codeql-action/autobuild@v4
-
       - name: Perform CodeQL Analysis
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/codeql.yml around lines 38 - 39, The workflow step named
"Autobuild" is unnecessary for this JavaScript/TypeScript repo; replace the step
that uses github/codeql-action/autobuild@v3 with the CodeQL analyze action
configured to skip building (use github/codeql-action/analyze@v3 and set
build-mode: none in the step's with: block), and ensure languages includes
javascript and/or typescript as appropriate; update or remove the old
"Autobuild" usage so the job creates the DB without attempting an autobuild.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/codeql.yml:
- Line 34: The workflow is pinning CodeQL Action to v3 (uses:
github/codeql-action/init@v3), which is deprecated; update every occurrence of
that action reference (including other instances matching "uses:
github/codeql-action/init@v3" in the file) to use v4 (uses:
github/codeql-action/init@v4) so the workflow runs the CodeQL Action that uses
Node.js 24 and receives current fixes and updates; ensure both the init and any
other CodeQL action references in the file are consistently changed to `@v4`.
- Around line 38-39: The workflow step named "Autobuild" is unnecessary for this
JavaScript/TypeScript repo; replace the step that uses
github/codeql-action/autobuild@v3 with the CodeQL analyze action configured to
skip building (use github/codeql-action/analyze@v3 and set build-mode: none in
the step's with: block), and ensure languages includes javascript and/or
typescript as appropriate; update or remove the old "Autobuild" usage so the job
creates the DB without attempting an autobuild.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2182c80 and 5f44409.

📒 Files selected for processing (2)
  • .github/workflows/codeql.yml
  • .github/workflows/osv-scanner.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/osv-scanner.yml

Upgrade codeql-action from v3 to v4 (v3 deprecated December 2026).
Remove unnecessary Autobuild step since JavaScript/TypeScript
analysis does not require a build.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/codeql.yml (1)

34-36: Good: CodeQL Action v4 is the correct current version.

github/codeql-action/init@v4 runs on the Node.js 24 runtime and is the recommended major version. Referencing the CodeQL Action by major version tag (e.g. v4) ensures the workflow automatically picks up the latest release within that major version, including bug fixes, new features, and updated CodeQL CLI versions.

Consider explicitly adding queries: security-extended to the init step for broader OWASP/CWE query coverage beyond the default suite:

🔍 Suggested addition for broader query coverage
      - name: Initialize CodeQL
        uses: github/codeql-action/init@v4
        with:
          languages: ${{ matrix.language }}
+         queries: security-extended
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/codeql.yml around lines 34 - 36, Add the CodeQL queries
option to the init step so the workflow runs the broader OWASP/CWE suite; update
the github/codeql-action/init@v4 invocation (the init step) to include queries:
security-extended in its with: block so CodeQL executes the extended security
query pack in addition to the defaults.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/codeql.yml:
- Around line 34-36: Add the CodeQL queries option to the init step so the
workflow runs the broader OWASP/CWE suite; update the
github/codeql-action/init@v4 invocation (the init step) to include queries:
security-extended in its with: block so CodeQL executes the extended security
query pack in addition to the defaults.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f44409 and 7c9bd48.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml

@tobyhede tobyhede merged commit 8fdb105 into main Feb 25, 2026
6 checks passed
@tobyhede tobyhede deleted the automations branch February 25, 2026 02:16
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