Skip to content

ci: add CodeQL code scanning #91

Closed

Description

@dangrondahl

Problem

Nothing in CI looks for security problems in the code itself. Code scanning isn't set up on the repo (default setup reports not-configured). Dependabot covers dependencies, and the Claude review only advises. This server holds a Kosli API token, can do destructive writes, and is shipped through npm and the .mcpb bundle, so it should get the same baseline scan as our other repos.

Proposal

Add .github/workflows/codeql.yaml, modelled on terraform-provider-kosli's codeql.yaml, using the analyze job only. Leave out its attest job and the SARIF upload artifact for now (see "Not in scope").

  • Triggers: push and pull_request to main, plus a weekly schedule as a baseline re-scan, at an off-peak minute as the provider does.
  • Concurrency: cancel superseded PR runs only, as the provider does (cancel-in-progress: ${{ github.event_name == 'pull_request' }}). A cancelled run on main uploads no SARIF and leaves the code scanning baseline stale.
  • Languages: a matrix with build-mode: none for both:
    • javascript-typescript, which covers src/ and scripts/. No build is needed. src/catalog.json is generated data, not code.
    • actions, which covers the workflow files. The review workflow runs an LLM with a token in scope, so this matters here.
  • Queries: security-extended, as in the provider.
  • Permissions: security-events: write, contents: read and actions: read on the job, with contents: read at the top level.

Repo conventions to keep (from CLAUDE.md)

  • Pin every action to a full commit SHA with a trailing # vX.Y.Z comment. Dependabot updates them weekly.
  • Run step-security/harden-runner as the first step. The provider's workflow doesn't, but ours does on every job.
  • Make it fork-safe: it needs no secrets, so it runs on fork PRs without the head.repo.full_name guard.
  • Update the "Four workflows" line in CLAUDE.md.

Not in scope (for now)

  • Kosli attestation and instrumentation: the provider's attest job, which reports codeql-scan to a Kosli trail with a compliant flag based on open high or critical alerts. This repo has no Kosli flow or trail yet, so attesting has nowhere to go. Revisit once the repo reports to Kosli. Until then, the SARIF upload artifact isn't needed either.
  • Making CodeQL a required check in the main ruleset. Decide that after a few runs show how noisy it is.

Done when

  • codeql.yaml runs on a PR and on main, and its results show under Security → Code scanning.
  • Any alerts from the first full scan are fixed, or dismissed with a reason.

Activity

  1. added
    enhancement
    github_actions
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgithub_actions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions