]> git.kaiwu.me - njs.git/commit
WebCrypto: reject empty HMAC keys in importKey() master
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 13 Nov 2026 02:26:58 +0000 (18:26 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Mon, 16 Nov 2026 18:13:27 +0000 (10:13 -0800)
commit14f8ae4dd8bede83f4e4fc9f7fd532ab5e2c05b8
tree402c7b53b6b2aecc6916156011b386c7542a9379
parent0a315376890db185566bb40b34cfb655ea143893
WebCrypto: reject empty HMAC keys in importKey()

Previously, importKey() accepted an empty raw or JWK HMAC key.  The
HMAC import key operation requires a DataError when the key data
length is zero.  It is reported as TypeError, as other invalid key
data in njs.

The issue was introduced in 7b2b7612 (0.7.0) and the QuickJS
counterpart in 75ca26f8 (0.8.10).
external/njs_webcrypto_module.c
external/qjs_webcrypto_module.c
test/webcrypto/import.t.mjs