Skip to content

fix(security): crypto UUIDs for RPC correlation ids - #47

Merged
lsiddiquee merged 1 commit into
mainfrom
fix/insecure-randomness-and-fast-uri
Jul 22, 2026
Merged

fix(security): crypto UUIDs for RPC correlation ids#47
lsiddiquee merged 1 commit into
mainfrom
fix/insecure-randomness-and-fast-uri

Conversation

@lsiddiquee

@lsiddiquee lsiddiquee commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Why

CodeQL js/insecure-randomness (High): RPC correlation / frame ids were minted with Math.random() and flowed into request-id sinks (the alert surfaced at the dev-only web-playground echo, but the tainted source was web's ids).

What

  • Switch correlation/frame ids to crypto.randomUUID()node:crypto in the extension's Node context, global crypto in the browser — across web bridge, web auth, and extension provider-auth. Failing-first test asserts the auth id is a UUID.
  • Kept genuinely non-sink Math.random: reconnect-backoff jitter and the crypto-first, local-only newTraceId fallback.
  • Field note in docs/06.

Not in this PR — fast-uri (Dependabot #16)

Intentionally excluded. The patched fast-uri lines (2.4.3 / 3.1.4 / 4.1.1) are not mirrored on our feed proxy (newest available is the still-vulnerable 4.1.0), and a newer advisory (GHSA-v2hh-gcrm-f6hx) extended the affected range to >= 4.0.0, <= 4.1.0 — so no resolvable fix exists locally yet, and a still-vulnerable override would only fail dependency-review. It's a dev-only transitive (ajv <- secretlint <- @vscode/vsce, never shipped). Deferred to Dependabot / once the proxy mirrors a patch; rationale captured in docs/06.

Validation

pnpm -r build / typecheck / lint clean; pnpm -r test green (web 131 incl. new UUID test, extension 212, protocol 66, gateway 138).

Guardrails

Zero code-sync; boundaries respected (extension uses node:crypto); no new egress path; provenance untouched; no secrets logged.

RPC correlation / frame ids in the web bridge, web auth, and extension
provider-auth were minted with Math.random(), which flowed into request-id
sinks and tripped CodeQL js/insecure-randomness (High). Switch them to
crypto.randomUUID (node:crypto in the extension's Node context, global crypto
in the browser). Genuinely non-sink Math.random is kept: reconnect-backoff
jitter and the crypto-first, local-only newTraceId fallback.

Adds a failing-first test asserting the auth correlation id is a UUID.
@lsiddiquee
lsiddiquee force-pushed the fix/insecure-randomness-and-fast-uri branch from a888ebe to 3e470ee Compare July 22, 2026 13:14
@lsiddiquee lsiddiquee changed the title fix(security): crypto UUIDs for RPC ids + fast-uri 4.x override fix(security): crypto UUIDs for RPC correlation ids Jul 22, 2026
@lsiddiquee
lsiddiquee merged commit 0378f05 into main Jul 22, 2026
7 checks passed
@lsiddiquee
lsiddiquee deleted the fix/insecure-randomness-and-fast-uri branch July 22, 2026 13:16
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