Repository navigation
Commit 86d0091
Reject empty oct key material and empty HMAC keys at sign/verify entry
An empty oct key produces a deterministic HMAC digest reproducible by any
party, so accepting one in JWS verification lets an attacker forge HS256/
HS384/HS512 signatures with no secret knowledge. The path is reached
whenever the application's secret resolves to "" or None (unset env var,
missing config row, key finder fallback). Promote the existing
SecurityWarning for keys smaller than 14 bytes to a hard reject at
length == 0 inside OctKey.import_key, and add a defence-in-depth check in
HMACAlgorithm.sign / .verify after get_op_key so OctKey instances
constructed through non-import paths are also rejected. Add regression
tests in test_oct_key.py (import-side) and test_compact.py (HMAC-side).
Cross-language sibling of jwt/ruby-jwt CVE-2026-45363 / GHSA-c32j-vqhx-rx3x
fix in lib/jwt/jwa/hmac.rb. Equivalent guards already exist in PyJWT 2.13.0,
firebase/php-jwt, jjwt (256-bit minimum), and Microsoft IdentityModel
(128-bit minimum).
Signed-off-by: tonghuaroot <[email protected]>1 parent 1e5b94d commit 86d0091
4 files changed
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| 74 | + | |
| 75 | + | |
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
0 commit comments