@wildo-ai/platform-config-lib 1.1.5 → 1.1.6

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.
Files changed (138) hide show
  1. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +3 -2
  2. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  3. package/dist/esm/bootstrap/bootstrap.contracts.js +3 -2
  4. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  5. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +47 -0
  6. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  7. package/dist/esm/bootstrap/bootstrap.schemas.js +8 -0
  8. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  9. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +12 -1
  10. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +12 -0
  12. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  13. package/dist/esm/bootstrap/platform-store-preconnect.d.ts +37 -0
  14. package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -0
  15. package/dist/esm/bootstrap/platform-store-preconnect.js +43 -0
  16. package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -0
  17. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  18. package/dist/esm/bootstrap/runtime-backing-service-access.js +8 -4
  19. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  20. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +36 -3
  21. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  22. package/dist/esm/bootstrap/runtime-topology.contracts.js +36 -13
  23. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  24. package/dist/esm/index.d.ts +1 -0
  25. package/dist/esm/index.d.ts.map +1 -1
  26. package/dist/esm/index.js +1 -0
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/lockfile/lockfile-io.d.ts +7 -1
  29. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  30. package/dist/esm/lockfile/lockfile-io.js +17 -3
  31. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  32. package/dist/esm/lockfile/materialize-infra-section.d.ts +27 -6
  33. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  34. package/dist/esm/lockfile/materialize-infra-section.js +23 -10
  35. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  36. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +455 -6
  37. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  38. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +27 -0
  39. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  40. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts +13 -0
  41. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -0
  42. package/dist/esm/project-config/application-public-pricing-catalog.loader.js +56 -0
  43. package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -0
  44. package/dist/esm/project-config/define-infra-env-config.d.ts +0 -27
  45. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  46. package/dist/esm/project-config/define-infra-env-config.js +0 -2
  47. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  48. package/dist/esm/project-config/define-saas-config.d.ts +52 -0
  49. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  50. package/dist/esm/project-config/define-saas-config.js +65 -15
  51. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  52. package/dist/esm/project-config/index.d.ts +3 -0
  53. package/dist/esm/project-config/index.d.ts.map +1 -1
  54. package/dist/esm/project-config/index.js +3 -0
  55. package/dist/esm/project-config/index.js.map +1 -1
  56. package/dist/esm/project-config/loader.d.ts +11 -0
  57. package/dist/esm/project-config/loader.d.ts.map +1 -1
  58. package/dist/esm/project-config/loader.js +34 -7
  59. package/dist/esm/project-config/loader.js.map +1 -1
  60. package/dist/esm/project-config/npm-version-range.d.ts +23 -0
  61. package/dist/esm/project-config/npm-version-range.d.ts.map +1 -0
  62. package/dist/esm/project-config/npm-version-range.js +175 -0
  63. package/dist/esm/project-config/npm-version-range.js.map +1 -0
  64. package/dist/esm/project-config/provider-companion-discovery.d.ts +256 -30
  65. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  66. package/dist/esm/project-config/provider-companion-discovery.js +719 -40
  67. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  68. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +125 -2
  69. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  70. package/dist/esm/project-config/provider-runtime-artifacts.js +283 -66
  71. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  72. package/dist/esm/project-config/shared/backing-service-servability.d.ts +157 -0
  73. package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -0
  74. package/dist/esm/project-config/shared/backing-service-servability.js +256 -0
  75. package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -0
  76. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +62 -67
  77. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  78. package/dist/esm/project-config/shared/backing-services.schemas.js +71 -68
  79. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  80. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  81. package/dist/esm/project-config/shared/csp-emit.js +41 -2
  82. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  83. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +180 -4
  84. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  85. package/dist/esm/project-config/shared/infra-providers.schemas.js +40 -0
  86. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  87. package/dist/esm/project-config/static-asset-import-noop.d.ts +26 -0
  88. package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -0
  89. package/dist/esm/project-config/static-asset-import-noop.js +49 -0
  90. package/dist/esm/project-config/static-asset-import-noop.js.map +1 -0
  91. package/dist/esm/registry/companion-api.schemas.d.ts +0 -176
  92. package/dist/esm/registry/companion-api.schemas.d.ts.map +0 -1
  93. package/dist/esm/registry/companion-api.schemas.js.map +0 -1
  94. package/dist/esm/registry/index.d.ts +3 -1
  95. package/dist/esm/registry/index.d.ts.map +1 -1
  96. package/dist/esm/registry/index.js +3 -1
  97. package/dist/esm/registry/index.js.map +1 -1
  98. package/dist/esm/registry/local-checkout-source.d.ts +31 -0
  99. package/dist/esm/registry/local-checkout-source.d.ts.map +1 -0
  100. package/dist/esm/registry/local-checkout-source.js +45 -0
  101. package/dist/esm/registry/local-checkout-source.js.map +1 -0
  102. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +174 -14
  103. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  104. package/dist/esm/registry/lockfile-modules-section.schemas.js +120 -11
  105. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
  106. package/dist/esm/registry/module-artifact.schemas.d.ts +79 -0
  107. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  108. package/dist/esm/registry/module-artifact.schemas.js +36 -0
  109. package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
  110. package/dist/esm/registry/module-manifest.schemas.d.ts +393 -7
  111. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  112. package/dist/esm/registry/module-manifest.schemas.js +488 -40
  113. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  114. package/dist/esm/registry/module-search.schemas.d.ts +80 -0
  115. package/dist/esm/registry/module-search.schemas.d.ts.map +1 -0
  116. package/dist/esm/registry/module-search.schemas.js +112 -0
  117. package/dist/esm/registry/module-search.schemas.js.map +1 -0
  118. package/dist/esm/registry/registry-config.schemas.d.ts +16 -0
  119. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  120. package/dist/esm/registry/registry-config.schemas.js +8 -0
  121. package/dist/esm/registry/registry-config.schemas.js.map +1 -1
  122. package/dist/esm/registry/registry-errors.d.ts +126 -2
  123. package/dist/esm/registry/registry-errors.d.ts.map +1 -1
  124. package/dist/esm/registry/registry-errors.js +183 -14
  125. package/dist/esm/registry/registry-errors.js.map +1 -1
  126. package/dist/esm/registry/registry-keys.schemas.d.ts +80 -0
  127. package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -0
  128. package/dist/esm/registry/registry-keys.schemas.js +68 -0
  129. package/dist/esm/registry/registry-keys.schemas.js.map +1 -0
  130. package/dist/esm/registry/registry-section-schemas.constants.d.ts +25 -3
  131. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  132. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +13 -11
  133. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  134. package/dist/esm/workspace-scope/workspace-homes.schemas.js +2 -2
  135. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  136. package/package.json +7 -7
  137. package/dist/esm/registry/companion-api.schemas.js +0 -165
  138. package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -30,6 +30,39 @@ const PROVIDER_CSP_BUCKET_DIRECTIVES = {
30
30
  [ProviderFrontendCspOriginBucket.IMG]: 'img-src',
31
31
  [ProviderFrontendCspOriginBucket.STYLE]: 'style-src',
32
32
  [ProviderFrontendCspOriginBucket.FONT]: 'font-src',
33
+ [ProviderFrontendCspOriginBucket.WORKER]: 'worker-src',
34
+ [ProviderFrontendCspOriginBucket.MEDIA]: 'media-src',
35
+ };
36
+ /**
37
+ * The directives a fetch falls back to when the directive a provider bucket maps to is ABSENT, most
38
+ * specific first and excluding the directive itself — CSP Level 3's fetch-directive fallback list,
39
+ * restricted to the directives `PROVIDER_CSP_BUCKET_DIRECTIVES` can write.
40
+ *
41
+ * spec-cite: CSP Level 3 (W3C Working Draft) §6.8.3 "Get fetch directive fallback list" —
42
+ * https://www.w3.org/TR/CSP3/#directive-fallback-list. `script-src` and `style-src` are not keys of that
43
+ * algorithm; they are the second step of the `-elem`/`-attr` chains, whose next step is `default-src`.
44
+ * The algorithm also puts `child-src` before `script-src` for workers and before `default-src` for
45
+ * frames; it is omitted here because `CSP_DIRECTIVE_NAMES` does not admit it, so a composed policy can
46
+ * never state it and that step can never be the one in force.
47
+ *
48
+ * ## Why the provider layer needs it (#1702)
49
+ *
50
+ * Adding a source list for a directive the policy does not state does not ADD to what the page may do —
51
+ * it REPLACES the fallback that was governing it. None of the three baselines states `worker-src` or
52
+ * `media-src`, so a provider declaring `workerOrigins: ['blob:']` would otherwise have produced
53
+ * `worker-src blob:` and silently revoked the page's own `'self'` workers, which `default-src 'self'` had
54
+ * been admitting. Seeding the new directive from the list it was falling back to keeps the provider layer
55
+ * additive, which is its whole contract. The same was already true, and latent, for `frame-src`.
56
+ */
57
+ const PROVIDER_CSP_DIRECTIVE_FALLBACKS = {
58
+ 'script-src': ['default-src'],
59
+ 'connect-src': ['default-src'],
60
+ 'frame-src': ['default-src'],
61
+ 'img-src': ['default-src'],
62
+ 'style-src': ['default-src'],
63
+ 'font-src': ['default-src'],
64
+ 'worker-src': ['script-src', 'default-src'],
65
+ 'media-src': ['default-src'],
33
66
  };
34
67
  export const NGINX_CSP_BEGIN_MARKER = '# >>> wildo csp begin';
35
68
  export const NGINX_CSP_END_MARKER = '# <<< wildo csp end';
