@orangecheck/me-client 0.64.0 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,15 @@ this file tracks the package's TS / Node / runtime API surface.
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.65.0] — 2026-11-25
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- `webhook.verify` refuses every delivery, before it fetches a key, when
|
|
18
|
+
`maxAgeSeconds` is set to anything but a finite number above 0 (NaN from an
|
|
19
|
+
unset env var, Infinity, 0, a negative, a string or null). Left out, it is
|
|
20
|
+
still a day.
|
|
21
|
+
|
|
13
22
|
## [0.64.0] — 2026-11-24
|
|
14
23
|
|
|
15
24
|
### Added
|
package/dist/index.js
CHANGED
|
@@ -1211,7 +1211,7 @@ function isIsoTime(v) {
|
|
|
1211
1211
|
const t = Date.parse(v);
|
|
1212
1212
|
return Number.isFinite(t) && new Date(t).toISOString().slice(0, 19) === v.slice(0, 19);
|
|
1213
1213
|
}
|
|
1214
|
-
function signedFields(msg, options) {
|
|
1214
|
+
function signedFields(msg, options, maxAgeSeconds) {
|
|
1215
1215
|
let parsed;
|
|
1216
1216
|
try {
|
|
1217
1217
|
parsed = JSON.parse(new TextDecoder().decode(msg));
|
|
@@ -1229,7 +1229,7 @@ function signedFields(msg, options) {
|
|
|
1229
1229
|
return { ok: false, reason: `signed for another project (${project_key})` };
|
|
1230
1230
|
}
|
|
1231
1231
|
const age = Date.now() - Date.parse(issued_at);
|
|
1232
|
-
if (age >
|
|
1232
|
+
if (age > maxAgeSeconds * 1e3) {
|
|
1233
1233
|
return { ok: false, reason: "older than the accepted age (issued_at)" };
|
|
1234
1234
|
}
|
|
1235
1235
|
if (-age > FUTURE_SKEW_MS) return { ok: false, reason: "issued_at is in the future" };
|
|
@@ -1311,6 +1311,10 @@ async function verifyEd25519(key, sig2, msg) {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
async function verify2(rawBody, sigHex, kid, options = {}) {
|
|
1313
1313
|
if (options.project === void 0) warnNoProjectOnce();
|
|
1314
|
+
const maxAgeSeconds = options.maxAgeSeconds === void 0 ? DEFAULT_MAX_AGE_SECONDS : options.maxAgeSeconds;
|
|
1315
|
+
if (!Number.isFinite(maxAgeSeconds) || maxAgeSeconds <= 0) {
|
|
1316
|
+
return { ok: false, reason: "maxAgeSeconds must be a finite number above 0" };
|
|
1317
|
+
}
|
|
1314
1318
|
if (!sigHex) return { ok: false, reason: "missing signature" };
|
|
1315
1319
|
if (!kid) return { ok: false, reason: "missing kid" };
|
|
1316
1320
|
const sig2 = hexToBytes(sigHex);
|
|
@@ -1345,7 +1349,7 @@ async function verify2(rawBody, sigHex, kid, options = {}) {
|
|
|
1345
1349
|
if (!key) return { ok: false, reason: `kid ${kid} not in JWKS` };
|
|
1346
1350
|
}
|
|
1347
1351
|
if (!await verifyEd25519(key, sig2, msg)) return { ok: false, reason: "signature does not match" };
|
|
1348
|
-
return signedFields(msg, options);
|
|
1352
|
+
return signedFields(msg, options, maxAgeSeconds);
|
|
1349
1353
|
}
|
|
1350
1354
|
async function fetchJwksForce(issuer = DEFAULT_ISSUER) {
|
|
1351
1355
|
const origin2 = issuerOrigin(issuer, "webhook.fetchJwks: issuer");
|