Skip to content

ci: close the CodeQL findings from the first scan - #39

Merged
lorem-dev merged 3 commits into
developfrom
feature/close-codeql-findings
Sep 8, 2026
Merged

lorem-dev merged 3 commits into
developfrom
feature/close-codeql-findings

Conversation

@lorem-dev

Copy link
Copy Markdown
Owner

Closes everything actionable that the first CodeQL run reported on develop, and dismisses the rest with reasons.

Fixed

actions/missing-workflow-permissions (5) -- all three ci.yml jobs plus release.yml's verify-version and build ran on the default GITHUB_TOKEN. ci.yml gets one workflow-level contents: read; release.yml gets permissions: {} at the top and a grant per job, leaving publish as the only job that can write. build holds the signing secrets and still needs only read -- artifact upload uses the runner's own token.

actions/unpinned-tag (9) -- the five third-party actions now pin to commit SHAs with the version in a trailing comment. The one that matters most reads least like it: dtolnay/rust-toolchain@1.97.1 is an unprotected branch, not a tag, so the release job that signs and publishes was running whatever its head happened to be. Dependabot keeps four of the five current; rust-toolchain is ignored there and moves by hand with rust-toolchain.toml. The actions/* uses stay on tags -- GitHub publishes those immutably and CodeQL does not flag them.

js/polynomial-redos (packages/i18n/src/translator.ts) -- \{([^}]+)\} let the body cross an opening brace, making every { a candidate start that scans to end-of-string before failing. 20k braces took 600ms, 40k took 2.3s. Excluding { from the body makes a failed start fail immediately: the same 40k input is now sub-millisecond. Three tests added, including the timing bound. Verified that both patterns produce identical output over every string in all 18 generated catalogs, so nothing user-visible changes and there is no changelog entry.

js/file-system-race (scripts/release-downloads.mjs) -- replaced existsSync then readFileSync with a read that treats ENOENT as "no notes yet". A non-ENOENT error now throws instead of being swallowed as a missing file.

Dismissed

All six Rust findings, with comments on each alert:

# Rule Reason
18-21 rust/hard-coded-cryptographic-value used in tests -- the literal is the nonce argument of sentinel_command_line, which numbers a shell-integration marker so one command's exit code is not read as the previous one's. Not cryptographic; the rule matched the parameter name.
22 rust/hard-coded-cryptographic-value won't fix -- the all-zero IV is mandated by the PuTTY PPK v2 format. Any other value simply fails to decrypt. v3 takes its IV from the KDF output.
17 rust/cleartext-logging false positive -- this is the SSH_ASKPASS protocol. The helper's contract is to write the passphrase to stdout, which ssh reads from a pipe. No log sink, no file, no terminal.

Verification

pnpm lint, pnpm typecheck, pnpm format:check, pnpm test:cov (1080 tests, 59 files) and cargo clippy --workspace --all-targets all pass.

Left alone

react-refresh/only-export-components in shared/ui/DescriptionText/DescriptionText.tsx -- an ESLint warning, not a CodeQL finding. spansToKeyedParts is exported from the component file because DescriptionText.test.ts tests it. Moving it to a sibling module (the features/skillInstall/lib/installSelection.ts pattern) would clear it, but that is renderer work rather than security work.

Closes the fourteen actions/* findings from the first CodeQL run.

Five jobs ran on the default GITHUB_TOKEN because neither their workflow
nor they declared permissions: all three in ci.yml, and release.yml's
verify-version and build. ci.yml gets one workflow-level `contents: read`,
which is the whole truth for it -- every job there checks out and runs a
gate. release.yml gets `permissions: {}` at the top and a grant per job,
so publish stays the only job that can write anything; build holds the
signing secrets and still needs nothing beyond read, because artifact
upload goes through the runner's own token rather than this one.

The five third-party actions move to commit SHAs with the version in a
trailing comment. dtolnay/rust-toolchain@1.97.1 is the one that matters
most and reads least like it: that ref is an unprotected BRANCH, not a
tag, so the release job that signs and publishes was running whatever
its head happened to be. tauri-action@v0 and rust-cache@v2 are moving
tags in the same pipeline. Dependabot keeps the SHAs and their comments
current for four of the five; rust-toolchain is excluded there and moves
by hand with rust-toolchain.toml, as before.

The actions/* uses stay on tags. GitHub publishes those immutably and
CodeQL does not flag them.
interpolate matched `\{([^}]+)\}`, whose body can cross an opening
brace. Every `{` in the template is therefore a candidate start that
scans to the end of the string before failing, which is quadratic: 20k
opening braces took 600ms and 40k took 2.3 seconds.

Excluding `{` from the body makes a failed start fail on its first
character, and the same 40k input now takes under a millisecond. Nothing
is lost, because a placeholder name never contains a brace -- and the
change is an improvement in its own right: a stray `{` in a
hand-authored catalog used to swallow the real placeholder behind it,
and now costs the author only that one brace.

No catalog is affected today. Running both patterns over every string in
all eighteen generated catalogs produces identical output, so this is a
guard against a future typo rather than a fix for a live one, and there
is nothing user-visible to record in the changelog.

Found by CodeQL (js/polynomial-redos).
`existsSync(notesPath) ? readFileSync(notesPath) : ''` asks a question
whose answer the read already carries, and leaves a window between the
two. Read it and treat ENOENT as "no notes yet"; anything else still
throws, which the old form would have swallowed as a missing file.

Found by CodeQL (js/file-system-race).
@lorem-dev
lorem-dev merged commit 6e56d2d into develop Sep 8, 2026
7 checks passed
@lorem-dev
lorem-dev deleted the feature/close-codeql-findings branch September 8, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant