fix(codeql): detect raw JS/TS source in auto language mode#241
Merged
Conversation
The `auto` language detector added javascript-typescript only when a package.json existed or a .ts/.tsx/.mts file was found within 4 levels. Repos with a hand-written plain-JS frontend and no package.json (e.g. ldap-manager's internal/web/static/js/*.js at depth 5) were detected as go-only, so their JS was never scanned. Worse, GitHub still lists javascript as an eligible language, so a code_scanning merge gate then perpetually expects a JavaScript CodeQL result that never arrives, blocking every PR. Detect any first-party .js/.jsx/.mjs/.cjs/.ts/.tsx/.mts/.cts file, pruning node_modules/vendor/.git, with the depth bound raised to 8 so nested layouts are reached. package.json is no longer required. Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
|
CybotTM
added a commit
that referenced
this pull request
Jul 19, 2026
Doc-only follow-up to #241. The header comment still described the old behaviour ("first 4 levels", ignoring only `node_modules`/`vendor`) while the implementation uses `maxdepth 8` and also prunes `.git/`. This aligns the comment with the code — no functional change.
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.



Problem
The reusable CodeQL workflow's
languages: automode addedjavascript-typescriptonly when apackage.jsonexisted or a.ts/.tsx/.mtsfile was found within 4 directory levels. Two gaps followed:package.json(e.g.ldap-manager'sinternal/web/static/js/*.js) was detected asgoonly, so its JavaScript was never analyzed — a real coverage gap that hid a livejs/xss-through-domalert.code_scanningmerge gate. GitHub still listsjavascriptas an eligible language for such repos, so acode_scanningruleset perpetually expects a JavaScript CodeQL result thatautonever produces — blocking every PR (this is exactly what blockedldap-managerfor weeks).The 4-level depth bound also never reached
internal/web/static/js/*.js(depth 5), so even adding.jsnames alone would not have fixed it.Change
autonow addsjavascript-typescriptwhen apackage.jsonexists or any first-party.js/.jsx/.mjs/.cjs/.ts/.tsx/.mts/.ctssource file is present:node_modules/,vendor/,.git/are pruned (third-party / not our source, and huge).4 → 8to reach nested layouts.package.jsonis no longer required.Impact
Repos already passing an explicit
languages:list are unaffected (explicit lists still win). Go-only repos with no JS/TS staygo-only (verified). Repos with previously-unscanned first-party JS will start getting JavaScript analysis on their next run — the intended coverage improvement; this may surface new alerts.Verification
actionlintclean; YAML parses.node_modules/vendorJS → go-only;package.jsononly → detected; pure-Go → go-only.Follow-up to
ldap-manager#624(explicitlanguagesthere) and thejs/xss-through-domfix inldap-manager#625; this closes the class at the reusable so other repos don't hit it.