chore(ci): scan the TypeScript client with CodeQL - #153
Open
Anuj-72 wants to merge 1 commit into
Open
Conversation
…e CSPRNG CodeQL's language matrix was [python, go], so the VS Code extension's TypeScript was the one shipped tree nothing looked at. Adding javascript-typescript needs no build step (the JS extractor reads source directly) and both Go steps already carry `if: matrix.language == 'go'`, so the new leg skips them. The first finding it reports is ours: the webview's CSP nonce came from Math.random(), the shape every VS Code webview sample uses. That trips js/insecure-randomness, and rightly — a nonce is a security token and has no business coming from a non-cryptographic PRNG. Now randomBytes(16), which keeps the 32-character hex shape the CSP grammar wants. Not a live hole: renderHtml interpolates nothing untrusted and media/chat.js writes through textContent, so a guessed nonce had no injection point to unlock.
|
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:
For more information about GitHub Code Scanning, check out the documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up 2 from #35 / #145: CodeQL's language matrix was
[python, go], so the VS Code extension's TypeScript was the one shipped tree nothing scanned.What changed
.github/workflows/codeql.yml—javascript-typescriptjoins the matrix. No build step needed (the JS extractor reads source directly), and both Go steps already carryif: matrix.language == 'go', so the new leg skips them.categoryandconcurrencyare already per-language, so nothing else needed touching.extensions/vscode/src/ui/chatView.ts— the first finding the new leg reports is ours. The webview's CSP nonce came fromMath.random()(the shape every VS Code webview sample uses), which tripsjs/insecure-randomnessin thesecurity-and-qualitypack. NowrandomBytes(16).toString('hex'), keeping the 32-character shape the CSP grammar wants.Not a live hole, to be clear about severity:
renderHtmlinterpolates nothing untrusted andmedia/chat.jswrites throughtextContent, so a guessed nonce had no injection point to unlock. Fixed because a security token shouldn't come from a non-cryptographic PRNG regardless.Verified
Rebased on current
dev(33f57e2), which already carries0c2e02c— follow-up 1 from that same list. That commit toucheschatView.tstoo, but at theproxyUrldefault (~line 163), nowhere neargetNonce(~line 740); no conflict.extensions/vscode:tsc --noEmitclean,eslint src testclean, 133 tests passing (10 files), production bundle builds.codeql.ymlparses as YAML with the matrix reading['python', 'go', 'javascript-typescript'].The workflow change itself can only really be proven by running it — the extension's own CI job doesn't cover the CodeQL leg, so the new matrix entry gets its first real exercise on this PR.