fix: repair npm install (workspace: protocol) and the SQL verb false positive (v0.7.2) - #99
Merged
Merged
Conversation
… injection
Release 0.7.2.
The SQL keyword list matched bare verbs — INSERT, UPDATE, DELETE, DROP, a
lone SELECT — each with a trailing word boundary. A word boundary sits at the
hyphen in a React key `insert-${i}`, and after `Update` in a log line
`Update finished in ${ms}ms`, so both read as SQL injection at critical
severity. On ralyodio/ShortsStudio that was the only finding; on
ionic-team/capacitor it was three of thirteen.
Real SQL pairs the verb with the clause that makes it a statement:
SELECT … FROM, INSERT INTO, UPDATE … SET, DELETE FROM, DROP TABLE. Requiring
that structure keeps every injection shape the corpus and the unit tests
exercise — all of which are SELECT … FROM or DELETE FROM — while a verb
standing alone as prose no longer qualifies. The SELECT and UPDATE look-aheads
are bounded to one string literal so the clause must be in the same statement.
ShortsStudio: 1 finding to 0 (clean). capacitor: 13 to 10, removing all three
sql-template-interpolation false positives and nothing else. Testbed coverage
unchanged at TPR 65.9% / FPR 0% — no true positive lost. 125 tests, up from
123; the new false-positive test was confirmed to fail against the old
pattern.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ThreatCrush Security ScanNOT RUN — the scan did not complete, so this diff was not examined. |
…he CLI Extracting the scan engine (#94) added `@threatcrush/scan: workspace:*` to the CLI's dependencies. pnpm understands `workspace:*`; the release runs `npm publish`, which does not rewrite it — so the published package.json ships `workspace:*` verbatim, and every `npm install -g @profullstack/threatcrush` fails with EUNSUPPORTEDPROTOCOL. This broke all installs of 0.7.0 and 0.7.1, including the malware-test-prs scan workflow that installs @latest. The package is bundled into the CLI by tsup (`noExternal`), so it is a build-time dependency, not a runtime one — nothing requires it from the published artifact. Moving it to devDependencies is the correct classification and the fix: npm does not install a package's devDependencies, so the `workspace:*` spec is never resolved by consumers, while pnpm still links it for the build. Verified end to end: packed the 0.7.2 tarball and confirmed its published `dependencies` carries no `workspace:` spec; `npm install` of that tarball into a clean project succeeds (209 packages, no protocol error); @threatcrush/scan is not installed separately; and the installed CLI scans and detects correctly from the bundle alone. `pnpm install --frozen-lockfile` passes with the updated lockfile. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Release 0.7.2. Two fixes: a critical install regression, and the SQL false-positive class.
1.
npm installof the CLI is broken (critical)Every install of 0.7.0 and 0.7.1 fails:
Extracting the scan engine (#94) added
@threatcrush/scan: workspace:*to the CLI's dependencies.pnpmunderstandsworkspace:*; the release runsnpm publish, which does not rewrite it — so the publishedpackage.jsonshipsworkspace:*verbatim, andnpmchokes on a protocol it doesn't know. This took down everynpm install -g @profullstack/threatcrush, including themalware-test-prsscan workflow that installs@latest(the failure that surfaced it).Fix: the package is bundled into the CLI by tsup (
noExternal), so it's a build-time dependency, not a runtime one — nothing requires it from the published artifact. Moving it todevDependenciesis both the correct classification and the fix: npm never installs a package's devDependencies, soworkspace:*is never resolved by consumers, while pnpm still links it for the build.Verified end to end:
dependenciescarries noworkspace:specnpm installof that tarball into a clean project → 209 packages, no protocol error@threatcrush/scanis not installed separately (it's in the bundle)pnpm install --frozen-lockfilepasses with the updated lockfile2. A verb-shaped English word read as SQL injection
SQL_KEYWORDSmatched bare verbs, each with a trailing\b. A word boundary sits at the hyphen in a React key and after an English "Update", so both of these read as critical SQL injection:Fix: real SQL pairs the verb with the clause that makes it a statement. Each alternative now requires it —
SELECT … FROM,INSERT INTO,UPDATE … SET,DELETE FROM,DROP TABLE|…,TRUNCATE TABLE,UNION SELECT— with theSELECT/UPDATElook-aheads bounded to a single string literal. Every injection shape the corpus and unit tests exercise isSELECT … FROMorDELETE FROM, so all still match; a verb standing alone as prose no longer does.sql-template-interpolation)125 tests (up from 123). The new false-positive test was confirmed to fail against the old pattern; the install fix was confirmed by an actual
npm installof the packed tarball.tsc --noEmitclean.This is what makes it safe to point the scanner at a third-party JavaScript repo — both that their PR can install the CLI at all, and that it won't greet them with a bogus SQL-injection alert.