Skip to content

ci(security): add CodeQL code scanning for TypeScript and Python - #50

Merged
StvLi merged 1 commit into
mainfrom
ci/codeql-code-scanning
Sep 29, 2026
Merged

StvLi merged 1 commit into
mainfrom
ci/codeql-code-scanning

Conversation

@StvLi

@StvLi StvLi commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Why

The maintenance log recommended a static-analysis baseline in round 14 and again in round 15; neither landed. Today's CI reads the dependency graph and nothing else:

Check What it reads
pnpm audit --prod --audit-level high dependency graph
Dependabot alerts + automated fixes dependency graph (known advisories)
Dependabot version updates dependency graph (versions)
publish-surface gate tarball contents
CodeQL (this PR) our source

gh api repos/StvLi/dsh-ros2/code-scanning/alerts currently returns 404 no analysis found.

Scope

66 TypeScript files, 21 Python files. Python also picks up the extensionless shebang'd scripts under packages/vision/vlm/scripts/ (vlm_node, vlm_bridge_node, vision_bringup, …) — they are Python in everything but name and start with #!/usr/bin/env python3.

C/C++ is out of scope on purpose: the repository holds exactly one .cpp (packages/vision/offscreen/src/rviz_offscreen_node.cpp), and a CodeQL C/C++ database that expects a build would need a full ROS2 Jazzy toolchain (rclcpp, rviz_rendering) on the runner. Revisit if that surface grows.

Two deliberate choices

Dependabot PRs are skipped. They receive a read-only GITHUB_TOKEN, so the SARIF upload cannot succeed (Resource not accessible by integration) and the check would fail on every dependency PR — six are open right now. The push: main run analyses the merged result instead.

queries: security-extended, not the quality suite. This is a vulnerability baseline, not a style gate. analyze reports to the Security tab and does not fail the build on findings, so it cannot block a legitimate merge.

Cost

No pnpm install and no build step — both extractors are static, so the job stays fast and does not depend on the pnpm workspace. Weekly schedule re-scans unchanged code so a newly published query can still find something.

github/codeql-action@v4 is a mutable major tag, and dependabot.yml already watches the github-actions ecosystem at /, so it will be kept current automatically.

Verification

Step Result
workflow YAML parsed and asserted (triggers / matrix / job if / permissions) OK
workflow lint see CI
CodeQL run itself this PR is the first live run — the check list on this PR is the evidence

Once this is merged, the baseline shows up under Security → Code scanning.

Rounds 14 and 15 of the maintenance log both recommended a static-analysis
baseline and neither landed it. Dependabot's two halves (alerts + version
updates) and the `pnpm audit --prod --audit-level high` gate all read the
dependency graph; nothing in the CI set reads the code we wrote.

Scope is the two languages that dominate the tree — 66 TypeScript and 21 Python
files. Python additionally picks up the extensionless shebang'd scripts under
packages/vision/vlm/scripts/, which are Python in everything but name. C/C++ is
left out deliberately: the repository holds exactly one `.cpp`, and a CodeQL
C/C++ database that expects a build would need a full ROS2 Jazzy toolchain
(rclcpp, rviz_rendering) on the runner to extract anything useful.

Two choices worth stating, both to avoid a check that is red for reasons
unrelated to the change:

  - Dependabot PRs are skipped. They get a read-only GITHUB_TOKEN, so the SARIF
    upload cannot succeed ("Resource not accessible by integration") and the
    check would go red on every dependency PR — six are open right now. The
    push-to-main run analyses the merged result instead.
  - `queries: security-extended` rather than the quality suite: this baseline is
    for vulnerabilities, not style.

`analyze` reports to the Security tab and does not fail the build on findings,
so it cannot block a legitimate merge.

No `pnpm install` and no build step: both extractors are static, which keeps the
job fast and independent of the pnpm workspace layout.
@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.

@StvLi
StvLi merged commit 0d0d957 into main Sep 29, 2026
5 checks passed
@StvLi
StvLi deleted the ci/codeql-code-scanning branch September 29, 2026 20:24
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.

2 participants