Repository navigation
ci: add CodeQL analysis for Go and JavaScript/TypeScript #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: CodeQL | ||
|
|
||
| # Static analysis (SAST) of the Go backend and of the JavaScript/TypeScript: | ||
| # the SvelteKit admin app, and the vanilla JS of the booking pages, the embed | ||
| # widget and the video room. Findings land in the repository's Security tab | ||
| # under Code scanning, and on pull requests as annotations. | ||
| # | ||
| # Runs on pushes to main, on pull requests, and weekly, so a newly added query | ||
| # can flag existing code even when nothing has changed. | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| schedule: | ||
| - cron: '20 5 * * 1' # weekly, Monday | ||
| workflow_dispatch: | ||
|
|
||
| # Read-only by default; the analyze job adds the one grant it needs. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: codeql-${{ github.ref }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keyed only on Technical details# Event types collide in the concurrency group
## Affected sites
- `.github/workflows/codeql.yml:23` — `group: codeql-${{ github.ref }}` resolves to `codeql-refs/heads/main` for a push, the schedule and a dispatch alike.
## Required outcome
- A scheduled or dispatched run on `main` must never cancel a push analysis of `main` (and vice versa), while pushes to the same PR head still cancel their predecessor as they do today.
## Suggested approach
- `group: codeql-${{ github.event_name }}-${{ github.ref }}`. PR runs stay on `refs/pull/N/merge`, so per-PR cancellation is unaffected. |
||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| analyze: | ||
| name: Analyze (${{ matrix.language }}) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| permissions: | ||
| contents: read # check out the code | ||
| security-events: write # upload the results to code scanning | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| # Go needs a build for CodeQL to trace. See the build step below. | ||
| - language: go | ||
| build-mode: manual | ||
| # JavaScript/TypeScript is extracted from source, with no build. | ||
| - language: javascript-typescript | ||
| build-mode: none | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| # Same toolchain as ci.yml, from go.mod. Set up before CodeQL so its | ||
| # tracer sees the Go that does the build. | ||
| - if: matrix.language == 'go' | ||
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
|
|
||
| - uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 | ||
| with: | ||
| languages: ${{ matrix.language }} | ||
| build-mode: ${{ matrix.build-mode }} | ||
| # The vendored LiveKit client SDK is third-party, minified code. | ||
| config: | | ||
| paths-ignore: | ||
| - internal/handler/assets/livekit-client.umd.min.js | ||
|
|
||
| # frontend/embed.go has `//go:embed all:build`, so `go build` fails while | ||
| # frontend/build is missing. The embedded files are data and CodeQL does | ||
| # not analyse them, so a placeholder stands in for `pnpm build` here and | ||
| # this job needs no Node toolchain. The real build is covered by ci.yml. | ||
| - name: Build (Go) | ||
| if: matrix.language == 'go' | ||
| run: | | ||
| mkdir -p frontend/build | ||
| touch frontend/build/.codeql-placeholder | ||
| go build ./... | ||
|
|
||
| - uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 | ||
| with: | ||
| category: /language:${{ matrix.language }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth narrowing this, since it is the coverage claim a maintainer will read: the JS/TS extractor does not parse
.sveltecomponents. This PR's run extracted 193 files and none of the 77.sveltefiles underfrontend/src, so what is actually analysed is the app's.ts/.jsmodules (plus inline scripts in the HTML templates and the NS8 Vue UI), not the admin components themselves — and most of the admin UI's client logic lives in those.sveltefiles.