jose 6.2.14 → 6.2.15

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.
@@ -5,7 +5,7 @@ function isCloudflareWorkers() {
5
5
  return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
6
6
  }
7
7
  let USER_AGENT;
8
- (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.14");
8
+ (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.15");
9
9
  const customFetch = /* @__PURE__ */ Symbol();
10
10
  async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
11
11
  const response = await fetchImpl(url, {
@@ -31,6 +31,8 @@ function isFreshFor(timestamp, duration) {
31
31
  function validateDuration(value, fallback, option) {
32
32
  if (Number.isNaN(value))
33
33
  throw new TypeError(`"${option}" option must not be NaN`);
34
+ if (typeof value == "number" && value < 0)
35
+ throw new TypeError(`"${option}" option must not be negative`);
34
36
  return typeof value == "number" ? value : fallback;
35
37
  }
36
38
  function createRemoteJWKSet(url, options) {
@@ -23,7 +23,8 @@ async function transform(stream, input, maxLength = 1 / 0) {
23
23
  if (done)
24
24
  break;
25
25
  if (chunks.push(value), length += value.byteLength, maxLength !== 1 / 0 && length > maxLength)
26
- throw new JWEInvalid("Decompressed plaintext exceeded the configured limit");
26
+ throw await reader.cancel().catch(() => {
27
+ }), new JWEInvalid("Decompressed plaintext exceeded the configured limit");
27
28
  }
28
29
  return concat(...chunks);
29
30
  }
@@ -77,7 +77,8 @@ function validateClaimsSet(protectedHeader, claimsSetBytes, options = {}) {
77
77
  throw new TypeError("Invalid clockTolerance option type");
78
78
  tolerance = clockTolerance;
79
79
  }
80
- validateInput("clockTolerance option", tolerance);
80
+ if (validateInput("clockTolerance option", tolerance), tolerance < 0)
81
+ throw new TypeError("Invalid clockTolerance option input");
81
82
  const { currentDate } = options, now = validateInput("currentDate option", epoch(currentDate === void 0 ? /* @__PURE__ */ new Date() : currentDate)), iat = validateNumericDate(claimsSet, "iat", maxTokenAge !== void 0), nbf = validateNumericDate(claimsSet, "nbf");
82
83
  if (nbf !== void 0 && nbf > now + tolerance)
83
84
  throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', claimsSet, "nbf", checkFailed);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "6.2.14",
3
+ "version": "6.2.15",
4
4
  "description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
5
5
  "keywords": [
6
6
  "akp",