@@ -167,10 +200,16 @@ export function resolveCspPolicy(input) {
167
200
  const out = { ...merged };
168
201
  for (const footprint of providerFootprints) {
169
202
  for (const [bucket, directive] of Object.entries(PROVIDER_CSP_BUCKET_DIRECTIVES)) {
170
- const origins = footprint[bucket];
203
+ // `?? []`: a footprint read off an artifact older than a bucket lacks the key.
204
+ const origins = footprint[bucket] ?? [];
171
205
  if (origins.length === 0)
172
206
  continue;
173
- out[directive] = mergeSourceLists(out[directive], origins);
207
+ // An absent directive is seeded from the one it was falling back to, so adding a provider's
208
+ // origin never REVOKES what the fallback admitted — see `PROVIDER_CSP_DIRECTIVE_FALLBACKS`.
209
+ const current = out[directive] ?? PROVIDER_CSP_DIRECTIVE_FALLBACKS[directive]
210
+ .map((fallback) => out[fallback])
211
+ .find((sources) => sources !== undefined);
212
+ out[directive] = mergeSourceLists(current, origins);
174
213
  }
175
214
  }
176
215
  merged = out;
@@ -1 +1 @@
1
- {"version":3,"file":"csp-emit.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp-emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,eAAe,EACf,+BAA+B,GAEhC,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,aAAa,GAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,GAIjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA2BzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,8BAA8B,GAEhC;IACF,CAAC,+BAA+B,CAAC,MAAM,CAAC,EAAE,YAAY;IACtD,CAAC,+BAA+B,CAAC,OAAO,CAAC,EAAE,aAAa;IACxD,CAAC,+BAA+B,CAAC,KAAK,CAAC,EAAE,WAAW;IACpD,CAAC,+BAA+B,CAAC,GAAG,CAAC,EAAE,SAAS;IAChD,CAAC,+BAA+B,CAAC,KAAK,CAAC,EAAE,WAAW;IACpD,CAAC,+BAA+B,CAAC,IAAI,CAAC,EAAE,UAAU;CACnD,CAAC;AAyCF,MAAM,CAAC,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAE1D,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC;IAC3D,iBAAiB;IACjB,YAAY;IAC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C,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\nimport {\n AppFrontendType,\n ProviderFrontendCspOriginBucket,\n type ProviderFrontendCspFootprint,\n} from '@wildo-ai/saas-models/public-runtime';\n\nimport {\n CSP_BASELINES,\n type CspBaselineDirectiveMap,\n} from './csp-defaults';\nimport {\n CspMergeStrategy,\n type CspDirectiveName,\n type EnvCspOverride,\n type WildoCspConfig,\n} from './csp.schemas';\nimport { WildoEnvironment } from './environment.schemas';\n\nexport type ResolvedCspDirectiveMap = Readonly<\n Partial<Record<CspDirectiveName, readonly string[]>>\n>;\n\nexport interface ResolvedCspPolicy {\n readonly directives: ResolvedCspDirectiveMap;\n readonly reportOnly: boolean;\n readonly reportUri: string | undefined;\n}\n\nexport interface CspEmitArtifacts {\n readonly nginxHeaderName: string;\n readonly nginxPolicyValue: string;\n readonly nginxAddHeaderLine: string;\n readonly metaTag:\n | {\n readonly tagName: 'meta';\n readonly attributes: {\n readonly 'http-equiv': string;\n readonly content: string;\n };\n }\n | null;\n}\n\n/**\n * Where each of a provider's declared origin buckets lands in the policy.\n *\n * THE ONE PLACE the mapping exists. A provider declares what it is REACHING\n * — a script it loads, an API it calls, an iframe it embeds — and which\n * directive grades that fetch is framework knowledge, so a provider author\n * never has to learn the CSP directive taxonomy and a change to it is a change\n * here rather than in every provider package.\n *\n * The bucket names are also why `ProviderFrontendCspFootprint` does not restate\n * `CSP_DIRECTIVE_NAMES`: that vocabulary already has one named source, in this\n * package, and `@wildo-ai/saas-models` — where the footprint has to live,\n * because it rides on the wire — depends on nothing of ours.\n *\n * Total over the footprint's buckets: adding a bucket without deciding its\n * directive is a compile error here, which is the coupling this shape exists\n * for. A bucket with no mapping would be authored, serialized, read, and\n * silently contribute nothing — in production only, since CSP is report-only\n * in development.\n */\nconst PROVIDER_CSP_BUCKET_DIRECTIVES: Readonly<\n Record<ProviderFrontendCspOriginBucket, CspDirectiveName>\n> = {\n [ProviderFrontendCspOriginBucket.SCRIPT]: 'script-src',\n [ProviderFrontendCspOriginBucket.CONNECT]: 'connect-src',\n [ProviderFrontendCspOriginBucket.FRAME]: 'frame-src',\n [ProviderFrontendCspOriginBucket.IMG]: 'img-src',\n [ProviderFrontendCspOriginBucket.STYLE]: 'style-src',\n [ProviderFrontendCspOriginBucket.FONT]: 'font-src',\n};\n\nexport interface ResolveCspPolicyInput {\n readonly frontendType: AppFrontendType;\n readonly appCsp: WildoCspConfig | undefined;\n readonly envOverride?: EnvCspOverride;\n /**\n * The CSP footprints of the providers DECLARED for this service — the fourth\n * layer, added by #332.\n *\n * Without it, a marketing site that wants an embedded meeting or a SaaS app\n * that wants a Drive picker means hand-editing script / frame / connect\n * origins per application, per service, per environment; and getting it wrong\n * is invisible until production, because development is report-only. The\n * caller reads these from the service's materialized provider block, which is\n * DATA precisely so that no frontend module has to be executed to obtain them.\n *\n * Providers declared for ANOTHER service must not appear here: the point of\n * the layer is that a Zoom origin admitted for the marketing site is not\n * thereby admitted for the SaaS app.\n *\n * A footprint's `derivedOrigins` must ALREADY BE RESOLVED into its buckets by\n * the caller. This resolver sees no `publicConfig` — it composes a policy, it\n * does not read a provider's configuration — and the one caller that has both\n * halves is `CspSyncService`, which reads each entry out of the materialized\n * block.\n */\n readonly providerCspFootprints?: ReadonlyArray<ProviderFrontendCspFootprint>;\n /**\n * Environment id this CSP is being resolved for (e.g. `'local'`,\n * `'staging'`, `'production'`, or any custom slug). Optional for\n * back-compat — when `undefined`, no env-aware auto-loosening applies\n * (the resolver behaves exactly as it did pre-`viteDevLoosening`).\n *\n * Required when the caller wants the framework to auto-apply\n * `viteDevLoosening` for `'local'` + `SAAS_APP`. The CLI's\n * `CspSyncService` already knows the env id and SHOULD pass it.\n */\n readonly environmentId?: string;\n}\n\nexport const NGINX_CSP_BEGIN_MARKER = '# >>> wildo csp begin';\nexport const NGINX_CSP_END_MARKER = '# <<< wildo csp end';\n\nconst META_INVALID_DIRECTIVES: ReadonlySet<string> = new Set([\n 'frame-ancestors',\n 'report-uri',\n 'report-to',\n 'sandbox',\n]);\n\n/**\n * Derives the WebSocket-scheme companion origins for every HTTP(S) origin\n * present in a `connect-src` source list, and returns the list widened to\n * include them.\n *\n * Why the framework ships this rather than making each app author it:\n * every Wildo backend serves its realtime channel (Socket.IO) on the SAME\n * origin as its HTTP API. Socket.IO opens the handshake over polling and\n * then UPGRADES to a raw `ws://` / `wss://` connection to that origin. The\n * CSP `connect-src` directive grades WebSocket connections by their `ws`/\n * `wss` scheme, and — per the CSP spec — an `http://host` source does NOT\n * authorize a `ws://host` connection (the schemes are distinct match\n * tokens). So an app that allow-lists `http://localhost:4241` for `fetch`/\n * `XHR` but not `ws://localhost:4241` will emit a `connect-src` violation\n * the instant the socket upgrades — exactly the trap every infra config\n * would otherwise have to remember to work around by hand.\n *\n * Transform (idempotent, dedupe-safe):\n * `http://host[:port]` → also allow `ws://host[:port]`\n * `https://host[:port]` → also allow `wss://host[:port]`\n * bare scheme `http:` → also allow `ws:`\n * bare scheme `https:` → also allow `wss:`\n *\n * Keyword / non-HTTP sources (`'self'`, `'none'`, `data:`, `blob:`, an\n * already-`ws://` origin, …) are passed through untouched. `'self'` is\n * deliberately NOT expanded: the browser tab is served from the frontend\n * origin, never the backend API origin, so a same-origin `ws` derivation\n * from `'self'` would authorize the wrong host. The backend origin is\n * always listed explicitly, which is what this widens.\n */\nfunction augmentConnectSrcWithWebSocketOrigins(\n sources: readonly string[] | undefined,\n): readonly string[] | undefined {\n if (!sources || sources.length === 0) {\n return sources;\n }\n\n const derived: string[] = [];\n for (const source of sources) {\n if (source.startsWith('https://')) {\n derived.push(`wss://${source.slice('https://'.length)}`);\n } else if (source.startsWith('http://')) {\n derived.push(`ws://${source.slice('http://'.length)}`);\n } else if (source === 'https:') {\n derived.push('wss:');\n } else if (source === 'http:') {\n derived.push('ws:');\n }\n }\n\n return mergeSourceLists(sources, derived);\n}\n\nfunction mergeSourceLists(\n a: readonly string[] | undefined,\n b: readonly string[] | undefined,\n): readonly string[] {\n if (!a || a.length === 0) {\n return b ?? [];\n }\n if (!b || b.length === 0) {\n return a;\n }\n\n const seen = new Set(a);\n const out: string[] = [...a];\n for (const source of b) {\n if (!seen.has(source)) {\n seen.add(source);\n out.push(source);\n }\n }\n return out;\n}\n\n/**\n * Resolves the generic layered CSP model shared by all frontend surfaces:\n * platform baseline, app-static config, env-selected overrides, then the\n * declared providers' own footprints (#332).\n *\n * The provider layer is fourth on purpose. The first three describe what the\n * APPLICATION decided; the fourth describes what the things the application\n * declared actually need in order to work. Placing it last means a provider\n * cannot be silently dropped by an app-level `REPLACE_BASELINE`, and placing it\n * before the WebSocket derivation means a provider's `connect-src` origin gets\n * its `wss://` companion exactly like the backend API's.\n *\n * This lives with the CSP schemas/defaults so consumers do not depend on any\n * concrete frontend package to process security config.\n */\nexport function resolveCspPolicy(\n input: ResolveCspPolicyInput,\n): ResolvedCspPolicy | null {\n const { frontendType, appCsp, envOverride } = input;\n\n if (!appCsp || !appCsp.enabled) {\n return null;\n }\n\n const baseline: CspBaselineDirectiveMap = CSP_BASELINES[frontendType];\n let merged: ResolvedCspDirectiveMap;\n\n if (appCsp.mergeStrategy === CspMergeStrategy.REPLACE_BASELINE) {\n merged = appCsp.directives;\n } else {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {};\n const allKeys = new Set<CspDirectiveName>([\n ...(Object.keys(baseline) as CspDirectiveName[]),\n ...(Object.keys(appCsp.directives) as CspDirectiveName[]),\n ]);\n\n for (const key of allKeys) {\n out[key] = mergeSourceLists(baseline[key], appCsp.directives[key]);\n }\n\n merged = out;\n }\n\n if (envOverride?.extraDirectives) {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {\n ...merged,\n };\n\n for (const key of Object.keys(envOverride.extraDirectives) as CspDirectiveName[]) {\n out[key] = mergeSourceLists(merged[key], envOverride.extraDirectives[key]);\n }\n\n merged = out;\n }\n\n // Provider layer (#332) — the origins the providers DECLARED FOR THIS SERVICE\n // need, merged after the app-static and env layers and before the WebSocket\n // derivation below (so a provider's `connect-src` origin gets its `wss://`\n // companion for free, exactly like the backend API's).\n //\n // Additive in every merge strategy, including REPLACE_BASELINE. That strategy\n // exists so an app can discard the platform BASELINE when it is wrong for the\n // surface; a provider the same app declared is a dependency it chose, not a\n // default it is overriding, and silently dropping its origins would produce a\n // policy that blocks a feature the app asked for — in production only.\n const providerFootprints = input.providerCspFootprints ?? [];\n if (providerFootprints.length > 0) {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = { ...merged };\n\n for (const footprint of providerFootprints) {\n for (const [bucket, directive] of Object.entries(PROVIDER_CSP_BUCKET_DIRECTIVES) as ReadonlyArray<\n readonly [ProviderFrontendCspOriginBucket, CspDirectiveName]\n >) {\n const origins = footprint[bucket];\n if (origins.length === 0) continue;\n out[directive] = mergeSourceLists(out[directive], origins);\n }\n }\n\n merged = out;\n }\n\n // Vite dev-mode loosening (auto-applied for local SAAS_APP).\n //\n // Vite's dev server REQUIRES both `'unsafe-eval'` (lazy module +\n // sourcemap transforms) and `'unsafe-inline'` (HMR client bootstrap\n // injects a literal inline `<script>`) to function. Under the tight\n // SAAS_APP baseline (`script-src 'self'`), those produce ~120+ CSP\n // violations per page load that drown out real signal (e.g. the\n // Google-Fonts gotcha that the loosened style-src/font-src now allow).\n //\n // The framework SHIPS this knowledge — every Wildo SaaS app uses\n // Vite — so we auto-loosen for `'local'` + `SAAS_APP` here rather\n // than forcing every infra config to re-author the same opt-in. An\n // explicit `viteDevLoosening: false` override keeps tight `script-src`\n // when an author is actively debugging a real CSP issue and willing\n // to accept the Vite noise. Production builds emit `<script\n // type=\"module\">` only and never `eval()`, so production envs never\n // trigger the auto-loosening — `viteDevLoosening` defaults to FALSE\n // there even if the env id is non-`local`.\n const isViteDevAutoTarget =\n input.environmentId === WildoEnvironment.LOCAL &&\n frontendType === AppFrontendType.SAAS_APP;\n const viteDevLoosening = envOverride?.viteDevLoosening ?? isViteDevAutoTarget;\n if (viteDevLoosening) {\n merged = {\n ...merged,\n 'script-src': mergeSourceLists(\n merged['script-src'],\n [\"'unsafe-inline'\", \"'unsafe-eval'\"],\n ),\n };\n }\n\n // Auto-derive the `ws://` / `wss://` companion origins for every HTTP(S)\n // origin the app allow-listed in `connect-src`. Applied LAST so it covers\n // origins contributed by the baseline, app-static config, AND env override\n // alike (e.g. the local `http://localhost:4241` and the staging/prod\n // `https://api.<app>.wildo.app` backend origins). Without this, the\n // Socket.IO transport upgrade to a raw WebSocket against the backend origin\n // trips a `connect-src` violation on every surface. See the helper JSDoc for\n // the scheme-matching rationale.\n const connectSrcWithWs = augmentConnectSrcWithWebSocketOrigins(merged['connect-src']);\n if (connectSrcWithWs !== merged['connect-src']) {\n merged = {\n ...merged,\n 'connect-src': connectSrcWithWs,\n };\n }\n\n return {\n directives: merged,\n reportOnly: envOverride?.reportOnly ?? appCsp.reportOnly,\n reportUri: envOverride?.reportUri ?? appCsp.reportUri,\n };\n}\n\nfunction serializeDirectives(directives: ResolvedCspDirectiveMap): string {\n return Object.entries(directives)\n .filter(([, sources]) => sources && sources.length > 0)\n .map(([name, sources]) => `${name} ${(sources ?? []).join(' ')}`)\n .join('; ');\n}\n\nfunction stripMetaInvalidDirectives(\n directives: ResolvedCspDirectiveMap,\n): ResolvedCspDirectiveMap {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {};\n\n for (const [name, sources] of Object.entries(directives)) {\n if (!META_INVALID_DIRECTIVES.has(name)) {\n out[name as CspDirectiveName] = sources;\n }\n }\n\n return out;\n}\n\nfunction withReportUri(\n directives: ResolvedCspDirectiveMap,\n reportUri: string | undefined,\n): ResolvedCspDirectiveMap {\n if (!reportUri) {\n return directives;\n }\n\n return {\n ...directives,\n ['report-uri' as CspDirectiveName]: [reportUri],\n };\n}\n\nexport function emitCspArtifacts(policy: ResolvedCspPolicy): CspEmitArtifacts {\n const nginxHeaderName = policy.reportOnly\n ? 'Content-Security-Policy-Report-Only'\n : 'Content-Security-Policy';\n const nginxPolicyValue = serializeDirectives(\n withReportUri(policy.directives, policy.reportUri),\n );\n\n return {\n nginxHeaderName,\n nginxPolicyValue,\n nginxAddHeaderLine: `add_header ${nginxHeaderName} \"${nginxPolicyValue}\" always;`,\n metaTag: policy.reportOnly\n ? null\n : {\n tagName: 'meta',\n attributes: {\n 'http-equiv': 'Content-Security-Policy',\n content: serializeDirectives(stripMetaInvalidDirectives(policy.directives)),\n },\n },\n };\n}\n\n/**\n * A single static-host `_headers` block that delivers the resolved CSP as a\n * real response header at the `/*` (all-paths) scope.\n *\n * Format matches the `_headers` convention consumed by Cloudflare Pages /\n * Netlify / Vercel (and the `saas-website` `X-Robots-Tag` `_headers` emitter):\n * a path line, then two-space-indented `Header-Name: value` lines. This is the\n * PORTABLE, provider-agnostic edge-CSP delivery — a CDN-served frontend (which\n * has no nginx to `add_header`) ships this file in its bucket and any\n * `_headers`-aware host applies it.\n *\n * Uses the FULL header value (including the header-only `frame-ancestors` and\n * `report-uri` directives) — a `_headers` line is a genuine response header, so\n * nothing is stripped (unlike the `<meta http-equiv>` fallback). Report-only\n * policies are honoured (the header name flips to\n * `Content-Security-Policy-Report-Only`, valid on a real header channel).\n *\n * The caller composes this block with any other `_headers` blocks (e.g. the\n * website's per-path `X-Robots-Tag`) into one file, separated by a blank line.\n */\nexport function emitCspHeadersFileBlock(policy: ResolvedCspPolicy): string {\n const { nginxHeaderName, nginxPolicyValue } = emitCspArtifacts(policy);\n return `/*\\n ${nginxHeaderName}: ${nginxPolicyValue}`;\n}\n\n/**\n * Provider-agnostic descriptor of the response-header MODIFICATION a CDN vendor\n * must install to deliver the resolved CSP at the edge. A concrete vendor\n * adapter (e.g. Cloudflare) maps this to its own API shape — for Cloudflare, a\n * `http_response_headers_transform` ruleset rule whose action sets\n * `headerName` to `value`.\n *\n * Same FULL header name + value as the nginx / `_headers` channels (a CDN sets\n * a real header, so `frame-ancestors` / `report-uri` are valid and retained).\n */\nexport interface CspEdgeHeaderModification {\n /** Cloudflare ruleset phase this modification belongs to. */\n readonly phase: 'http_response_headers_transform';\n /** The header operation — always `set` (overwrite any origin value). */\n readonly operation: 'set';\n /** Response-header name (report-only-aware, same as the nginx channel). */\n readonly headerName: string;\n /** Serialized policy value (identical to `nginxPolicyValue`). */\n readonly value: string;\n}\n\n/**\n * Derive the edge response-header modification carrying the resolved CSP, for a\n * CDN vendor's live-provisioning adapter to install. Thin over\n * {@link emitCspArtifacts} so the directive serialization is the single source\n * of truth across nginx / `_headers` / CDN channels.\n */\nexport function emitCspEdgeHeaderModification(policy: ResolvedCspPolicy): CspEdgeHeaderModification {\n const { nginxHeaderName, nginxPolicyValue } = emitCspArtifacts(policy);\n return {\n phase: 'http_response_headers_transform',\n operation: 'set',\n headerName: nginxHeaderName,\n value: nginxPolicyValue,\n };\n}\n\nexport interface RewriteNginxResult {\n readonly totalPairs: number;\n readonly pairsRewritten: number;\n readonly fileWritten: boolean;\n}\n\nexport function rewriteNginxCspMarkerPairs(\n filePath: string,\n addHeaderLine: string,\n): RewriteNginxResult {\n const original = readFileSync(filePath, 'utf-8');\n const { rewritten, totalPairs, pairsChanged } = rewriteNginxCspMarkerPairsString(\n original,\n addHeaderLine,\n filePath,\n );\n const fileWritten = rewritten !== original;\n\n if (fileWritten) {\n writeFileSync(filePath, rewritten, 'utf-8');\n }\n\n return {\n totalPairs,\n pairsRewritten: pairsChanged,\n fileWritten,\n };\n}\n\nexport function rewriteNginxCspMarkerPairsString(\n source: string,\n addHeaderLine: string,\n filePath = '<in-memory>',\n): {\n readonly rewritten: string;\n readonly totalPairs: number;\n readonly pairsChanged: number;\n} {\n const usesCrlf = source.includes('\\r\\n');\n const newline = usesCrlf ? '\\r\\n' : '\\n';\n const lines = source.split(newline);\n\n let totalPairs = 0;\n let pairsChanged = 0;\n let openBeginIndex: number | null = null;\n let openIndent = '';\n\n for (let index = 0; index < lines.length; index += 1) {\n const trimmed = lines[index].trim();\n\n if (trimmed === NGINX_CSP_BEGIN_MARKER) {\n if (openBeginIndex !== null) {\n throw new Error(\n `[csp-emit] ${filePath}:${index + 1} found a second '${NGINX_CSP_BEGIN_MARKER}' before the previous '${NGINX_CSP_END_MARKER}' (line ${openBeginIndex + 1})`,\n );\n }\n\n openBeginIndex = index;\n openIndent = lines[index].slice(0, lines[index].indexOf('#'));\n continue;\n }\n\n if (trimmed === NGINX_CSP_END_MARKER) {\n if (openBeginIndex === null) {\n throw new Error(\n `[csp-emit] ${filePath}:${index + 1} found '${NGINX_CSP_END_MARKER}' without a matching '${NGINX_CSP_BEGIN_MARKER}'`,\n );\n }\n\n totalPairs += 1;\n\n const existingBody = lines.slice(openBeginIndex + 1, index);\n const canonicalBody = [`${openIndent}${addHeaderLine}`];\n const existingNonBlank = existingBody.filter((line) => line.trim().length > 0);\n const canonicalNonBlank = canonicalBody.filter((line) => line.trim().length > 0);\n const bodyMatches =\n existingNonBlank.length === canonicalNonBlank.length &&\n existingNonBlank.every((line, bodyIndex) => line === canonicalNonBlank[bodyIndex]);\n\n if (!bodyMatches) {\n lines.splice(openBeginIndex + 1, index - openBeginIndex - 1, ...canonicalBody);\n index = openBeginIndex + canonicalBody.length + 1;\n pairsChanged += 1;\n }\n\n openBeginIndex = null;\n openIndent = '';\n }\n }\n\n if (openBeginIndex !== null) {\n throw new Error(\n `[csp-emit] ${filePath} has an unclosed '${NGINX_CSP_BEGIN_MARKER}' starting at line ${openBeginIndex + 1}`,\n );\n }\n\n return { rewritten: lines.join(newline), totalPairs, pairsChanged };\n}\n"]}
1
+ {"version":3,"file":"csp-emit.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp-emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,eAAe,EACf,+BAA+B,GAEhC,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,aAAa,GAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,GAIjB,MAAM,eAAe,CAA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,KAAK,CACb,cAAc,QAAQ,qBAAqB,sBAAsB,sBAAsB,cAAc,GAAG,CAAC,EAAE,CAC5G,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\nimport {\n AppFrontendType,\n ProviderFrontendCspOriginBucket,\n type ProviderFrontendCspFootprint,\n} from '@wildo-ai/saas-models/public-runtime';\n\nimport {\n CSP_BASELINES,\n type CspBaselineDirectiveMap,\n} from './csp-defaults';\nimport {\n CspMergeStrategy,\n type CspDirectiveName,\n type EnvCspOverride,\n type WildoCspConfig,\n} from './csp.schemas';\nimport { WildoEnvironment } from './environment.schemas';\n\nexport type ResolvedCspDirectiveMap = Readonly<\n Partial<Record<CspDirectiveName, readonly string[]>>\n>;\n\nexport interface ResolvedCspPolicy {\n readonly directives: ResolvedCspDirectiveMap;\n readonly reportOnly: boolean;\n readonly reportUri: string | undefined;\n}\n\nexport interface CspEmitArtifacts {\n readonly nginxHeaderName: string;\n readonly nginxPolicyValue: string;\n readonly nginxAddHeaderLine: string;\n readonly metaTag:\n | {\n readonly tagName: 'meta';\n readonly attributes: {\n readonly 'http-equiv': string;\n readonly content: string;\n };\n }\n | null;\n}\n\n/**\n * Where each of a provider's declared origin buckets lands in the policy.\n *\n * THE ONE PLACE the mapping exists. A provider declares what it is REACHING\n * — a script it loads, an API it calls, an iframe it embeds — and which\n * directive grades that fetch is framework knowledge, so a provider author\n * never has to learn the CSP directive taxonomy and a change to it is a change\n * here rather than in every provider package.\n *\n * The bucket names are also why `ProviderFrontendCspFootprint` does not restate\n * `CSP_DIRECTIVE_NAMES`: that vocabulary already has one named source, in this\n * package, and `@wildo-ai/saas-models` — where the footprint has to live,\n * because it rides on the wire — depends on nothing of ours.\n *\n * Total over the footprint's buckets: adding a bucket without deciding its\n * directive is a compile error here, which is the coupling this shape exists\n * for. A bucket with no mapping would be authored, serialized, read, and\n * silently contribute nothing — in production only, since CSP is report-only\n * in development.\n */\nconst PROVIDER_CSP_BUCKET_DIRECTIVES = {\n [ProviderFrontendCspOriginBucket.SCRIPT]: 'script-src',\n [ProviderFrontendCspOriginBucket.CONNECT]: 'connect-src',\n [ProviderFrontendCspOriginBucket.FRAME]: 'frame-src',\n [ProviderFrontendCspOriginBucket.IMG]: 'img-src',\n [ProviderFrontendCspOriginBucket.STYLE]: 'style-src',\n [ProviderFrontendCspOriginBucket.FONT]: 'font-src',\n [ProviderFrontendCspOriginBucket.WORKER]: 'worker-src',\n [ProviderFrontendCspOriginBucket.MEDIA]: 'media-src',\n} as const satisfies Readonly<Record<ProviderFrontendCspOriginBucket, CspDirectiveName>>;\n\n/** The directives a provider bucket can write — the keys `PROVIDER_CSP_DIRECTIVE_FALLBACKS` must be total over. */\ntype ProviderWritableCspDirective = (typeof PROVIDER_CSP_BUCKET_DIRECTIVES)[ProviderFrontendCspOriginBucket];\n\n/**\n * The directives a fetch falls back to when the directive a provider bucket maps to is ABSENT, most\n * specific first and excluding the directive itself — CSP Level 3's fetch-directive fallback list,\n * restricted to the directives `PROVIDER_CSP_BUCKET_DIRECTIVES` can write.\n *\n * spec-cite: CSP Level 3 (W3C Working Draft) §6.8.3 \"Get fetch directive fallback list\" —\n * https://www.w3.org/TR/CSP3/#directive-fallback-list. `script-src` and `style-src` are not keys of that\n * algorithm; they are the second step of the `-elem`/`-attr` chains, whose next step is `default-src`.\n * The algorithm also puts `child-src` before `script-src` for workers and before `default-src` for\n * frames; it is omitted here because `CSP_DIRECTIVE_NAMES` does not admit it, so a composed policy can\n * never state it and that step can never be the one in force.\n *\n * ## Why the provider layer needs it (#1702)\n *\n * Adding a source list for a directive the policy does not state does not ADD to what the page may do —\n * it REPLACES the fallback that was governing it. None of the three baselines states `worker-src` or\n * `media-src`, so a provider declaring `workerOrigins: ['blob:']` would otherwise have produced\n * `worker-src blob:` and silently revoked the page's own `'self'` workers, which `default-src 'self'` had\n * been admitting. Seeding the new directive from the list it was falling back to keeps the provider layer\n * additive, which is its whole contract. The same was already true, and latent, for `frame-src`.\n */\nconst PROVIDER_CSP_DIRECTIVE_FALLBACKS: Readonly<Record<ProviderWritableCspDirective, readonly CspDirectiveName[]>> = {\n 'script-src': ['default-src'],\n 'connect-src': ['default-src'],\n 'frame-src': ['default-src'],\n 'img-src': ['default-src'],\n 'style-src': ['default-src'],\n 'font-src': ['default-src'],\n 'worker-src': ['script-src', 'default-src'],\n 'media-src': ['default-src'],\n};\n\nexport interface ResolveCspPolicyInput {\n readonly frontendType: AppFrontendType;\n readonly appCsp: WildoCspConfig | undefined;\n readonly envOverride?: EnvCspOverride;\n /**\n * The CSP footprints of the providers DECLARED for this service — the fourth\n * layer, added by #332.\n *\n * Without it, a marketing site that wants an embedded meeting or a SaaS app\n * that wants a Drive picker means hand-editing script / frame / connect\n * origins per application, per service, per environment; and getting it wrong\n * is invisible until production, because development is report-only. The\n * caller reads these from the service's materialized provider block, which is\n * DATA precisely so that no frontend module has to be executed to obtain them.\n *\n * Providers declared for ANOTHER service must not appear here: the point of\n * the layer is that a Zoom origin admitted for the marketing site is not\n * thereby admitted for the SaaS app.\n *\n * A footprint's `derivedOrigins` must ALREADY BE RESOLVED into its buckets by\n * the caller. This resolver sees no `publicConfig` — it composes a policy, it\n * does not read a provider's configuration — and the one caller that has both\n * halves is `CspSyncService`, which reads each entry out of the materialized\n * block.\n */\n readonly providerCspFootprints?: ReadonlyArray<ProviderFrontendCspFootprint>;\n /**\n * Environment id this CSP is being resolved for (e.g. `'local'`,\n * `'staging'`, `'production'`, or any custom slug). Optional for\n * back-compat — when `undefined`, no env-aware auto-loosening applies\n * (the resolver behaves exactly as it did pre-`viteDevLoosening`).\n *\n * Required when the caller wants the framework to auto-apply\n * `viteDevLoosening` for `'local'` + `SAAS_APP`. The CLI's\n * `CspSyncService` already knows the env id and SHOULD pass it.\n */\n readonly environmentId?: string;\n}\n\nexport const NGINX_CSP_BEGIN_MARKER = '# >>> wildo csp begin';\nexport const NGINX_CSP_END_MARKER = '# <<< wildo csp end';\n\nconst META_INVALID_DIRECTIVES: ReadonlySet<string> = new Set([\n 'frame-ancestors',\n 'report-uri',\n 'report-to',\n 'sandbox',\n]);\n\n/**\n * Derives the WebSocket-scheme companion origins for every HTTP(S) origin\n * present in a `connect-src` source list, and returns the list widened to\n * include them.\n *\n * Why the framework ships this rather than making each app author it:\n * every Wildo backend serves its realtime channel (Socket.IO) on the SAME\n * origin as its HTTP API. Socket.IO opens the handshake over polling and\n * then UPGRADES to a raw `ws://` / `wss://` connection to that origin. The\n * CSP `connect-src` directive grades WebSocket connections by their `ws`/\n * `wss` scheme, and — per the CSP spec — an `http://host` source does NOT\n * authorize a `ws://host` connection (the schemes are distinct match\n * tokens). So an app that allow-lists `http://localhost:4241` for `fetch`/\n * `XHR` but not `ws://localhost:4241` will emit a `connect-src` violation\n * the instant the socket upgrades — exactly the trap every infra config\n * would otherwise have to remember to work around by hand.\n *\n * Transform (idempotent, dedupe-safe):\n * `http://host[:port]` → also allow `ws://host[:port]`\n * `https://host[:port]` → also allow `wss://host[:port]`\n * bare scheme `http:` → also allow `ws:`\n * bare scheme `https:` → also allow `wss:`\n *\n * Keyword / non-HTTP sources (`'self'`, `'none'`, `data:`, `blob:`, an\n * already-`ws://` origin, …) are passed through untouched. `'self'` is\n * deliberately NOT expanded: the browser tab is served from the frontend\n * origin, never the backend API origin, so a same-origin `ws` derivation\n * from `'self'` would authorize the wrong host. The backend origin is\n * always listed explicitly, which is what this widens.\n */\nfunction augmentConnectSrcWithWebSocketOrigins(\n sources: readonly string[] | undefined,\n): readonly string[] | undefined {\n if (!sources || sources.length === 0) {\n return sources;\n }\n\n const derived: string[] = [];\n for (const source of sources) {\n if (source.startsWith('https://')) {\n derived.push(`wss://${source.slice('https://'.length)}`);\n } else if (source.startsWith('http://')) {\n derived.push(`ws://${source.slice('http://'.length)}`);\n } else if (source === 'https:') {\n derived.push('wss:');\n } else if (source === 'http:') {\n derived.push('ws:');\n }\n }\n\n return mergeSourceLists(sources, derived);\n}\n\nfunction mergeSourceLists(\n a: readonly string[] | undefined,\n b: readonly string[] | undefined,\n): readonly string[] {\n if (!a || a.length === 0) {\n return b ?? [];\n }\n if (!b || b.length === 0) {\n return a;\n }\n\n const seen = new Set(a);\n const out: string[] = [...a];\n for (const source of b) {\n if (!seen.has(source)) {\n seen.add(source);\n out.push(source);\n }\n }\n return out;\n}\n\n/**\n * Resolves the generic layered CSP model shared by all frontend surfaces:\n * platform baseline, app-static config, env-selected overrides, then the\n * declared providers' own footprints (#332).\n *\n * The provider layer is fourth on purpose. The first three describe what the\n * APPLICATION decided; the fourth describes what the things the application\n * declared actually need in order to work. Placing it last means a provider\n * cannot be silently dropped by an app-level `REPLACE_BASELINE`, and placing it\n * before the WebSocket derivation means a provider's `connect-src` origin gets\n * its `wss://` companion exactly like the backend API's.\n *\n * This lives with the CSP schemas/defaults so consumers do not depend on any\n * concrete frontend package to process security config.\n */\nexport function resolveCspPolicy(\n input: ResolveCspPolicyInput,\n): ResolvedCspPolicy | null {\n const { frontendType, appCsp, envOverride } = input;\n\n if (!appCsp || !appCsp.enabled) {\n return null;\n }\n\n const baseline: CspBaselineDirectiveMap = CSP_BASELINES[frontendType];\n let merged: ResolvedCspDirectiveMap;\n\n if (appCsp.mergeStrategy === CspMergeStrategy.REPLACE_BASELINE) {\n merged = appCsp.directives;\n } else {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {};\n const allKeys = new Set<CspDirectiveName>([\n ...(Object.keys(baseline) as CspDirectiveName[]),\n ...(Object.keys(appCsp.directives) as CspDirectiveName[]),\n ]);\n\n for (const key of allKeys) {\n out[key] = mergeSourceLists(baseline[key], appCsp.directives[key]);\n }\n\n merged = out;\n }\n\n if (envOverride?.extraDirectives) {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {\n ...merged,\n };\n\n for (const key of Object.keys(envOverride.extraDirectives) as CspDirectiveName[]) {\n out[key] = mergeSourceLists(merged[key], envOverride.extraDirectives[key]);\n }\n\n merged = out;\n }\n\n // Provider layer (#332) — the origins the providers DECLARED FOR THIS SERVICE\n // need, merged after the app-static and env layers and before the WebSocket\n // derivation below (so a provider's `connect-src` origin gets its `wss://`\n // companion for free, exactly like the backend API's).\n //\n // Additive in every merge strategy, including REPLACE_BASELINE. That strategy\n // exists so an app can discard the platform BASELINE when it is wrong for the\n // surface; a provider the same app declared is a dependency it chose, not a\n // default it is overriding, and silently dropping its origins would produce a\n // policy that blocks a feature the app asked for — in production only.\n const providerFootprints = input.providerCspFootprints ?? [];\n if (providerFootprints.length > 0) {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = { ...merged };\n\n for (const footprint of providerFootprints) {\n for (const [bucket, directive] of Object.entries(PROVIDER_CSP_BUCKET_DIRECTIVES) as ReadonlyArray<\n readonly [ProviderFrontendCspOriginBucket, ProviderWritableCspDirective]\n >) {\n // `?? []`: a footprint read off an artifact older than a bucket lacks the key.\n const origins = footprint[bucket] ?? [];\n if (origins.length === 0) continue;\n // An absent directive is seeded from the one it was falling back to, so adding a provider's\n // origin never REVOKES what the fallback admitted — see `PROVIDER_CSP_DIRECTIVE_FALLBACKS`.\n const current = out[directive] ?? PROVIDER_CSP_DIRECTIVE_FALLBACKS[directive]\n .map((fallback) => out[fallback])\n .find((sources) => sources !== undefined);\n out[directive] = mergeSourceLists(current, origins);\n }\n }\n\n merged = out;\n }\n\n // Vite dev-mode loosening (auto-applied for local SAAS_APP).\n //\n // Vite's dev server REQUIRES both `'unsafe-eval'` (lazy module +\n // sourcemap transforms) and `'unsafe-inline'` (HMR client bootstrap\n // injects a literal inline `<script>`) to function. Under the tight\n // SAAS_APP baseline (`script-src 'self'`), those produce ~120+ CSP\n // violations per page load that drown out real signal (e.g. the\n // Google-Fonts gotcha that the loosened style-src/font-src now allow).\n //\n // The framework SHIPS this knowledge — every Wildo SaaS app uses\n // Vite — so we auto-loosen for `'local'` + `SAAS_APP` here rather\n // than forcing every infra config to re-author the same opt-in. An\n // explicit `viteDevLoosening: false` override keeps tight `script-src`\n // when an author is actively debugging a real CSP issue and willing\n // to accept the Vite noise. Production builds emit `<script\n // type=\"module\">` only and never `eval()`, so production envs never\n // trigger the auto-loosening — `viteDevLoosening` defaults to FALSE\n // there even if the env id is non-`local`.\n const isViteDevAutoTarget =\n input.environmentId === WildoEnvironment.LOCAL &&\n frontendType === AppFrontendType.SAAS_APP;\n const viteDevLoosening = envOverride?.viteDevLoosening ?? isViteDevAutoTarget;\n if (viteDevLoosening) {\n merged = {\n ...merged,\n 'script-src': mergeSourceLists(\n merged['script-src'],\n [\"'unsafe-inline'\", \"'unsafe-eval'\"],\n ),\n };\n }\n\n // Auto-derive the `ws://` / `wss://` companion origins for every HTTP(S)\n // origin the app allow-listed in `connect-src`. Applied LAST so it covers\n // origins contributed by the baseline, app-static config, AND env override\n // alike (e.g. the local `http://localhost:4241` and the staging/prod\n // `https://api.<app>.wildo.app` backend origins). Without this, the\n // Socket.IO transport upgrade to a raw WebSocket against the backend origin\n // trips a `connect-src` violation on every surface. See the helper JSDoc for\n // the scheme-matching rationale.\n const connectSrcWithWs = augmentConnectSrcWithWebSocketOrigins(merged['connect-src']);\n if (connectSrcWithWs !== merged['connect-src']) {\n merged = {\n ...merged,\n 'connect-src': connectSrcWithWs,\n };\n }\n\n return {\n directives: merged,\n reportOnly: envOverride?.reportOnly ?? appCsp.reportOnly,\n reportUri: envOverride?.reportUri ?? appCsp.reportUri,\n };\n}\n\nfunction serializeDirectives(directives: ResolvedCspDirectiveMap): string {\n return Object.entries(directives)\n .filter(([, sources]) => sources && sources.length > 0)\n .map(([name, sources]) => `${name} ${(sources ?? []).join(' ')}`)\n .join('; ');\n}\n\nfunction stripMetaInvalidDirectives(\n directives: ResolvedCspDirectiveMap,\n): ResolvedCspDirectiveMap {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {};\n\n for (const [name, sources] of Object.entries(directives)) {\n if (!META_INVALID_DIRECTIVES.has(name)) {\n out[name as CspDirectiveName] = sources;\n }\n }\n\n return out;\n}\n\nfunction withReportUri(\n directives: ResolvedCspDirectiveMap,\n reportUri: string | undefined,\n): ResolvedCspDirectiveMap {\n if (!reportUri) {\n return directives;\n }\n\n return {\n ...directives,\n ['report-uri' as CspDirectiveName]: [reportUri],\n };\n}\n\nexport function emitCspArtifacts(policy: ResolvedCspPolicy): CspEmitArtifacts {\n const nginxHeaderName = policy.reportOnly\n ? 'Content-Security-Policy-Report-Only'\n : 'Content-Security-Policy';\n const nginxPolicyValue = serializeDirectives(\n withReportUri(policy.directives, policy.reportUri),\n );\n\n return {\n nginxHeaderName,\n nginxPolicyValue,\n nginxAddHeaderLine: `add_header ${nginxHeaderName} \"${nginxPolicyValue}\" always;`,\n metaTag: policy.reportOnly\n ? null\n : {\n tagName: 'meta',\n attributes: {\n 'http-equiv': 'Content-Security-Policy',\n content: serializeDirectives(stripMetaInvalidDirectives(policy.directives)),\n },\n },\n };\n}\n\n/**\n * A single static-host `_headers` block that delivers the resolved CSP as a\n * real response header at the `/*` (all-paths) scope.\n *\n * Format matches the `_headers` convention consumed by Cloudflare Pages /\n * Netlify / Vercel (and the `saas-website` `X-Robots-Tag` `_headers` emitter):\n * a path line, then two-space-indented `Header-Name: value` lines. This is the\n * PORTABLE, provider-agnostic edge-CSP delivery — a CDN-served frontend (which\n * has no nginx to `add_header`) ships this file in its bucket and any\n * `_headers`-aware host applies it.\n *\n * Uses the FULL header value (including the header-only `frame-ancestors` and\n * `report-uri` directives) — a `_headers` line is a genuine response header, so\n * nothing is stripped (unlike the `<meta http-equiv>` fallback). Report-only\n * policies are honoured (the header name flips to\n * `Content-Security-Policy-Report-Only`, valid on a real header channel).\n *\n * The caller composes this block with any other `_headers` blocks (e.g. the\n * website's per-path `X-Robots-Tag`) into one file, separated by a blank line.\n */\nexport function emitCspHeadersFileBlock(policy: ResolvedCspPolicy): string {\n const { nginxHeaderName, nginxPolicyValue } = emitCspArtifacts(policy);\n return `/*\\n ${nginxHeaderName}: ${nginxPolicyValue}`;\n}\n\n/**\n * Provider-agnostic descriptor of the response-header MODIFICATION a CDN vendor\n * must install to deliver the resolved CSP at the edge. A concrete vendor\n * adapter (e.g. Cloudflare) maps this to its own API shape — for Cloudflare, a\n * `http_response_headers_transform` ruleset rule whose action sets\n * `headerName` to `value`.\n *\n * Same FULL header name + value as the nginx / `_headers` channels (a CDN sets\n * a real header, so `frame-ancestors` / `report-uri` are valid and retained).\n */\nexport interface CspEdgeHeaderModification {\n /** Cloudflare ruleset phase this modification belongs to. */\n readonly phase: 'http_response_headers_transform';\n /** The header operation — always `set` (overwrite any origin value). */\n readonly operation: 'set';\n /** Response-header name (report-only-aware, same as the nginx channel). */\n readonly headerName: string;\n /** Serialized policy value (identical to `nginxPolicyValue`). */\n readonly value: string;\n}\n\n/**\n * Derive the edge response-header modification carrying the resolved CSP, for a\n * CDN vendor's live-provisioning adapter to install. Thin over\n * {@link emitCspArtifacts} so the directive serialization is the single source\n * of truth across nginx / `_headers` / CDN channels.\n */\nexport function emitCspEdgeHeaderModification(policy: ResolvedCspPolicy): CspEdgeHeaderModification {\n const { nginxHeaderName, nginxPolicyValue } = emitCspArtifacts(policy);\n return {\n phase: 'http_response_headers_transform',\n operation: 'set',\n headerName: nginxHeaderName,\n value: nginxPolicyValue,\n };\n}\n\nexport interface RewriteNginxResult {\n readonly totalPairs: number;\n readonly pairsRewritten: number;\n readonly fileWritten: boolean;\n}\n\nexport function rewriteNginxCspMarkerPairs(\n filePath: string,\n addHeaderLine: string,\n): RewriteNginxResult {\n const original = readFileSync(filePath, 'utf-8');\n const { rewritten, totalPairs, pairsChanged } = rewriteNginxCspMarkerPairsString(\n original,\n addHeaderLine,\n filePath,\n );\n const fileWritten = rewritten !== original;\n\n if (fileWritten) {\n writeFileSync(filePath, rewritten, 'utf-8');\n }\n\n return {\n totalPairs,\n pairsRewritten: pairsChanged,\n fileWritten,\n };\n}\n\nexport function rewriteNginxCspMarkerPairsString(\n source: string,\n addHeaderLine: string,\n filePath = '<in-memory>',\n): {\n readonly rewritten: string;\n readonly totalPairs: number;\n readonly pairsChanged: number;\n} {\n const usesCrlf = source.includes('\\r\\n');\n const newline = usesCrlf ? '\\r\\n' : '\\n';\n const lines = source.split(newline);\n\n let totalPairs = 0;\n let pairsChanged = 0;\n let openBeginIndex: number | null = null;\n let openIndent = '';\n\n for (let index = 0; index < lines.length; index += 1) {\n const trimmed = lines[index].trim();\n\n if (trimmed === NGINX_CSP_BEGIN_MARKER) {\n if (openBeginIndex !== null) {\n throw new Error(\n `[csp-emit] ${filePath}:${index + 1} found a second '${NGINX_CSP_BEGIN_MARKER}' before the previous '${NGINX_CSP_END_MARKER}' (line ${openBeginIndex + 1})`,\n );\n }\n\n openBeginIndex = index;\n openIndent = lines[index].slice(0, lines[index].indexOf('#'));\n continue;\n }\n\n if (trimmed === NGINX_CSP_END_MARKER) {\n if (openBeginIndex === null) {\n throw new Error(\n `[csp-emit] ${filePath}:${index + 1} found '${NGINX_CSP_END_MARKER}' without a matching '${NGINX_CSP_BEGIN_MARKER}'`,\n );\n }\n\n totalPairs += 1;\n\n const existingBody = lines.slice(openBeginIndex + 1, index);\n const canonicalBody = [`${openIndent}${addHeaderLine}`];\n const existingNonBlank = existingBody.filter((line) => line.trim().length > 0);\n const canonicalNonBlank = canonicalBody.filter((line) => line.trim().length > 0);\n const bodyMatches =\n existingNonBlank.length === canonicalNonBlank.length &&\n existingNonBlank.every((line, bodyIndex) => line === canonicalNonBlank[bodyIndex]);\n\n if (!bodyMatches) {\n lines.splice(openBeginIndex + 1, index - openBeginIndex - 1, ...canonicalBody);\n index = openBeginIndex + canonicalBody.length + 1;\n pairsChanged += 1;\n }\n\n openBeginIndex = null;\n openIndent = '';\n }\n }\n\n if (openBeginIndex !== null) {\n throw new Error(\n `[csp-emit] ${filePath} has an unclosed '${NGINX_CSP_BEGIN_MARKER}' starting at line ${openBeginIndex + 1}`,\n );\n }\n\n return { rewritten: lines.join(newline), totalPairs, pairsChanged };\n}\n"]}
@@ -22,6 +22,10 @@ export declare enum InfraCapability {
22
22
  * {@link RUNTIME_GRANTED_INFRA_CAPABILITIES}.
23
23
  */
24
24
  METRICS_TELEMETRY = "METRICS_TELEMETRY",
25
+ /**
26
+ * Backup. RESERVED — no backing-service kind declares it and no module serves it; see
27
+ * {@link RESERVED_INFRA_CAPABILITIES}.
28
+ */
25
29
  BACKUP_MANAGER = "BACKUP_MANAGER"
26
30
  }
27
31
  /**
@@ -37,6 +41,19 @@ export declare enum InfraCapability {
37
41
  * belongs in neither place is a real gap and stays visible as one.
38
42
  */
39
43
  export declare const RUNTIME_GRANTED_INFRA_CAPABILITIES: Readonly<Partial<Record<InfraCapability, string>>>;
44
+ /**
45
+ * Capabilities kept as VOCABULARY with no way to be selected yet — neither declared by an
46
+ * environment (no `BackingServiceKind` projects to them) nor granted to runtimes by the platform.
47
+ *
48
+ * This is the third answer to "why does this capability have no kind", beside
49
+ * `BackingServiceKindToInfraCapability` and {@link RUNTIME_GRANTED_INFRA_CAPABILITIES}. It exists so
50
+ * that answer is WRITTEN DOWN: a capability in none of the three is an unexplained gap, and the
51
+ * reachability test still fails on it.
52
+ *
53
+ * Membership is a statement that nothing can reach the capability today. It is not a placeholder
54
+ * an environment may fill in — withdrawing the declarable kind is what stopped it being one.
55
+ */
56
+ export declare const RESERVED_INFRA_CAPABILITIES: Readonly<Partial<Record<InfraCapability, string>>>;
40
57
  /**
41
58
  * Built-in environment-facing provider ids — the (kind × hosting-model
42
59
  * × brand) projection vocabulary. Apps SELECT these implicitly via
@@ -539,6 +556,31 @@ export interface IPostgresAdminClient {
539
556
  databaseName: string;
540
557
  username: string;
541
558
  }): Promise<void>;
559
+ /**
560
+ * Stop the application's OWNER role from authenticating — and destroy nothing (#1307).
561
+ *
562
+ * The application backend's role OWNS its database, so it cannot be dropped without first handing
563
+ * ownership of every object to somebody else (PostgreSQL refuses `DROP ROLE` while objects depend
564
+ * on it). Revocation therefore keeps the role and removes its ability to open a session:
565
+ * `NOLOGIN` (a role without it cannot be "the initial session authorization name during client
566
+ * connection") plus `PASSWORD NULL` ("password authentication will always fail for that user"),
567
+ * then terminates the sessions it already holds, because a login attribute is checked only when a
568
+ * session starts.
569
+ *
570
+ * spec-cite: PostgreSQL 17 `CREATE ROLE` — `LOGIN`/`NOLOGIN` and `PASSWORD` parameter descriptions
571
+ * (https://www.postgresql.org/docs/17/sql-createrole.html); `pg_terminate_backend`, System
572
+ * Administration Functions (https://www.postgresql.org/docs/17/functions-admin.html).
573
+ *
574
+ * Separate from {@link IPostgresAdminClient.dropApplicationDatabase}, which DROPS the database: a
575
+ * withdrawn application's data is kept (#1562 owns destruction), and a revocation that routed
576
+ * through the drop would erase it while believing it was only retiring a login.
577
+ *
578
+ * Reversible by {@link IPostgresAdminClient.upsertApplicationDatabase}, which re-applies
579
+ * `LOGIN PASSWORD` to an existing role. Idempotent: a role that does not exist is a no-op.
580
+ */
581
+ revokeApplicationDatabaseLogin(input: {
582
+ username: string;
583
+ }): Promise<void>;
542
584
  /**
543
585
  * Upsert a LOGIN role holding exactly the given per-table privileges inside an
544
586
  * existing application database (Step 3 / R1).
@@ -635,6 +677,106 @@ export interface IMongoAtlasClient {
635
677
  * Delete an Atlas database user. Idempotent: 404 → no-op.
636
678
  */
637
679
  deleteDatabaseUser(username: string): Promise<void>;
680
+ /**
681
+ * Upsert a database user holding exactly ONE Atlas custom database role, which carries exactly the
682
+ * given collection-scoped privileges and inherits nothing (#1694). The Atlas twin of
683
+ * {@link IMongoSelfAdminClient.upsertCollectionScopedDatabaseUser}, for a runtime principal (a minion).
684
+ *
685
+ * A SEPARATE method from {@link IMongoAtlasClient.upsertApplicationDatabase} for the reason the
686
+ * self-hosted contract gives: that one grants `readWrite` on the whole database, this one grants named
687
+ * actions on named collections, and an optional "privileges" argument would make the wide grant the
688
+ * behaviour you get by forgetting to pass something.
689
+ *
690
+ * - `privileges[].actions` are Atlas Admin API privilege-action names (`FIND`, `INSERT`, `UPDATE`,
691
+ * `REMOVE`, …). The caller translates from MongoDB's own vocabulary; this transport never widens it.
692
+ * - `privileges` is AUTHORITATIVE: an existing role's actions are REPLACED, so a resource removed from
693
+ * `resourceAccess` loses its grant on the next sync.
694
+ * - The user is scoped to `clusterName` alone (Atlas grants every cluster in the project when `scopes`
695
+ * is omitted), and holds the custom role and nothing else.
696
+ * - Idempotent: safe when the role and user already exist; the password is re-applied, which is how a
697
+ * rotation lands.
698
+ *
699
+ * Returns the SRV connection string carrying THIS user's credentials, for the same transient use as
700
+ * {@link IMongoAtlasClient.upsertApplicationDatabase}'s.
701
+ */
702
+ upsertCollectionScopedDatabaseUser(input: {
703
+ clusterName: string;
704
+ databaseName: string;
705
+ username: string;
706
+ password: string;
707
+ roleName: string;
708
+ privileges: ReadonlyArray<{
709
+ resource: {
710
+ db: string;
711
+ collection: string;
712
+ };
713
+ actions: readonly string[];
714
+ }>;
715
+ }): Promise<{
716
+ connectionString: string;
717
+ }>;
718
+ /**
719
+ * Retire a collection-scoped user AND the custom role it holds — and nothing else.
720
+ *
721
+ * Two objects, deleted user FIRST: Atlas refuses to delete a custom role that would leave a database
722
+ * user with no roles, so the reverse order fails while the user exists. Dropping only the user would
723
+ * leave a privileged role behind that the next mint silently adopts. Idempotent in both halves: a
724
+ * missing user or a missing role is a no-op.
725
+ */
726
+ dropCollectionScopedDatabaseUser(input: {
727
+ username: string;
728
+ roleName: string;
729
+ }): Promise<void>;
730
+ }
731
+ /**
732
+ * The immudb permission an application's audit user holds on its OWN database (#1696).
733
+ *
734
+ * The values are immudb's own permission bytes, because the admin transport sends them verbatim.
735
+ * spec-cite: immudb v1.11.1 `pkg/auth/permissions.go` — `PermissionNone = iota`, `PermissionR`, `PermissionRW`
736
+ * (0, 1, 2), `PermissionAdmin = 254`, `PermissionSysAdmin = 255`
737
+ * (https://raw.githubusercontent.com/codenotary/immudb/v1.11.1/pkg/auth/permissions.go, fetched 2026-09-29).
738
+ *
739
+ * Only READ_WRITE is named: an audit sink appends and verifies, and nothing in the framework grants an
740
+ * application more. `ADMIN` and `SYSADMIN` are deliberately absent — holding either is the defect #1696 removes.
741
+ */
742
+ export declare enum ImmudbDatabasePermission {
743
+ READ_WRITE = 2
744
+ }
745
+ /**
746
+ * Raw immudb admin transport (#1696). Surfaces exactly what `ImmudbSelfInfraProviderModule` needs to give each
747
+ * application ONE database and ONE user confined to it, and to revoke that user — nothing more.
748
+ *
749
+ * Implemented in apps-manager over the gRPC admin API with the PLATFORM's own admin credential (a
750
+ * framework-managed secret no application receives). Every method is idempotent, because registration,
751
+ * withdrawal and restore all retry by re-running.
752
+ *
753
+ * **No method deletes anything.** immudb keeps every database and every user it has created: an append-only
754
+ * store's audit history must outlive the application's credential, and a withdrawn application is restored by
755
+ * RE-ACTIVATING its user onto the same database (#1307).
756
+ */
757
+ export interface IImmudbAdminClient {
758
+ /** Create the database when it does not exist; a no-op when it does. */
759
+ ensureDatabase(input: {
760
+ databaseName: string;
761
+ }): Promise<void>;
762
+ /**
763
+ * Create the user, or bring an existing one back to exactly this state: ACTIVE, this password, and `permission`
764
+ * on `databaseName`. Re-applying the password and re-activating are what make a restore after withdrawal work.
765
+ */
766
+ upsertDatabaseUser(input: {
767
+ username: string;
768
+ password: string;
769
+ databaseName: string;
770
+ permission: ImmudbDatabasePermission;
771
+ }): Promise<void>;
772
+ /**
773
+ * Refuse the user's credential from now on: revoke its permission on `databaseName` and DEACTIVATE it.
774
+ * immudb has no user deletion; a deactivated user cannot log in. A user that does not exist is a no-op.
775
+ */
776
+ deactivateDatabaseUser(input: {
777
+ username: string;
778
+ databaseName: string;
779
+ }): Promise<void>;
638
780
  }
639
781
  /**
640
782
  * Raw self-managed MongoDB admin transport. Surface what
@@ -730,6 +872,25 @@ export interface IMongoSelfAdminClient {
730
872
  export interface InfraProviderModule {
731
873
  provider: InfraProvider;
732
874
  supportedCapabilities: ReadonlyArray<InfraCapability>;
875
+ /**
876
+ * Present when this module EXISTS but the platform cannot yet deliver a working connection for the
877
+ * provider — the module can plan, and an application selecting it would still receive no usable
878
+ * credential. The value says why, and what would change it.
879
+ *
880
+ * ## Why the module stays in the catalogue instead of being removed
881
+ *
882
+ * The module's `plan()` is correct and useful: it formalizes the env contract an operator will set
883
+ * and gives the lockfile a stable digest. What is missing is elsewhere (for `AWS_S3`, the credential
884
+ * broker that speaks only MinIO's AssumeRole, #14). Removing the module would lose the correct half
885
+ * to express the missing one.
886
+ *
887
+ * ## What it does
888
+ *
889
+ * A declaration resolving to a provider whose module carries this is REFUSED at authoring time
890
+ * (`wildo config validate` / `config sync` / `lock check`), exactly like a declaration resolving to
891
+ * a provider with no module. Delete the field in the same change that makes the provider servable.
892
+ */
893
+ unservableReason?: string;
733
894
  /**
734
895
  * Every `Wildo_Application_Secrets` JSON path this module can mint PER RUNTIME PRINCIPAL.
735
896
  *
@@ -752,6 +913,13 @@ export interface InfraProviderModule {
752
913
  * **Modules MUST derive `appRuntime.perAppSecretBlobPaths` from this same constant** rather than
753
914
  * repeating the literal list. Two spellings of where a credential lives is the defect this exists
754
915
  * to prevent, one layer up.
916
+ *
917
+ * **A module declaring paths here MUST derive a distinct resource name per principal**, in its mint
918
+ * AND its revoke, through one function. apps-manager dispatches every minion mint and revocation
919
+ * through the catalogue (#1692), so a module that ignored `principal` and derived the application
920
+ * backend's own name would OVERWRITE the backend's user on a minion mint and DELETE it on a minion
921
+ * revocation — the defect `invariant-call-site-enumeration.md` #18 records. MongoDB Atlas shipped in
922
+ * exactly that shape and was refused at registration until its per-principal path landed (#1694).
755
923
  */
756
924
  perPrincipalSecretBlobPaths: ReadonlyArray<string>;
757
925
  plan(context: InfraProviderPlanningContext): InfraProviderPlanContribution;
@@ -777,10 +945,18 @@ export interface InfraProviderModule {
777
945
  */
778
946
  mintAppCredentials?(context: AppCredentialMintingContext): Promise<AppCredentialMintingResult | null>;
779
947
  /**
780
- * Optional. Symmetric to `mintAppCredentials`; called at app
781
- * tear-down time. Idempotent: safe to call when the per-app user /
782
- * DB / role does not exist (best-effort cleanup, no throw on
783
- * already-absent).
948
+ * Optional. Symmetric to `mintAppCredentials`: afterwards the principal's credential is REFUSED by the
949
+ * server. Called by apps-manager when a minion leaves the declaration, and for EVERY principal of an
950
+ * application withdrawn from the platform (`deregisterApplication`, #1307).
951
+ *
952
+ * **It revokes and never destroys.** It removes the ability to authenticate — an ACL user, a broker
953
+ * user, a database user, or a login — and leaves the application's DATA where it is: its database,
954
+ * keys, queues and blobs. A withdrawn application is restored by re-minting (`mintAppCredentials` with
955
+ * the recorded material), which only works if nothing it owns was dropped. Destroying data is a
956
+ * different verb with its own protection (#1562); a module must never reach it through this one.
957
+ *
958
+ * Idempotent: safe to call when the per-principal user / role does not exist (no throw on
959
+ * already-absent), because a retry after a partial revocation must converge.
784
960
  */
785
961
  revokeAppCredentials?(context: AppCredentialMintingContext): Promise<void>;
786
962
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"infra-providers.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/infra-providers.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;;;;GAMG;AACH,oBAAY,eAAe;IACzB,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,iBAAiB,sBAAsB;IACvC,cAAc,mBAAmB;IACjC,kBAAkB,uBAAuB;IACzC,cAAc,mBAAmB;IACjC,aAAa,kBAAkB;IAC/B;;;OAGG;IACH,iBAAiB,sBAAsB;IACvC,cAAc,mBAAmB;CAClC;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,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,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,aAAa,CAAC;YACxB,QAAQ,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAC;gBAAC,UAAU,EAAE,MAAM,CAAA;aAAE,CAAC;YAC7C,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;SAC5B,CAAC,CAAC;KACJ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,aAAa,CAAC;IACxB,qBAAqB,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAEtD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,2BAA2B,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,EAAE,4BAA4B,GAAG,6BAA6B,CAAC;IAE3E;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAC;IAE9C;;;;;OAKG;IACH,oBAAoB,CAAC,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E;;;;;;;;;;;;;;OAcG;IACH,8BAA8B,CAAC,CAC7B,OAAO,EAAE,uCAAuC,GAC/C,OAAO,CAAC,sCAAsC,GAAG,IAAI,CAAC,CAAC;CAC3D"}
1
+ {"version":3,"file":"infra-providers.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/infra-providers.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;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AAG,6BAA6B,CAAC;IAE3E;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAC;IAE9C;;;;;;;;;;;;;OAaG;IACH,oBAAoB,CAAC,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E;;;;;;;;;;;;;;OAcG;IACH,8BAA8B,CAAC,CAC7B,OAAO,EAAE,uCAAuC,GAC/C,OAAO,CAAC,sCAAsC,GAAG,IAAI,CAAC,CAAC;CAC3D"}
@@ -20,6 +20,10 @@ export var InfraCapability;
20
20
  * {@link RUNTIME_GRANTED_INFRA_CAPABILITIES}.
21
21
  */
22
22
  InfraCapability["METRICS_TELEMETRY"] = "METRICS_TELEMETRY";
23
+ /**
24
+ * Backup. RESERVED — no backing-service kind declares it and no module serves it; see
25
+ * {@link RESERVED_INFRA_CAPABILITIES}.
26
+ */
23
27
  InfraCapability["BACKUP_MANAGER"] = "BACKUP_MANAGER";
24
28
  })(InfraCapability || (InfraCapability = {}));
25
29
  /**
@@ -52,6 +56,27 @@ export const RUNTIME_GRANTED_INFRA_CAPABILITIES = {
52
56
  [InfraCapability.METRICS_TELEMETRY]: 'Authored at observability.telemetry + the OBSERVABILITY_TELEMETRY provider; granted to every '
53
57
  + 'runtime for the DATA_TELEMETRY network, so no environment declares it and no module mints it.',
54
58
  };
59
+ /**
60
+ * Capabilities kept as VOCABULARY with no way to be selected yet — neither declared by an
61
+ * environment (no `BackingServiceKind` projects to them) nor granted to runtimes by the platform.
62
+ *
63
+ * This is the third answer to "why does this capability have no kind", beside
64
+ * `BackingServiceKindToInfraCapability` and {@link RUNTIME_GRANTED_INFRA_CAPABILITIES}. It exists so
65
+ * that answer is WRITTEN DOWN: a capability in none of the three is an unexplained gap, and the
66
+ * reachability test still fails on it.
67
+ *
68
+ * Membership is a statement that nothing can reach the capability today. It is not a placeholder
69
+ * an environment may fill in — withdrawing the declarable kind is what stopped it being one.
70
+ */
71
+ export const RESERVED_INFRA_CAPABILITIES = {
72
+ /*
73
+ * The `backup` backing-service kind was WITHDRAWN 2026-09-26 (#1693): it resolved to no provider,
74
+ * rendered no workload, and nothing read it. The capability stays because whether backup is modelled
75
+ * as a capability at all is the design question #8 owns. Its network is `null` in
76
+ * `NETWORK_FOR_CAPABILITY` for the same reason — no runtime dials a backup target.
77
+ */
78
+ [InfraCapability.BACKUP_MANAGER]: 'Reserved for the backup design (#8): no environment can declare it and no module serves it.',
79
+ };
55
80
  /**
56
81
  * Built-in environment-facing provider ids — the (kind × hosting-model
57
82
  * × brand) projection vocabulary. Apps SELECT these implicitly via
@@ -236,4 +261,19 @@ export const InfraProviderPlanContributionSchema = InfraProviderResourceContribu
236
261
  platformAdmin: InfraProviderPlatformAdminContributionSchema.optional(),
237
262
  appRuntime: InfraProviderAppRuntimeContributionSchema.optional(),
238
263
  }).passthrough();
264
+ /**
265
+ * The immudb permission an application's audit user holds on its OWN database (#1696).
266
+ *
267
+ * The values are immudb's own permission bytes, because the admin transport sends them verbatim.
268
+ * spec-cite: immudb v1.11.1 `pkg/auth/permissions.go` — `PermissionNone = iota`, `PermissionR`, `PermissionRW`
269
+ * (0, 1, 2), `PermissionAdmin = 254`, `PermissionSysAdmin = 255`
270
+ * (https://raw.githubusercontent.com/codenotary/immudb/v1.11.1/pkg/auth/permissions.go, fetched 2026-09-29).
271
+ *
272
+ * Only READ_WRITE is named: an audit sink appends and verifies, and nothing in the framework grants an
273
+ * application more. `ADMIN` and `SYSADMIN` are deliberately absent — holding either is the defect #1696 removes.
274
+ */
275
+ export var ImmudbDatabasePermission;
276
+ (function (ImmudbDatabasePermission) {
277
+ ImmudbDatabasePermission[ImmudbDatabasePermission["READ_WRITE"] = 2] = "READ_WRITE";
278
+ })(ImmudbDatabasePermission || (ImmudbDatabasePermission = {}));
239
279
  //# sourceMappingURL=infra-providers.schemas.js.map