@mesh-tech/mesh-cli 0.24.0 → 0.25.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/dist/bin/mesh.js CHANGED
@@ -6253,19 +6253,26 @@ function hubOperatorRoleKeys(tenants) {
6253
6253
  )
6254
6254
  ];
6255
6255
  }
6256
- var HUB_STAFF_ROLES, HUB_RESTRICTED_ROLES, HUB_BASE_ROLES, HUB_ROLE_KEY_SEPARATOR, HUB_ROLE_APP_SEPARATOR, RESTRICTED;
6256
+ var HUB_STAFF_ROLES, HUB_RESTRICTED_ROLES, HUB_VENDOR_DOCS_ROLE, HUB_ADDON_ROLES, HUB_TIER_ROLES, HUB_BASE_ROLES, HUB_ROLE_KEY_SEPARATOR, HUB_ROLE_APP_SEPARATOR, RESTRICTED, ADDONS;
6257
6257
  var init_hub_roles = __esm({
6258
6258
  "libs/api-registry/src/hub-roles.ts"() {
6259
6259
  "use strict";
6260
6260
  HUB_STAFF_ROLES = ["ops", "admin"];
6261
6261
  HUB_RESTRICTED_ROLES = ["developer", "auditor", "vendor", "docs"];
6262
- HUB_BASE_ROLES = [
6262
+ HUB_VENDOR_DOCS_ROLE = "vendor-docs";
6263
+ HUB_ADDON_ROLES = [HUB_VENDOR_DOCS_ROLE];
6264
+ HUB_TIER_ROLES = [
6263
6265
  ...HUB_STAFF_ROLES,
6264
6266
  ...HUB_RESTRICTED_ROLES
6265
6267
  ];
6268
+ HUB_BASE_ROLES = [
6269
+ ...HUB_TIER_ROLES,
6270
+ ...HUB_ADDON_ROLES
6271
+ ];
6266
6272
  HUB_ROLE_KEY_SEPARATOR = ":";
6267
6273
  HUB_ROLE_APP_SEPARATOR = "/";
6268
6274
  RESTRICTED = new Set(HUB_RESTRICTED_ROLES);
6275
+ ADDONS = new Set(HUB_ADDON_ROLES);
6269
6276
  }
6270
6277
  });
6271
6278
 
@@ -11011,6 +11018,17 @@ function docsSiteFindings(text) {
11011
11018
  why: `mesh.apps.${decl.ctor} declares a docs site but neither its kind nor its audience \u2014 who the Hub admits through the door would fall out of the name heuristic, and a vendor surface must never default to partner-readable that way`
11012
11019
  });
11013
11020
  }
11021
+ if (statedKind(decl, args) === "vendor" && docs.has("audience")) {
11022
+ const audience = objectLiteralOf(docs.get("audience"), text);
11023
+ const roles = audience ? stringList(topLevelProperties(audience).get("roles")) : void 0;
11024
+ if (roles !== void 0 && roles.length === 0) {
11025
+ findings.push({
11026
+ code: "DOCS_VENDOR_AUDIENCE_PARTNER",
11027
+ line: decl.line,
11028
+ why: `mesh.apps.${decl.ctor} declares a vendor surface's docs site with audience: { roles: [] } \u2014 partner-readable by every docs-role user of the tenant; a vendor's spec is the raw core API, its site is read by holders of the Hub's vendor-docs add-on only, and the deploy refuses this declaration`
11029
+ });
11030
+ }
11031
+ }
11014
11032
  const httpText = objectLiteralOf(topLevelProperties(objectLiteralOf(args.get("surfaces"), text) ?? "{}").get("http"), text);
11015
11033
  for (const f of docsAudienceUngrantable(text, decl, args, docs, httpText)) findings.push(f);
11016
11034
  }
@@ -11027,15 +11045,19 @@ function docsSiteFindings(text) {
11027
11045
  }
11028
11046
  return findings;
11029
11047
  }
11048
+ function statedKind(decl, args) {
11049
+ if (decl.ctor === "AppApiSurface") return "app";
11050
+ if (decl.ctor === "VendorApiSurface") return "vendor";
11051
+ return /^["']([a-z]+)["']$/.exec(args.get("kind") ?? "")?.[1];
11052
+ }
11030
11053
  function docsAudienceUngrantable(text, decl, args, docs, httpText) {
11031
11054
  const findings = [];
11032
11055
  let roles;
11033
11056
  if (docs.has("audience")) {
11034
11057
  const audience = objectLiteralOf(docs.get("audience"), text);
11035
11058
  roles = audience ? stringList(topLevelProperties(audience).get("roles")) : void 0;
11036
- } else {
11037
- const kind = decl.ctor === "AppApiSurface" ? "app" : decl.ctor === "VendorApiSurface" ? "vendor" : /^["']([a-z]+)["']$/.exec(args.get("kind") ?? "")?.[1];
11038
- if (kind === "app") roles = DEFAULT_PARTNER_DOCS_ROLES;
11059
+ } else if (statedKind(decl, args) === "app") {
11060
+ roles = DEFAULT_PARTNER_DOCS_ROLES;
11039
11061
  }
11040
11062
  if (!roles || roles.length === 0) return findings;
11041
11063
  const identities = [];
@@ -11048,7 +11070,7 @@ function docsAudienceUngrantable(text, decl, args, docs, httpText) {
11048
11070
  if (identities.length === 0) return findings;
11049
11071
  const docsAuth = objectLiteralOf(docs.get("auth"), text);
11050
11072
  const clientExpr = (docsAuth ? topLevelProperties(docsAuth).get("clientId") : void 0) ?? (httpText ? topLevelProperties(objectLiteralOf(topLevelProperties(httpText).get("auth"), text) ?? "{}").get("clientId") : void 0);
11051
- const clientRoot = clientExpr ? /^([A-Za-z_$][\w$]*)\.applications\./.exec(clientExpr.trim())?.[1] : void 0;
11073
+ const clientRoot = clientExpr ? /^([A-Za-z_$][\w$]*)\.(?:clientIds|applications)\./.exec(clientExpr.trim())?.[1] : void 0;
11052
11074
  const identity = (clientRoot ? identities.find((id) => id.binding === clientRoot) : void 0) ?? (identities.length === 1 ? identities[0] : void 0);
11053
11075
  if (!identity) return findings;
11054
11076
  const rolesText = identity.options.get("roles");
@@ -11394,6 +11416,15 @@ var init_app_check = __esm({
11394
11416
  severity: "block",
11395
11417
  remediation: `declare every audience role on the ZitadelAppIdentity (roles: ["docs"]) so the Hub can grant it from the app's Access tab \u2014 the audience is published on the surface's registry entry as the reader set for the Hub to admit by, and a role nobody can be granted admits nobody`,
11396
11418
  scope: "app"
11419
+ },
11420
+ DOCS_VENDOR_AUDIENCE_PARTNER: {
11421
+ gate: "H",
11422
+ title: "Vendor reference never partner-readable",
11423
+ // The same declaration fails `pulumi up` (the primitive refuses it); the
11424
+ // check says so where the program is written, not at the deploy.
11425
+ severity: "block",
11426
+ remediation: "drop docs.audience from the vendor surface \u2014 a vendor surface's site is the raw core API reference, read inside the Hub by holders of the vendor-docs add-on only; audience: { roles: [] } would declare it readable by every docs-role user of the tenant, which the Hub never honours and the deploy refuses",
11427
+ scope: "app"
11397
11428
  }
11398
11429
  };
11399
11430
  APP_CHECK_CODES = Object.keys(APP_CHECK_RULES);