Skip to content

fix: repair npm install (workspace: protocol) and the SQL verb false positive (v0.7.2) - #99

Merged
ralyodio merged 2 commits into
masterfrom
fix/sql-keyword-word-boundary
Aug 11, 2026
Merged

fix: repair npm install (workspace: protocol) and the SQL verb false positive (v0.7.2)#99
ralyodio merged 2 commits into
masterfrom
fix/sql-keyword-word-boundary

Conversation

@ralyodio

@ralyodio ralyodio commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Release 0.7.2. Two fixes: a critical install regression, and the SQL false-positive class.


1. npm install of the CLI is broken (critical)

Every install of 0.7.0 and 0.7.1 fails:

npm error code EUNSUPPORTEDPROTOCOL
npm error Unsupported URL Type "workspace:": workspace:*

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 npm chokes on a protocol it doesn't know. This took down every npm install -g @profullstack/threatcrush, including the malware-test-prs scan 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 to devDependencies is both the correct classification and the fix: npm never installs a package's devDependencies, so workspace:* is never resolved by consumers, while pnpm still links it for the build.

Verified end to end:

  • packed the 0.7.2 tarball → published dependencies carries no workspace: spec
  • npm install of that tarball into a clean project → 209 packages, no protocol error
  • @threatcrush/scan is not installed separately (it's in the bundle)
  • the installed CLI scans and detects correctly from the bundle alone
  • pnpm install --frozen-lockfile passes with the updated lockfile

2. A verb-shaped English word read as SQL injection

SQL_KEYWORDS matched 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:

key={`insert-${insertIndex}`}          // ralyodio/ShortsStudio — the only finding
log.info(`Update finished in ${ms}ms`) // ionic-team/capacitor — 3 of 13 findings

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 the SELECT/UPDATE look-aheads bounded to a single string literal. Every injection shape the corpus and unit tests exercise is SELECT … FROM or DELETE FROM, so all still match; a verb standing alone as prose no longer does.

target before after
ralyodio/ShortsStudio 1 (false) 0 — clean
ionic-team/capacitor 13 10 (−3, all sql-template-interpolation)
testbed coverage TPR 65.9% / FPR 0% unchanged

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 install of the packed tarball. tsc --noEmit clean.

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.

… 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>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

NOT RUN — the scan did not complete, so this diff was not examined.
This is not a clean result. See the job log.

…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>
@ralyodio ralyodio changed the title fix(scan): require SQL structure so a verb-shaped word is not read as injection (v0.7.2) fix: repair npm install (workspace: protocol) and the SQL verb false positive (v0.7.2) Aug 11, 2026
@ralyodio
ralyodio merged commit bf28d6f into master Aug 11, 2026
10 of 11 checks passed
@ralyodio
ralyodio deleted the fix/sql-keyword-word-boundary branch August 11, 2026 05:29
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