Skip to content

ci: add CodeQL or equivalent security scanning workflow #665

Closed

Description

@ericksoa

Summary

Add automated security scanning to the CI pipeline. CodeQL (or equivalent) should run on PRs and on a weekly schedule to catch common vulnerability patterns in JavaScript and Python.

Identified during review of #390.

Activity

  1. albertrial commented on Mar 26, 2026

    @albertrial

    Hi @cv, are you currently working on this or planning to? I have a basic CodeQL workflow ready, in case you have not yet started working on this or if you have moved on from it. Thanks!

  2. cv commented on Mar 26, 2026

    @cv
    Collaborator

    @albertrial we're planning to do a big move to TypeScript with #924, then throw as many scanners and linters and tooling at it as we can get our hands on. Please hold! :)

  3. cv commented on Apr 8, 2026

    @cv
    Collaborator

    Updating the earlier thinking here: I would not block this on a future TS migration anymore. Based on the repo as it exists today, the right implementation is a hybrid scan setup:

    • CodeQL for JavaScript/TypeScript (the bulk of the repo now: bin/, root src/, nemoclaw/src/, test/, JS/TS scripts)
    • A shell-aware scanner for Bash (scripts/*.sh, install.sh, uninstall.sh, test/**/*.sh, shell embedded in workflows)
    • Optionally Python CodeQL for the smaller Python footprint that still exists (docs/_ext/**, docs/conf.py, scripts/*.py)

    I would implement this as a dedicated workflow like .github/workflows/code-scanning.yaml, instead of folding it into pr.yaml / main.yaml, because code scanning needs different permissions and we also want a weekly schedule without re-running the full sandbox/E2E matrix.

    Rough shape:

    on:
      pull_request:
        types: [opened, synchronize, reopened]
      push:
        branches: [main]
      schedule:
        - cron: '23 6 * * 1'
      workflow_dispatch:
    
    permissions:
      contents: read
      pull-requests: read
      security-events: write

    Job 1: CodeQL

    Use a language matrix:

    • javascript-typescript
    • python (optional, but still cheap and relevant for the docs/tooling Python we have)

    For this repo, that means scanning at least:

    • bin/**/*.js
    • src/**/*.ts
    • nemoclaw/src/**/*.ts
    • test/**/*.js
    • scripts/**/*.js
    • docs/_ext/**/*.py
    • docs/conf.py
    • scripts/*.py

    For JS/TS/Python, CodeQL can analyze source directly, so this can stay fairly simple:

    steps:
      - uses: actions/checkout@v6
      - uses: github/codeql-action/init@v4
        with:
          languages: ${{ matrix.language }}
          queries: security-and-quality
      - uses: github/codeql-action/analyze@v4

    Job 2: Shell scanning

    CodeQL will not cover Bash, which is important here because a lot of the operational and security-sensitive glue is in shell scripts.

    So I would pair CodeQL with one of these:

    1. ShellCheck + SARIF upload (best fit with what we already do)

      • we already run ShellCheck via prek
      • add a CI job that runs ShellCheck in SARIF mode and uploads results with github/codeql-action/upload-sarif@v4
      • that gets shell findings into the GitHub Security / Code Scanning UI
    2. Semgrep with shell rules + SARIF upload

      • slightly broader than ShellCheck, but also more tuning/noise

    If we want the smallest first step, I’d do CodeQL for JS/TS now and either:

    • keep shell security checks in existing CI initially, or
    • add ShellCheck SARIF in the same PR if we want shell alerts to land in the Security tab too.

    Repo-specific notes

    • We already have merge-gating checks in .github/actions/basic-checks/action.yaml (prek, ShellCheck, hadolint, gitleaks, TS build/checks). I would keep those as the gating path.
    • The new workflow’s job is security reporting (PR annotations + Security tab), not replacing the existing lint/test pipeline.
    • I would not copy the paths-ignore rules from main.yaml, because those would accidentally skip the Python code under docs/_ext/**.
    • To keep alert noise manageable, start with CodeQL’s security-and-quality pack, baseline the initial findings, and only then decide if we want anything more aggressive.

    So the concrete implementation sequence would be:

    1. add .github/workflows/code-scanning.yaml
    2. wire up CodeQL for javascript-typescript
    3. optionally add python to the same matrix
    4. add a shell scan job (preferably ShellCheck -> SARIF upload)
    5. verify with a draft PR that we get alerts in the GitHub Security UI

    That would align the scanning with the repo we actually have now: mostly JS/TS, a meaningful amount of Bash, and some Python tooling.

  4. ChunkyMonkey11 commented on May 7, 2026

    @ChunkyMonkey11
    Contributor

    Hi @cv, I’d like to take this on following your latest recommendation: a dedicated .github/workflows/code-scanning.yaml with CodeQL for JS/TS, likely Python, and ShellCheck SARIF upload for Bash. I’ll keep the existing basic checks as the gating path and make this workflow focused on code scanning/security reporting. Please let me know if you prefer a smaller first PR with only CodeQL JS/TS.

  5. linked a pull request that will close this issueci: add code scanning workflow #3202on May 13, 2026
  6. added
    area: ci
    area: security
    on Nov 17, 2026
  7. added theissue type on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: ciarea: security

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions