@tokenoftrust/storefront-runner 2.2.1 → 2.2.2

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.
@@ -117,12 +117,14 @@ export async function authorizeInternalContentRequest(
117
117
  }
118
118
  if (!contexts) return { allowed: false, reason: "unavailable" };
119
119
 
120
- const matching = contexts.filter((context) => context.appDomain === input.route.tenant);
121
- if (matching.length !== 1) return { allowed: false, reason: "denied" };
122
- const audience = matching[0]!.audience;
123
- if (audience !== "owner" && audience !== "developer") {
124
- return { allowed: false, reason: "denied" };
125
- }
120
+ // The broker sends one context per (store, kind). Only a direct membership (owner or
121
+ // developer) authorizes internal content; staff, operator and unknown kinds carry nothing
122
+ // here and displace nothing. Two memberships on one store are ambiguous and refused.
123
+ const memberships = contexts.filter((context) =>
124
+ context.appDomain === input.route.tenant &&
125
+ (context.audience === "owner" || context.audience === "developer"));
126
+ if (memberships.length !== 1) return { allowed: false, reason: "denied" };
127
+ const audience = memberships[0]!.audience as "owner" | "developer";
126
128
  return {
127
129
  allowed: true,
128
130
  tenant: input.route.tenant,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
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",