@tokenoftrust/storefront-runner 7.9.4 → 7.9.5

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.
@@ -496,6 +496,13 @@ export function isCouponFilingBearerRequest(input: HoldReadBearerRequest): boole
496
496
  && /^Bearer\s+\S/i.test(input.authorization?.trim() ?? "");
497
497
  }
498
498
 
499
+ /** Let the two catalog handlers verify their own CLI bearer, including malformed presentations. */
500
+ export function isCatalogCliBearerRequest(input: HoldReadBearerRequest): boolean {
501
+ return input.method === "POST"
502
+ && (input.renderPath === "/api/admin/catalog/match" || input.renderPath === "/api/admin/catalog/intake")
503
+ && /^Bearer(?:\s|$)/i.test(input.authorization ?? "");
504
+ }
505
+
499
506
  /** The render path is the app token endpoint, whose form body {@link isAppCredentialRequest} reads. */
500
507
  export function isAppTokenPath(renderPath: string | undefined): boolean {
501
508
  return renderPath === APP_TOKEN_PATH;
@@ -564,6 +571,7 @@ export interface LoginGateInput {
564
571
  * its handler, which authorizes the credential live for this tenant and stage.
565
572
  */
566
573
  couponFilingBearer?: boolean;
574
+ catalogCliBearer?: boolean;
567
575
  }
568
576
 
569
577
  /**
@@ -613,6 +621,7 @@ export function evaluateLoginGate(input: LoginGateInput): LoginGateDecision {
613
621
  if (input.holdReadBearer) return { action: "pass" };
614
622
  // The coupon filing door's own bearer reaches its handler, the authority for the credential.
615
623
  if (input.couponFilingBearer) return { action: "pass" };
624
+ if (input.catalogCliBearer) return { action: "pass" };
616
625
  if (input.hasValidSession) return { action: "pass" };
617
626
  return { action: "redirect", location: loginRedirectLocation(input.pathname) };
618
627
  }
@@ -35,6 +35,7 @@ import {
35
35
  isApiPath,
36
36
  isAppCredentialRequest,
37
37
  isCouponFilingBearerRequest,
38
+ isCatalogCliBearerRequest,
38
39
  isHoldReadBearerRequest,
39
40
  isAppTokenPath,
40
41
  isAuthPath,
@@ -128,6 +129,7 @@ async function serveControlPlaneInScope(input: ControlPlaneInput): Promise<Respo
128
129
  let appTestStage = false;
129
130
  let holdReadBearer = false;
130
131
  let couponFilingBearer = false;
132
+ let catalogCliBearer = false;
131
133
  if (input.hostLoginGated && !input.internalContentGrant) {
132
134
  // From the platform registry by id, NOT off `tenant` — that object resolves
133
135
  // from TENANT_CACHE KV first, so a record written before this field existed
@@ -201,6 +203,11 @@ async function serveControlPlaneInScope(input: ControlPlaneInput): Promise<Respo
201
203
  renderPath,
202
204
  authorization: request.headers.get("authorization"),
203
205
  });
206
+ catalogCliBearer = isCatalogCliBearerRequest({
207
+ method: request.method,
208
+ renderPath,
209
+ authorization: request.headers.get("authorization"),
210
+ });
204
211
  }
205
212
 
206
213
  // Canonical admin tenant landing: an AUTHENTICATED viewer who is not a
@@ -250,6 +257,7 @@ async function serveControlPlaneInScope(input: ControlPlaneInput): Promise<Respo
250
257
  appCredential: appTestStage,
251
258
  holdReadBearer,
252
259
  couponFilingBearer,
260
+ catalogCliBearer,
253
261
  });
254
262
  if (decision.action === "redirect") {
255
263
  // Admin and the cockpit hard-redirect to sign-in rather than rendering the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "7.9.4",
3
+ "version": "7.9.5",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
6
6
  "packageManager": "pnpm@11.9.0",