@entro314labs/entro-auth-cimd 1.8.0-beta.15 → 1.8.0-rc.1

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/dist/index.d.mts CHANGED
@@ -128,8 +128,14 @@ interface CimdMetadataResolverOptions {
128
128
  * validated (its `updatedAt`) when refreshing its metadata document fails
129
129
  * transiently: the fetch times out after its host name resolved, the
130
130
  * connection fails with a known error code, or the server answers with
131
- * HTTP 500, 502, 503, or 504. Other failures still reject the request.
132
- * Cached `jwks_uri` keys follow the same rules.
131
+ * HTTP 500, 502, 503, or 504. If a fetch policy limit or the Node DNS
132
+ * lookup limit prevents a retry, the stored client can still be served
133
+ * within this age limit for five minutes after its last transient failure.
134
+ * Terminal metadata failures still reject the request.
135
+ *
136
+ * For cached `jwks_uri` keys, this option can extend the ten-minute
137
+ * fallback after the last successful key fetch. Shorter values leave
138
+ * that fallback in place.
133
139
  *
134
140
  * Accepts a number of seconds or a duration string (e.g. `"6h"`), at most
135
141
  * 24 hours.
@@ -162,7 +168,11 @@ interface CimdMetadataResolverOptions {
162
168
  * Pass an empty array to disable origin binding (not recommended for
163
169
  * production).
164
170
  *
165
- * Only `post_logout_redirect_uris` is origin-bound by default.
171
+ * Only `post_logout_redirect_uris` is origin-bound by default. HTTP(S)
172
+ * loopback redirect URLs are exempt from this origin check in both
173
+ * redirect fields. In `redirect_uris`, any private-use redirect is exempt.
174
+ * In `post_logout_redirect_uris`, only the authority-free private-use
175
+ * form, such as `com.example.app:/logout`, is exempt.
166
176
  * `redirect_uris` is excluded because exact redirect URI matching remains
167
177
  * mandatory at authorization time. The informative URIs `client_uri`,
168
178
  * `logo_uri`, `tos_uri`, and `policy_uri` are never origin-bound by
package/dist/index.mjs CHANGED
@@ -945,7 +945,7 @@ function createResolverState(cimdOptions, shared = false) {
945
945
  if (fetched.status === "not-modified" && !cachedEntry) throw invalidClient("Metadata document returned 304 without a validated cached document");
946
946
  const metadata = fetched.status === "modified" ? fetched.metadata : cachedEntry.metadata;
947
947
  const nextEntry = createCacheEntry(metadata, fetched.status === "modified" ? fetched.cacheHeaders : mergeCacheHeaders(cachedEntry.responseCacheHeaders, fetched.cacheHeaders), metadataRevalidationInterval, Date.now());
948
- const savedBy = shared && staleIfErrorMs !== null ? /* @__PURE__ */ new WeakSet() : void 0;
948
+ const savedBy = staleIfErrorMs !== null ? /* @__PURE__ */ new WeakSet() : void 0;
949
949
  if (nextEntry && savedBy) nextEntry.savedBy = savedBy;
950
950
  if (abandoned && leaseRetiredFetchByClientId.get(clientId) === startedFetch && !inFlightMetadataByClientId.has(clientId) && metadataCache.get(clientId) === cachedEntry) acceptedLate = true;
951
951
  if (!abandoned || acceptedLate) {
@@ -1022,7 +1022,7 @@ function createResolverState(cimdOptions, shared = false) {
1022
1022
  if (nextEntry && metadataCache.get(clientId) === nextEntry) metadataCache.delete(clientId);
1023
1023
  recordFailedFetch(clientId);
1024
1024
  }
1025
- if (isAPIError(error) && error.status === "BAD_REQUEST" && (shared || storedClientWithinStaleBound())) {
1025
+ if (isAPIError(error) && error.status === "BAD_REQUEST" && (shared || terminalFailures.has(clientId) || storedClientWithinStaleBound())) {
1026
1026
  savedBy?.delete(ctx.context.adapter);
1027
1027
  recordTerminalFailure(clientId, savedBy);
1028
1028
  }
@@ -1053,7 +1053,7 @@ function createResolverState(cimdOptions, shared = false) {
1053
1053
  await assertClientIdUrlFetchable(ctx, clientId, cimdOptions);
1054
1054
  } catch (error) {
1055
1055
  recordFetchFailure(clientId, error);
1056
- if (shared || storedClientWithinStaleBound()) recordTerminalFailure(clientId);
1056
+ if (shared || terminalFailures.has(clientId) || storedClientWithinStaleBound()) recordTerminalFailure(clientId);
1057
1057
  throw error;
1058
1058
  }
1059
1059
  checkedUrl = true;
@@ -1074,7 +1074,7 @@ function createResolverState(cimdOptions, shared = false) {
1074
1074
  recordTransientFailure(clientId, error);
1075
1075
  return serveStoredClient(storedClient, describeFetchFailure(error));
1076
1076
  }
1077
- if ((shared || storedClient) && !isTransientMetadataFetchFailure(error) && !isMetadataFetchRefusal(error) && !isMetadataFetchCapacityRefusal(error) && !isMetadataTransportError(error)) recordTerminalFailure(clientId);
1077
+ if ((shared || storedClient || terminalFailures.has(clientId)) && !isTransientMetadataFetchFailure(error) && !isMetadataFetchRefusal(error) && !isMetadataFetchCapacityRefusal(error) && !isMetadataTransportError(error)) recordTerminalFailure(clientId);
1078
1078
  const lastFailure = transientFailureByClientId.get(clientId);
1079
1079
  if (storedClient && lastFailure && Date.now() - lastFailure.failedAtMs <= STALE_CLIENT_REFUSAL_WINDOW_MS && (isMetadataFetchRefusal(error) || isMetadataFetchCapacityRefusal(error))) return serveStoredClient(storedClient, lastFailure.reason);
1080
1080
  throw error;
@@ -1149,7 +1149,7 @@ function createCimdResolver(options) {
1149
1149
  } };
1150
1150
  }
1151
1151
  // src/version.ts
1152
- const PACKAGE_VERSION = "1.8.0-beta.15";
1152
+ const PACKAGE_VERSION = "1.8.0-rc.1";
1153
1153
  // src/index.ts
1154
1154
  /**
1155
1155
  * Build a {@link ClientDiscovery} for Client ID Metadata Documents.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entro314labs/entro-auth-cimd",
3
- "version": "1.8.0-beta.15",
3
+ "version": "1.8.0-rc.1",
4
4
  "description": "Client ID Metadata Document plugin for Entro Auth",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -54,19 +54,19 @@
54
54
  }
55
55
  },
56
56
  "devDependencies": {
57
- "@entro314labs/entro-auth-core": "1.8.0-beta.15",
58
- "@entro314labs/entro-auth-mcp": "1.8.0-beta.15",
59
- "@entro314labs/entro-auth-oauth-provider": "1.8.0-beta.15",
57
+ "@entro314labs/entro-auth-core": "1.8.0-rc.1",
58
+ "@entro314labs/entro-auth-mcp": "1.8.0-rc.1",
59
+ "@entro314labs/entro-auth-oauth-provider": "1.8.0-rc.1",
60
60
  "@modelcontextprotocol/client": "2.4.0",
61
61
  "@modelcontextprotocol/server": "2.4.0",
62
- "@entro314labs/entro-auth": "1.8.0-beta.15",
62
+ "@entro314labs/entro-auth": "1.8.0-rc.1",
63
63
  "listhen": "^1.10.1",
64
64
  "tsdown": "0.23.7"
65
65
  },
66
66
  "peerDependencies": {
67
- "@entro314labs/entro-auth-core": "^1.8.0-beta.15",
68
- "@entro314labs/entro-auth-oauth-provider": "^1.8.0-beta.15",
69
- "@entro314labs/entro-auth": "^1.8.0-beta.15",
67
+ "@entro314labs/entro-auth-core": "^1.8.0-rc.1",
68
+ "@entro314labs/entro-auth-oauth-provider": "^1.8.0-rc.1",
69
+ "@entro314labs/entro-auth": "^1.8.0-rc.1",
70
70
  "better-call": "~1.4.6"
71
71
  },
72
72
  "scripts": {