Repository navigation
Fail the submission check on regex lookbehind - #30
Conversation
The last item on the release checklist, carried as "still unwritten" across several handoffs. `(?<=` and `(?<!` are a PARSE error in JavaScriptCore before iOS 16.4, not a runtime one: an affected phone fails to load the plugin at all rather than mis-handling a note. This plugin is not desktop-only and esbuild targets es2018, which does not downlevel lookbehind, so one written in source ships verbatim. One nearly did, in the importer's code-span scanner, and nothing in the toolchain would have caught it. Scans the SOURCES, with the bundle as a bonus rather than the other way round. The first version checked only `main.js`, which would have been a check that never ran: `npm run lint` comes before `npm run build` both in CI and in the release flow, and `main.js` is gitignored, so a fresh checkout has no bundle to read and the guard silently found nothing. The bundle pass is kept for the one thing sources cannot show, a dependency that inlines a lookbehind. Comments are blanked for this rule, and only this rule: the two eslint rules beside it deliberately READ comments, while the lookbehind rule must not, or it flags the comment in imports.ts explaining why lookbehind is banned, which is the one place in this repo guaranteed to quote the syntax. Verified six ways: clean tree passes; a lookbehind in code is caught; one in a `//` comment and one in a `/* */` comment are not; with `main.js` absent the source scan still catches it; and a lookbehind present only in the bundle is caught.
|
Warning Review limit reached
Next review available in: 13 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a guard in the submission-check script to prevent shipping JavaScript regex lookbehind (which can hard-fail parsing on older iOS JavaScriptCore), and extends that guard to optionally scan the built bundle when present.
Changes:
- Add a lookbehind detector and a detailed rationale message.
- Implement a “strip comments but preserve line numbers” helper to avoid flagging explanatory comments.
- Opportunistically scan
main.js(built bundle) for lookbehind to catch dependency-inlined patterns.
| function withoutComments(source) { | ||
| return source | ||
| .replace(/\/\*[\s\S]*?\*\//g, (m) => m.replace(/[^\n]/g, " ")) | ||
| .split(/\r?\n/) | ||
| .map((line) => line.replace(/\/\/.*$/, "")); | ||
| } |
| try { | ||
| const bundle = readFileSync("main.js", "utf8"); | ||
| bundle.split(/\r?\n/).forEach((line, index) => { | ||
| if (LOOKBEHIND.test(line)) { | ||
| findings.push(`main.js:${index + 1}: ${LOOKBEHIND_WHY}`); | ||
| } | ||
| }); | ||
| } catch { | ||
| // No bundle on this run. The source scan above already covers our own code. | ||
| } |
…VirusTotal links, brace-expansion floors, doc drift (#38) * CI and doc hardening: release lint, source-wide deprecated-API scan, VirusTotal links, brace-expansion floors, doc drift Repo and CI gaps from the handoff, none blocking but all real. - release.yml: run npm run lint before build. CI lints every PR, but a tag can be pushed at a commit CI never covered, so the release could cut an unlinted build. Runs before build because check-submission scans sources. - release.yml: give the VirusTotal step an id and fold its analysis URLs into the release notes. The scan ran before the release was created and its links were only in the workflow log; they now land on the release itself. Passed via env, guarded on a non-empty CHANGELOG-derived notes file. - ci.yml: the deprecated-API scan now covers every source .ts, not the main.ts entry point alone, so a deprecated call in any other module is caught. Sources rather than the minified bundle, which rewrites getLeaf(true) to getLeaf(!0). - package.json: raise the brace-expansion override floors to 1.1.18 / 2.1.4, the versions patched for GHSA-rgw5-rvv9-x895. The old floors (1.1.13 / 2.0.3) sat below the patch, so the override permitted a vulnerable resolution even though the current tree is already patched. - README.md: document Clear orphaned stars and the once-per-note broken-marker warning, both shipped but absent from the feature list. - copilot-instructions.md: the marker format escapes the opener as well as the terminator, and check-submission also rejects regex lookbehind. Both landed in #30/#31 and the instructions still described the old behavior. * Pin GitHub Actions to commit SHAs (annoteca only) Every action in ci.yml and release.yml is pinned to a full commit SHA with the version kept as a trailing comment, so a moved tag cannot swap the action out from under a build (including inside the attestation-signing job). Closes the SHA-pin gap for annoteca. Annoteca only, on purpose: the standing rule is to leave every other plugin alone, so this is NOT rolled out to the template or the other plugins. A fleet pass (template + back-fill + a Dependabot github-actions config so the pins do not rot) is a separate task for when that freeze lifts. * Address CodeRabbit on #38: harden the workflows - ci.yml: rewrite the deprecated-API scan as a shell function with recursive --include/--exclude, so it depends on neither a word-split file list (which breaks under zsh) nor \b (which grep without -P treats as a backspace). Explicit ERE boundaries instead. Verified locally: clean on the tree, and it still catches a planted usage. - Both workflows: persist-credentials: false on every checkout that does not run authenticated git later, so a compromised step cannot reuse the job token. - release.yml: drop the npm cache in the release job. It runs with contents, id-token, and attestations write plus VT_API_KEY, so it must not restore an untrusted dependency cache. CI keeps its cache. - release.yml: guard the release notes on non-whitespace content, not file size, in both the VirusTotal-append step and the create-release branch, so a lone blank line from awk is not mistaken for real notes. * release.yml: set package-manager-cache: false explicitly setup-node auto-caches (package-manager-cache defaults true) when package.json declares npm, so omitting cache: npm was not enough to keep the privileged release job off an untrusted dependency cache. Addresses CodeRabbit on #38.
The last open item on the release checklist, carried as "still unwritten" across several handoffs. Closing it rather than moving it forward again.
(?<=and(?<!are a parse error in JavaScriptCore before iOS 16.4, not a runtime one, so an affected phone fails to load the plugin at all rather than mis-handling a single note. This plugin is not desktop-only and esbuild targets es2018, which does not downlevel lookbehind, so one written in source ships verbatim. One nearly did, in the importer's code-span scanner, and nothing in the toolchain would have caught it.It scans the sources, with the bundle as a bonus rather than the other way round. My first version checked only
main.js, and the pre-commit review caught that this would have been a check that never runs:npm run lintcomes beforenpm run buildboth in CI (ci.ymlsteps 36 and 42) and in the documented release flow, andmain.jsis gitignored, so a fresh checkout has no bundle and the guard silently found nothing. The bundle pass is kept for the one thing sources cannot show: a dependency that inlines a lookbehind.Comments are blanked for this rule and only this rule. The two eslint rules beside it deliberately read comments; this one must not, or it flags the comment in
imports.tsthat explains why lookbehind is banned, which is the one place in the repo guaranteed to quote the syntax. That was a real false positive on the clean tree before it was fixed.Verified six ways:
//comment/* */commentmain.jsabsent (fresh CI checkout)npm run lintgreen. No source or behaviour change; this only adds a check.