Repository navigation
chore(security): Actions permissions and test/script alerts (CodeQL) - #188
Merged
Merged
Conversation
Close CodeQL alerts 1-4, 8, 37, 38, 39 and 40 on main. - ci.yml and npm-smoke.yml get a top-level `permissions: contents: read`. No step needs more: checkout reads, and setup-node, rust-cache and cache-cargo-install use the Actions cache service, not the token; nothing comments, uploads or writes checks. - release-plan.ts encodes every "/" of a package name (replaceAll). - mcp-tools-doc.ts escapes backslashes before pipes in table cells (the generated README is unchanged). - The i18n codemod decodes string literals of either quote in one pass, so an escaped backslash before a quote is never taken apart. - The fake WAE's type-error check is a linear scan (equivalence fuzz and an adversarial case), and the corrections test's tag filter is case-insensitive. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Madraka <[email protected]>
- Move the codemod's string-literal test from apps/studio (its tsconfig rootDir is apps/, so importing scripts/ failed typecheck with TS6059) to packages/cli/test, where the other scripts' tests live. - weightsBesideLiteralZero probes each comma once, however many `if(` share it, and scans the `doubleN,` argument by hand instead of a sticky regex: it was still quadratic on one comma followed by a long whitespace run (CodeQL alert 51 on the PR). The linearity test now covers that input. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Madraka <[email protected]>
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.
The second half of the CodeQL backlog on
main(the first is #187, production code). Touches different files from #187; no published package changes, so no changeset.Actions permissions (alerts 1, 2, 3, 4)
ci.yml(jobsts,rust,contract-drift) andnpm-smoke.yml(smoke) ran with the default token. Both now set a top-levelpermissions: contents: read. Checked every step:actions/checkoutcontents: readactions/setup-nodecache: pnpm,Swatinem/rust-cache,taiki-e/cache-cargo-install-actionGITHUB_TOKENpnpm/action-setup,dtolnay/rust-toolchainbuild:packages,smoke:pack,git diff --exit-codeNothing comments on PRs, uploads artifacts or releases, or writes checks, so no job is widened.
Tests and scripts
scripts/release-plan.ts:40name.replaceAll("/", "%2F")scripts/mcp-tools-doc.ts:37--checkstill passes (README unchanged)scripts/i18n-codemod/catalog-entries.ts:58stringBodyAsJson: one pass over a literal's body (either quote),\'→', bare"escaped, other escapes kept. The replace chain turned'a\"b'into invalid JSON. Newapps/studio/test/catalog-entries.test.tsastro-renderer/test/corrections.test.ts:74/…/i)analytics/test/helpers/fake-wae.ts:139weightsBesideLiteralZero, a linear scan;fake-wae-check.test.tschecks it against the old regex (cases + 20k seeded random queries) and on 10kquantileWeighted(/ 50kif(Alert 45 (
core-ts/src/testing-automations.ts:200, "unescaped '.' before 'example.com/nope'") is fixed in #187, not here. The SARIF's related location shows the sink:surfaces/body.tsbuiltnew RegExp(...)for each code fence's closer from the body's line text, and CodeQL followed this test's markdown into it. #187 replaces that with aclosesFencescanner, so the string is no longer used as a regex anywhere. Escaping the dot in the fixture would have changed the test's link and left the dynamic RegExp in place.Checks
pnpm exec vitest runfor analytics (13 files / 375 tests), astro-renderercorrections.test.ts, clirelease-plan.test.ts, studiocatalog-entries.test.tsandi18n-messages.test.ts;node scripts/mcp-tools-doc.ts --check;pnpm size:check;pnpm design:lint; Biome on the changed files.Alert map (all 25)
Nothing is dismissed.
🤖 Generated with Claude Code