Skip to content

crypto: cap GCM IV length at 128 bytes in createCipheriv - #34092

Merged
Jarred-Sumner merged 1 commit into
mainfrom
farm/64fae715/gcm-iv-length-cap
Aug 13, 2026
Merged

Jarred-Sumner merged 1 commit into
mainfrom
farm/64fae715/gcm-iv-length-cap

crypto: cap GCM IV length at 128 bytes in createCipheriv

9445096
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 13, 2026 in 9m 46s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/jsc/bindings/node/crypto/JSCipherConstructor.cpp:194-200 getCipherInfo still accepts GCM IV lengths >128, now inconsistent with createCipheriv

Annotations

Check warning on line 200 in src/jsc/bindings/node/crypto/JSCipherConstructor.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

getCipherInfo still accepts GCM IV lengths >128, now inconsistent with createCipheriv

Nit: `crypto.getCipherInfo` has the same missing GCM IV cap — the empty `else if (cipher.isGcmMode()) {}` branch at `src/jsc/bindings/node/crypto/node_crypto_binding.cpp:289` still accepts any `ivLength`, so after this PR `getCipherInfo('aes-128-gcm', { ivLength: 200 })` reports 200 as valid while `createCipheriv` rejects it (Node returns `undefined`). Same bug class at a sibling site; a one-liner `if (length < 1 || length > 128) return JSValue::encode(jsUndefined());` in that branch would keep