@caelo-cms/shared 0.11.9 → 0.11.10

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 (80) hide show
  1. package/certs/aws-rds-global.pem +2888 -0
  2. package/certs/cloudsql-global.pem +1897 -0
  3. package/dist/body-cap.d.ts +35 -0
  4. package/dist/body-cap.d.ts.map +1 -0
  5. package/dist/body-cap.js +63 -0
  6. package/dist/body-cap.js.map +1 -0
  7. package/dist/client-address.d.ts +69 -0
  8. package/dist/client-address.d.ts.map +1 -0
  9. package/dist/client-address.js +99 -0
  10. package/dist/client-address.js.map +1 -0
  11. package/dist/context.d.ts +8 -0
  12. package/dist/context.d.ts.map +1 -1
  13. package/dist/database-tls.d.ts +64 -0
  14. package/dist/database-tls.d.ts.map +1 -0
  15. package/dist/database-tls.js +95 -0
  16. package/dist/database-tls.js.map +1 -0
  17. package/dist/database-url.d.ts +2 -15
  18. package/dist/database-url.d.ts.map +1 -1
  19. package/dist/database-url.js +14 -1
  20. package/dist/database-url.js.map +1 -1
  21. package/dist/index.d.ts +7 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +7 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/interim-forwarded-host.d.ts +15 -0
  26. package/dist/interim-forwarded-host.d.ts.map +1 -0
  27. package/dist/interim-forwarded-host.js +16 -0
  28. package/dist/interim-forwarded-host.js.map +1 -0
  29. package/dist/json-security-headers.d.ts +23 -0
  30. package/dist/json-security-headers.d.ts.map +1 -0
  31. package/dist/json-security-headers.js +53 -0
  32. package/dist/json-security-headers.js.map +1 -0
  33. package/dist/pool-budget.d.ts +10 -0
  34. package/dist/pool-budget.d.ts.map +1 -1
  35. package/dist/pool-budget.js +15 -0
  36. package/dist/pool-budget.js.map +1 -1
  37. package/dist/redirect-emit-gcp.d.ts +16 -8
  38. package/dist/redirect-emit-gcp.d.ts.map +1 -1
  39. package/dist/redirect-emit-gcp.js +22 -11
  40. package/dist/redirect-emit-gcp.js.map +1 -1
  41. package/dist/release-manifest.d.ts +18 -2
  42. package/dist/release-manifest.d.ts.map +1 -1
  43. package/dist/release-manifest.js +32 -4
  44. package/dist/release-manifest.js.map +1 -1
  45. package/dist/session-cookie.d.ts +88 -0
  46. package/dist/session-cookie.d.ts.map +1 -0
  47. package/dist/session-cookie.js +151 -0
  48. package/dist/session-cookie.js.map +1 -0
  49. package/dist/staging-plugin-stub.d.ts +28 -0
  50. package/dist/staging-plugin-stub.d.ts.map +1 -0
  51. package/dist/staging-plugin-stub.js +34 -0
  52. package/dist/staging-plugin-stub.js.map +1 -0
  53. package/dist/version.d.ts +2 -2
  54. package/dist/version.d.ts.map +1 -1
  55. package/dist/version.js +1 -1
  56. package/dist/version.js.map +1 -1
  57. package/package.json +2 -1
  58. package/src/body-cap.test.ts +44 -0
  59. package/src/body-cap.ts +83 -0
  60. package/src/client-address.test.ts +90 -0
  61. package/src/client-address.ts +111 -0
  62. package/src/context.ts +8 -0
  63. package/src/database-tls.test.ts +83 -0
  64. package/src/database-tls.ts +99 -0
  65. package/src/database-url.test.ts +49 -11
  66. package/src/database-url.ts +21 -1
  67. package/src/index.ts +7 -0
  68. package/src/interim-forwarded-host.ts +16 -0
  69. package/src/json-security-headers.test.ts +31 -0
  70. package/src/json-security-headers.ts +53 -0
  71. package/src/pool-budget.test.ts +17 -3
  72. package/src/pool-budget.ts +19 -0
  73. package/src/redirect-emit-gcp.ts +24 -11
  74. package/src/redirect-emit.test.ts +6 -5
  75. package/src/release-manifest.ts +33 -4
  76. package/src/session-cookie.test.ts +96 -0
  77. package/src/session-cookie.ts +163 -0
  78. package/src/staging-plugin-stub.test.ts +23 -0
  79. package/src/staging-plugin-stub.ts +37 -0
  80. package/src/version.ts +1 -1
@@ -0,0 +1,35 @@
1
+ /**
2
+ * P13 — request body size cap, shared by the public services (the visitor
3
+ * gateway and the MCP-Auth-Proxy's OAuth endpoints). Pure Web APIs.
4
+ *
5
+ * Default 64 KB ceiling; the gateway's per-plugin manifest override
6
+ * (`gateway.maxBodyBytes`) can raise it up to a 1 MB hard ceiling. Handlers
7
+ * don't need to worry about hostile payloads — anything over the cap is
8
+ * rejected before they see it.
9
+ *
10
+ * Bun's `req.text()` / `req.json()` will happily buffer multi-MB bodies;
11
+ * we instead read the stream manually with a running counter so the
12
+ * connection short-circuits at the first byte over the cap.
13
+ */
14
+ /** Cap applied when the caller names none. */
15
+ export declare const DEFAULT_MAX_BODY_BYTES: number;
16
+ /** No caller may raise the cap above this. */
17
+ export declare const HARD_MAX_BODY_BYTES: number;
18
+ /** The body, read in full within the cap. */
19
+ export interface BodyCapResult {
20
+ readonly ok: true;
21
+ readonly body: ArrayBuffer;
22
+ readonly bytes: number;
23
+ }
24
+ /** The body went over the cap; reading stopped there. */
25
+ export interface BodyCapTooLarge {
26
+ readonly ok: false;
27
+ readonly bytes: number;
28
+ readonly limit: number;
29
+ }
30
+ /**
31
+ * Read req.body up to `limit` bytes. If the body exceeds the limit, abort
32
+ * the read and return `{ok: false}` so the handler can emit 413.
33
+ */
34
+ export declare function readBodyWithCap(req: Request, limit?: number): Promise<BodyCapResult | BodyCapTooLarge>;
35
+ //# sourceMappingURL=body-cap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-cap.d.ts","sourceRoot":"","sources":["../src/body-cap.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,8CAA8C;AAC9C,eAAO,MAAM,sBAAsB,QAAY,CAAC;AAChD,8CAA8C;AAC9C,eAAO,MAAM,mBAAmB,QAAc,CAAC;AAE/C,6CAA6C;AAC7C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,OAAO,EACZ,KAAK,GAAE,MAA+B,GACrC,OAAO,CAAC,aAAa,GAAG,eAAe,CAAC,CAwC1C"}
@@ -0,0 +1,63 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ /**
3
+ * P13 — request body size cap, shared by the public services (the visitor
4
+ * gateway and the MCP-Auth-Proxy's OAuth endpoints). Pure Web APIs.
5
+ *
6
+ * Default 64 KB ceiling; the gateway's per-plugin manifest override
7
+ * (`gateway.maxBodyBytes`) can raise it up to a 1 MB hard ceiling. Handlers
8
+ * don't need to worry about hostile payloads — anything over the cap is
9
+ * rejected before they see it.
10
+ *
11
+ * Bun's `req.text()` / `req.json()` will happily buffer multi-MB bodies;
12
+ * we instead read the stream manually with a running counter so the
13
+ * connection short-circuits at the first byte over the cap.
14
+ */
15
+ /** Cap applied when the caller names none. */
16
+ export const DEFAULT_MAX_BODY_BYTES = 64 * 1024;
17
+ /** No caller may raise the cap above this. */
18
+ export const HARD_MAX_BODY_BYTES = 1024 * 1024;
19
+ /**
20
+ * Read req.body up to `limit` bytes. If the body exceeds the limit, abort
21
+ * the read and return `{ok: false}` so the handler can emit 413.
22
+ */
23
+ export async function readBodyWithCap(req, limit = DEFAULT_MAX_BODY_BYTES) {
24
+ const cap = Math.min(limit, HARD_MAX_BODY_BYTES);
25
+ // Cheap pre-check on Content-Length when present.
26
+ const contentLength = req.headers.get("content-length");
27
+ if (contentLength) {
28
+ const declared = Number.parseInt(contentLength, 10);
29
+ if (Number.isFinite(declared) && declared > cap) {
30
+ return { ok: false, bytes: declared, limit: cap };
31
+ }
32
+ }
33
+ if (!req.body) {
34
+ return { ok: true, body: new ArrayBuffer(0), bytes: 0 };
35
+ }
36
+ const reader = req.body.getReader();
37
+ const chunks = [];
38
+ let total = 0;
39
+ try {
40
+ while (true) {
41
+ const { done, value } = await reader.read();
42
+ if (done)
43
+ break;
44
+ total += value.byteLength;
45
+ if (total > cap) {
46
+ await reader.cancel(); // signal upstream to stop sending
47
+ return { ok: false, bytes: total, limit: cap };
48
+ }
49
+ chunks.push(value);
50
+ }
51
+ }
52
+ finally {
53
+ reader.releaseLock();
54
+ }
55
+ const buf = new Uint8Array(total);
56
+ let offset = 0;
57
+ for (const c of chunks) {
58
+ buf.set(c, offset);
59
+ offset += c.byteLength;
60
+ }
61
+ return { ok: true, body: buf.buffer, bytes: total };
62
+ }
63
+ //# sourceMappingURL=body-cap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-cap.js","sourceRoot":"","sources":["../src/body-cap.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;GAYG;AAEH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,GAAG,IAAI,CAAC;AAChD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,GAAG,IAAI,CAAC;AAgB/C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAY,EACZ,QAAgB,sBAAsB;IAEtC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;IACjD,kDAAkD;IAClD,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACxD,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,GAAG,EAAE,CAAC;YAChD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;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AAK,EAAE,CAAC;AACrE,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The client's address, as the infrastructure in front of a public service
3
+ * vouches for it — one rule for every Caelo service that faces the internet
4
+ * (the visitor data gateway, apps/api-gateway; the MCP-Auth-Proxy,
5
+ * apps/mcp-auth-proxy). Pure Web APIs, no runtime dependency.
6
+ *
7
+ * Every proxy on the path APPENDS to `X-Forwarded-For`; everything before
8
+ * the entries our own infrastructure appended came from the client and can
9
+ * be forged. So the client address is not "the first entry" (forgeable) and
10
+ * not blindly "the last entry" either (behind a load balancer that is the
11
+ * load balancer, for every client): it is the entry `hops` places from the
12
+ * end, where `hops` is how many entries the deployment's proxies append,
13
+ * counting the client's own. That number is a property of the topology in
14
+ * front of each service, so the provisioner sets it per provider and service
15
+ * (`CAELO_TRUSTED_PROXY_HOPS`, packages/provisioning/src/stack-contract.ts):
16
+ *
17
+ * - gcp: external Application LB appends `<client>,<LB IP>` and
18
+ * the service's ingress is internal-and-LB only → 2.
19
+ * - gcp-firebase: Cloud Run's front end appends the address it got the
20
+ * connection from → 1 (behind the Firebase Hosting
21
+ * rewrite that is the Hosting CDN edge, see the gateway's
22
+ * client-ip.ts).
23
+ * - self-hosted: Caddy (no `trusted_proxies`) replaces the header with
24
+ * the peer address; the service is reachable only on the
25
+ * Compose network → 1.
26
+ * - azure: Container Apps ingress appends the peer → 1.
27
+ * - 0: nothing in front (local dev): the TCP peer address.
28
+ *
29
+ * The MCP-Auth-Proxy is reached the same way as the gateway on every
30
+ * provider (on gcp-firebase directly on its run.app URL, on gcp through the
31
+ * load balancer), so the same counts apply to it.
32
+ */
33
+ /** The env var carrying the deployment's trusted proxy hop count. */
34
+ export declare const TRUSTED_PROXY_HOPS_ENV = "CAELO_TRUSTED_PROXY_HOPS";
35
+ /**
36
+ * The service cannot tell who the client is: the hop count is missing or
37
+ * invalid, or a request arrived with fewer forwarded entries than the
38
+ * deployment's proxies always append. Both are deployment errors; the
39
+ * message names the fix.
40
+ */
41
+ export declare class ClientAddressError extends Error {
42
+ readonly name = "ClientAddressError";
43
+ }
44
+ /**
45
+ * The trusted proxy hop count from `env`.
46
+ *
47
+ * @throws ClientAddressError when it is unset or not a non-negative integer —
48
+ * guessing would either pool every client into one rate-limit bucket or
49
+ * let a client pick its own.
50
+ */
51
+ export declare function trustedProxyHopsFromEnv(env: Readonly<Record<string, string | undefined>>): number;
52
+ /**
53
+ * The entry `hops` places from the end of `xForwardedFor` (1 = the last), or
54
+ * null when the header has fewer entries than that.
55
+ *
56
+ * @example
57
+ * forwardedClientIp("6.6.6.6, 198.51.100.7, 34.1.2.3", 2) // → "198.51.100.7"
58
+ */
59
+ export declare function forwardedClientIp(xForwardedFor: string | null, hops: number): string | null;
60
+ /**
61
+ * The client address of `req` under `hops`.
62
+ *
63
+ * @param peerAddress the TCP peer (Bun `server.requestIP`); used only when
64
+ * `hops` is 0.
65
+ * @throws ClientAddressError when the request does not carry what the
66
+ * configured topology always adds.
67
+ */
68
+ export declare function clientAddress(req: Request, hops: number, peerAddress: string | null): string;
69
+ //# sourceMappingURL=client-address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-address.d.ts","sourceRoot":"","sources":["../src/client-address.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AAEjE;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,SAAkB,IAAI,wBAAwB;CAC/C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,MAAM,CAajG;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO3F;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgB5F"}
@@ -0,0 +1,99 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ /**
3
+ * The client's address, as the infrastructure in front of a public service
4
+ * vouches for it — one rule for every Caelo service that faces the internet
5
+ * (the visitor data gateway, apps/api-gateway; the MCP-Auth-Proxy,
6
+ * apps/mcp-auth-proxy). Pure Web APIs, no runtime dependency.
7
+ *
8
+ * Every proxy on the path APPENDS to `X-Forwarded-For`; everything before
9
+ * the entries our own infrastructure appended came from the client and can
10
+ * be forged. So the client address is not "the first entry" (forgeable) and
11
+ * not blindly "the last entry" either (behind a load balancer that is the
12
+ * load balancer, for every client): it is the entry `hops` places from the
13
+ * end, where `hops` is how many entries the deployment's proxies append,
14
+ * counting the client's own. That number is a property of the topology in
15
+ * front of each service, so the provisioner sets it per provider and service
16
+ * (`CAELO_TRUSTED_PROXY_HOPS`, packages/provisioning/src/stack-contract.ts):
17
+ *
18
+ * - gcp: external Application LB appends `<client>,<LB IP>` and
19
+ * the service's ingress is internal-and-LB only → 2.
20
+ * - gcp-firebase: Cloud Run's front end appends the address it got the
21
+ * connection from → 1 (behind the Firebase Hosting
22
+ * rewrite that is the Hosting CDN edge, see the gateway's
23
+ * client-ip.ts).
24
+ * - self-hosted: Caddy (no `trusted_proxies`) replaces the header with
25
+ * the peer address; the service is reachable only on the
26
+ * Compose network → 1.
27
+ * - azure: Container Apps ingress appends the peer → 1.
28
+ * - 0: nothing in front (local dev): the TCP peer address.
29
+ *
30
+ * The MCP-Auth-Proxy is reached the same way as the gateway on every
31
+ * provider (on gcp-firebase directly on its run.app URL, on gcp through the
32
+ * load balancer), so the same counts apply to it.
33
+ */
34
+ /** The env var carrying the deployment's trusted proxy hop count. */
35
+ export const TRUSTED_PROXY_HOPS_ENV = "CAELO_TRUSTED_PROXY_HOPS";
36
+ /**
37
+ * The service cannot tell who the client is: the hop count is missing or
38
+ * invalid, or a request arrived with fewer forwarded entries than the
39
+ * deployment's proxies always append. Both are deployment errors; the
40
+ * message names the fix.
41
+ */
42
+ export class ClientAddressError extends Error {
43
+ name = "ClientAddressError";
44
+ }
45
+ /**
46
+ * The trusted proxy hop count from `env`.
47
+ *
48
+ * @throws ClientAddressError when it is unset or not a non-negative integer —
49
+ * guessing would either pool every client into one rate-limit bucket or
50
+ * let a client pick its own.
51
+ */
52
+ export function trustedProxyHopsFromEnv(env) {
53
+ const raw = env[TRUSTED_PROXY_HOPS_ENV];
54
+ if (raw === undefined || raw.trim() === "") {
55
+ throw new ClientAddressError(`${TRUSTED_PROXY_HOPS_ENV} is not set, so this service cannot tell which X-Forwarded-For entry is the client. Cloud and self-hosted installs: run \`cms-provision upgrade\` (the provisioner sets it per provider). Local dev without a proxy: set it to 0.`);
56
+ }
57
+ if (!/^\d+$/.test(raw.trim())) {
58
+ throw new ClientAddressError(`${TRUSTED_PROXY_HOPS_ENV}="${raw}" is not a non-negative integer (the number of X-Forwarded-For entries the proxies in front of this service append, counting the client's).`);
59
+ }
60
+ return Number.parseInt(raw.trim(), 10);
61
+ }
62
+ /**
63
+ * The entry `hops` places from the end of `xForwardedFor` (1 = the last), or
64
+ * null when the header has fewer entries than that.
65
+ *
66
+ * @example
67
+ * forwardedClientIp("6.6.6.6, 198.51.100.7, 34.1.2.3", 2) // → "198.51.100.7"
68
+ */
69
+ export function forwardedClientIp(xForwardedFor, hops) {
70
+ if (hops < 1 || !xForwardedFor)
71
+ return null;
72
+ const entries = xForwardedFor
73
+ .split(",")
74
+ .map((s) => s.trim())
75
+ .filter(Boolean);
76
+ return entries[entries.length - hops] ?? null;
77
+ }
78
+ /**
79
+ * The client address of `req` under `hops`.
80
+ *
81
+ * @param peerAddress the TCP peer (Bun `server.requestIP`); used only when
82
+ * `hops` is 0.
83
+ * @throws ClientAddressError when the request does not carry what the
84
+ * configured topology always adds.
85
+ */
86
+ export function clientAddress(req, hops, peerAddress) {
87
+ if (hops === 0) {
88
+ if (!peerAddress) {
89
+ throw new ClientAddressError(`${TRUSTED_PROXY_HOPS_ENV}=0 (no proxy) but the connection's peer address is unknown.`);
90
+ }
91
+ return peerAddress;
92
+ }
93
+ const ip = forwardedClientIp(req.headers.get("x-forwarded-for"), hops);
94
+ if (!ip) {
95
+ throw new ClientAddressError(`the request carries fewer than ${hops} X-Forwarded-For entries, but ${TRUSTED_PROXY_HOPS_ENV}=${hops} says the proxies in front of this service always append that many. Either a request reached the service around its proxy, or ${TRUSTED_PROXY_HOPS_ENV} does not match the deployment.`);
96
+ }
97
+ return ip;
98
+ }
99
+ //# sourceMappingURL=client-address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-address.js","sourceRoot":"","sources":["../src/client-address.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,qEAAqE;AACrE,MAAM,CAAC,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACzB,IAAI,GAAG,oBAAoB,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAiD;IACvF,MAAM,GAAG,GAAG,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACxC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3C,MAAM,IAAI,kBAAkB,CAC1B,GAAG,sBAAsB,mOAAmO,CAC7P,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,kBAAkB,CAC1B,GAAG,sBAAsB,KAAK,GAAG,6IAA6I,CAC/K,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,aAA4B,EAAE,IAAY;IAC1E,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,aAAa;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,OAAO,GAAG,aAAa;SAC1B,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,CAAC;IACnB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC;AAChD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY,EAAE,IAAY,EAAE,WAA0B;IAClF,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACf,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,kBAAkB,CAC1B,GAAG,sBAAsB,6DAA6D,CACvF,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,MAAM,EAAE,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,MAAM,IAAI,kBAAkB,CAC1B,kCAAkC,IAAI,iCAAiC,sBAAsB,IAAI,IAAI,iIAAiI,sBAAsB,iCAAiC,CAC9R,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
package/dist/context.d.ts CHANGED
@@ -33,6 +33,14 @@ export interface ExecutionContext {
33
33
  * only while exactly this artifact is the active, granted one.
34
34
  */
35
35
  readonly pluginArtifactDigest?: string;
36
+ /**
37
+ * #650 — the public origin of the static build a plugin's render-time
38
+ * call belongs to. `pages.resolve_public_urls` builds URLs on it
39
+ * instead of the stored site base URL, so a Stage with its own staging
40
+ * host gets staging URLs from plugins too. Set by the plugin host from
41
+ * the render invocation only.
42
+ */
43
+ readonly renderSiteBaseUrl?: string;
36
44
  /**
37
45
  * P10.5: parent attribution for subagent invocations. When the
38
46
  * `spawn_subagent` tool calls runChatTurn for the child, it carries
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC;;;;;;OAMG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC;;;;;;OAMG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * TLS of every database connection (#1338, gateway hardening L6).
3
+ *
4
+ * Every connection to a database on another machine uses
5
+ * `sslmode=verify-full`: the server's certificate must chain to a CA the
6
+ * install trusts AND name the host the client dialled. `sslmode=require`
7
+ * (what every provider used before) encrypts but checks neither, so anyone
8
+ * who can answer on the database's address can read the passwords and the
9
+ * data. There is no weaker mode for a remote host and no automatic downgrade
10
+ * (CLAUDE.md §2, no fallbacks): a URL that asks for less is refused with
11
+ * {@link databaseTlsProblem} wherever a process reads one from its
12
+ * environment (`databaseUrlFromEnv`).
13
+ *
14
+ * Which CA each provider's server presents, and so which bundle the client
15
+ * passes as `sslrootcert`:
16
+ *
17
+ * - gcp / gcp-firebase: Cloud SQL with the shared CA
18
+ * (`GOOGLE_MANAGED_CAS_CA`); its server certificate names the instance's
19
+ * DNS name, not its IP, so clients dial that name (resolved by a private
20
+ * Cloud DNS zone in the install's VPC) and trust Google's published root
21
+ * + regional bundle ({@link CLOUD_SQL_CA_BUNDLE}).
22
+ * - aws: RDS, the endpoint host name, Amazon's RDS bundle
23
+ * ({@link AWS_RDS_CA_BUNDLE}).
24
+ * - azure: Flexible Server, the server's FQDN; its certificate chains to
25
+ * public roots (DigiCert Global Root G2 / Microsoft RSA Root CA 2017)
26
+ * that Bun trusts out of the box, so no `sslrootcert`.
27
+ * - self-hosted: the compose Postgres serves a certificate for the host
28
+ * name `postgres`, signed by a CA the installer generates once per
29
+ * install ({@link SELF_HOSTED_CA_FILE}).
30
+ *
31
+ * The bundles ship in every image at {@link DATABASE_CA_DIR}
32
+ * (packages/shared/certs/ in the repo), so a URL built on the operator's
33
+ * machine names a path that exists in the container.
34
+ *
35
+ * Pure module — no I/O.
36
+ */
37
+ /** Where every Caelo image carries the database CA bundles (copied from packages/shared/certs/). */
38
+ export declare const DATABASE_CA_DIR = "/etc/caelo/db-ca";
39
+ /** Google's Cloud SQL shared-CA bundle (all regions), `cloudsql-ca-bundles/global.pem`. */
40
+ export declare const CLOUD_SQL_CA_BUNDLE = "/etc/caelo/db-ca/cloudsql-global.pem";
41
+ /** Amazon's RDS bundle (all regions), `truststore.pki.rds.amazonaws.com/global/global-bundle.pem`. */
42
+ export declare const AWS_RDS_CA_BUNDLE = "/etc/caelo/db-ca/aws-rds-global.pem";
43
+ /** The self-hosted install's own CA, mounted read-only into every container that connects. */
44
+ export declare const SELF_HOSTED_CA_FILE = "/etc/caelo/db-ca/self-hosted-ca.pem";
45
+ /**
46
+ * The query string of a verify-full connection, with `caFile` as the trust
47
+ * anchor (omit it for a server whose chain ends in a public root).
48
+ *
49
+ * @example
50
+ * verifyFullQuery(CLOUD_SQL_CA_BUNDLE)
51
+ * // → "sslmode=verify-full&sslrootcert=/etc/caelo/db-ca/cloudsql-global.pem"
52
+ */
53
+ export declare function verifyFullQuery(caFile?: string): string;
54
+ /** Whether `host` is an IPv4 or IPv6 literal (with or without URL brackets). */
55
+ export declare function isIpLiteral(host: string): boolean;
56
+ /**
57
+ * Why `url` may not be used to reach a database, or null when it may: a
58
+ * remote host needs `sslmode=verify-full`. Loopback hosts and unix sockets
59
+ * (`?host=/path`) are exempt. The message names the variable and the fix.
60
+ *
61
+ * @param label how the URL is known to the operator, e.g. `ADMIN_DATABASE_URL`
62
+ */
63
+ export declare function databaseTlsProblem(url: string, label?: string): string | null;
64
+ //# sourceMappingURL=database-tls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-tls.d.ts","sourceRoot":"","sources":["../src/database-tls.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,oGAAoG;AACpG,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAElD,2FAA2F;AAC3F,eAAO,MAAM,mBAAmB,yCAA2C,CAAC;AAE5E,sGAAsG;AACtG,eAAO,MAAM,iBAAiB,wCAA0C,CAAC;AAEzE,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB,wCAA0C,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGjD;AAWD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAiB,GAAG,MAAM,GAAG,IAAI,CAarF"}
@@ -0,0 +1,95 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ /**
3
+ * TLS of every database connection (#1338, gateway hardening L6).
4
+ *
5
+ * Every connection to a database on another machine uses
6
+ * `sslmode=verify-full`: the server's certificate must chain to a CA the
7
+ * install trusts AND name the host the client dialled. `sslmode=require`
8
+ * (what every provider used before) encrypts but checks neither, so anyone
9
+ * who can answer on the database's address can read the passwords and the
10
+ * data. There is no weaker mode for a remote host and no automatic downgrade
11
+ * (CLAUDE.md §2, no fallbacks): a URL that asks for less is refused with
12
+ * {@link databaseTlsProblem} wherever a process reads one from its
13
+ * environment (`databaseUrlFromEnv`).
14
+ *
15
+ * Which CA each provider's server presents, and so which bundle the client
16
+ * passes as `sslrootcert`:
17
+ *
18
+ * - gcp / gcp-firebase: Cloud SQL with the shared CA
19
+ * (`GOOGLE_MANAGED_CAS_CA`); its server certificate names the instance's
20
+ * DNS name, not its IP, so clients dial that name (resolved by a private
21
+ * Cloud DNS zone in the install's VPC) and trust Google's published root
22
+ * + regional bundle ({@link CLOUD_SQL_CA_BUNDLE}).
23
+ * - aws: RDS, the endpoint host name, Amazon's RDS bundle
24
+ * ({@link AWS_RDS_CA_BUNDLE}).
25
+ * - azure: Flexible Server, the server's FQDN; its certificate chains to
26
+ * public roots (DigiCert Global Root G2 / Microsoft RSA Root CA 2017)
27
+ * that Bun trusts out of the box, so no `sslrootcert`.
28
+ * - self-hosted: the compose Postgres serves a certificate for the host
29
+ * name `postgres`, signed by a CA the installer generates once per
30
+ * install ({@link SELF_HOSTED_CA_FILE}).
31
+ *
32
+ * The bundles ship in every image at {@link DATABASE_CA_DIR}
33
+ * (packages/shared/certs/ in the repo), so a URL built on the operator's
34
+ * machine names a path that exists in the container.
35
+ *
36
+ * Pure module — no I/O.
37
+ */
38
+ /** Where every Caelo image carries the database CA bundles (copied from packages/shared/certs/). */
39
+ export const DATABASE_CA_DIR = "/etc/caelo/db-ca";
40
+ /** Google's Cloud SQL shared-CA bundle (all regions), `cloudsql-ca-bundles/global.pem`. */
41
+ export const CLOUD_SQL_CA_BUNDLE = `${DATABASE_CA_DIR}/cloudsql-global.pem`;
42
+ /** Amazon's RDS bundle (all regions), `truststore.pki.rds.amazonaws.com/global/global-bundle.pem`. */
43
+ export const AWS_RDS_CA_BUNDLE = `${DATABASE_CA_DIR}/aws-rds-global.pem`;
44
+ /** The self-hosted install's own CA, mounted read-only into every container that connects. */
45
+ export const SELF_HOSTED_CA_FILE = `${DATABASE_CA_DIR}/self-hosted-ca.pem`;
46
+ /**
47
+ * The query string of a verify-full connection, with `caFile` as the trust
48
+ * anchor (omit it for a server whose chain ends in a public root).
49
+ *
50
+ * @example
51
+ * verifyFullQuery(CLOUD_SQL_CA_BUNDLE)
52
+ * // → "sslmode=verify-full&sslrootcert=/etc/caelo/db-ca/cloudsql-global.pem"
53
+ */
54
+ export function verifyFullQuery(caFile) {
55
+ return caFile ? `sslmode=verify-full&sslrootcert=${caFile}` : "sslmode=verify-full";
56
+ }
57
+ /** Whether `host` is an IPv4 or IPv6 literal (with or without URL brackets). */
58
+ export function isIpLiteral(host) {
59
+ const h = host.replace(/^\[|\]$/g, "");
60
+ return /^\d{1,3}(\.\d{1,3}){3}$/.test(h) || (h.includes(":") && /^[0-9a-f:.]+$/i.test(h));
61
+ }
62
+ /**
63
+ * Hosts on this machine: a connection to them never crosses a network, so
64
+ * dev, CI and the test suites connect without TLS.
65
+ */
66
+ function isLoopbackHost(host) {
67
+ const h = host.replace(/^\[|\]$/g, "").toLowerCase();
68
+ return h === "localhost" || h === "::1" || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h);
69
+ }
70
+ /**
71
+ * Why `url` may not be used to reach a database, or null when it may: a
72
+ * remote host needs `sslmode=verify-full`. Loopback hosts and unix sockets
73
+ * (`?host=/path`) are exempt. The message names the variable and the fix.
74
+ *
75
+ * @param label how the URL is known to the operator, e.g. `ADMIN_DATABASE_URL`
76
+ */
77
+ export function databaseTlsProblem(url, label = "database URL") {
78
+ let parsed;
79
+ try {
80
+ parsed = new URL(url);
81
+ }
82
+ catch {
83
+ return `${label} is not a valid URL`;
84
+ }
85
+ const socket = parsed.searchParams.get("host");
86
+ if (socket?.startsWith("/"))
87
+ return null;
88
+ if (parsed.hostname === "" || isLoopbackHost(parsed.hostname))
89
+ return null;
90
+ const mode = parsed.searchParams.get("sslmode");
91
+ if (mode === "verify-full")
92
+ return null;
93
+ return `${label} reaches ${parsed.hostname} with sslmode=${mode ?? "(none)"}; every connection to a database on another machine must use sslmode=verify-full, which checks the server's certificate and host name (#1338). Cloud and self-hosted installs: run \`cms-provision upgrade\` (it sets the URLs and the database's certificate up). Local development: connect to localhost.`;
94
+ }
95
+ //# sourceMappingURL=database-tls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-tls.js","sourceRoot":"","sources":["../src/database-tls.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,oGAAoG;AACpG,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAElD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,eAAe,sBAAsB,CAAC;AAE5E,sGAAsG;AACtG,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,eAAe,qBAAqB,CAAC;AAEzE,8FAA8F;AAC9F,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,eAAe,qBAAqB,CAAC;AAE3E;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,MAAe;IAC7C,OAAO,MAAM,CAAC,CAAC,CAAC,mCAAmC,MAAM,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC;AACtF,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACvC,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACrD,OAAO,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,KAAK,IAAI,kCAAkC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW,EAAE,KAAK,GAAG,cAAc;IACpE,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,KAAK,qBAAqB,CAAC;IACvC,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,IAAI,MAAM,CAAC,QAAQ,KAAK,EAAE,IAAI,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3E,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAChD,IAAI,IAAI,KAAK,aAAa;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,GAAG,KAAK,YAAY,MAAM,CAAC,QAAQ,iBAAiB,IAAI,IAAI,QAAQ,6SAA6S,CAAC;AAC3X,CAAC"}
@@ -1,18 +1,3 @@
1
- /**
2
- * Database connection URLs as every Caelo process reads them from its
3
- * environment.
4
- *
5
- * A URL var (`ADMIN_DATABASE_URL`, `PUBLIC_ADMIN_DATABASE_URL`,
6
- * `PUBLIC_DATABASE_URL`) may carry its password inline — the shape the
7
- * self-hosted compose stack, CI and `.env` use — or leave it out and have
8
- * the password come from a companion `<NAME>_PASSWORD` var
9
- * (`ADMIN_DATABASE_URL` → `ADMIN_DATABASE_PASSWORD`). Cloud installs use the
10
- * second shape: the URL (host, role, database) is a plain env var, the
11
- * password is a Secret Manager reference, so the password never shows up in
12
- * the service's configuration or its revision history.
13
- *
14
- * Pure module — no I/O.
15
- */
16
1
  /** The `<NAME>_PASSWORD` var that pairs with a `<NAME>_URL` var. */
17
2
  export declare function databasePasswordVar(urlVar: string): string;
18
3
  /**
@@ -40,6 +25,8 @@ export declare function databaseUrlFromEnv(urlVars: readonly string[], env?: Rea
40
25
  * how the in-cloud jobs (the operator-access sync job, the upgrader job)
41
26
  * connect: the user is the service account email without
42
27
  * `.gserviceaccount.com`, the password a short-lived OAuth access token.
28
+ * TLS is verify-full against Google's Cloud SQL shared-CA bundle, so `host`
29
+ * must be the instance's DNS name (its certificate names no IP).
43
30
  *
44
31
  * @example
45
32
  * cloudSqlIamDatabaseUrls("10.0.0.3", "job@p.iam.gserviceaccount.com", "ya29.x").user
@@ -1 +1 @@
1
- {"version":3,"file":"database-url.d.ts","sourceRoot":"","sources":["../src/database-url.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,KAAK,SAAiB,GACrB,MAAM,CAoBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GAC9D,MAAM,GAAG,SAAS,CASpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,MAAM,GAClB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAKjD"}
1
+ {"version":3,"file":"database-url.d.ts","sourceRoot":"","sources":["../src/database-url.ts"],"names":[],"mappings":"AA6BA,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,KAAK,SAAiB,GACrB,MAAM,CAoBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GAC9D,MAAM,GAAG,SAAS,CAWpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,MAAM,GAClB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAUjD"}
@@ -12,8 +12,13 @@
12
12
  * password is a Secret Manager reference, so the password never shows up in
13
13
  * the service's configuration or its revision history.
14
14
  *
15
+ * A URL that reaches a database on another machine must ask for
16
+ * `sslmode=verify-full` (database-tls.ts, #1338); {@link databaseUrlFromEnv}
17
+ * refuses one that does not.
18
+ *
15
19
  * Pure module — no I/O.
16
20
  */
21
+ import { CLOUD_SQL_CA_BUNDLE, databaseTlsProblem, isIpLiteral, verifyFullQuery, } from "./database-tls.js";
17
22
  /** The `<NAME>_PASSWORD` var that pairs with a `<NAME>_URL` var. */
18
23
  export function databasePasswordVar(urlVar) {
19
24
  if (!urlVar.endsWith("_URL")) {
@@ -64,6 +69,9 @@ export function databaseUrlFromEnv(urlVars, env = process.env) {
64
69
  const url = env[urlVar];
65
70
  if (!url)
66
71
  continue;
72
+ const tls = databaseTlsProblem(url, urlVar);
73
+ if (tls)
74
+ throw new Error(tls);
67
75
  const passwordVar = databasePasswordVar(urlVar);
68
76
  const password = env[passwordVar];
69
77
  return password ? withDatabasePassword(url, password, `${urlVar} (with ${passwordVar})`) : url;
@@ -75,14 +83,19 @@ export function databaseUrlFromEnv(urlVars, env = process.env) {
75
83
  * how the in-cloud jobs (the operator-access sync job, the upgrader job)
76
84
  * connect: the user is the service account email without
77
85
  * `.gserviceaccount.com`, the password a short-lived OAuth access token.
86
+ * TLS is verify-full against Google's Cloud SQL shared-CA bundle, so `host`
87
+ * must be the instance's DNS name (its certificate names no IP).
78
88
  *
79
89
  * @example
80
90
  * cloudSqlIamDatabaseUrls("10.0.0.3", "job@p.iam.gserviceaccount.com", "ya29.x").user
81
91
  * // → "job@p.iam"
82
92
  */
83
93
  export function cloudSqlIamDatabaseUrls(host, serviceAccountEmail, accessToken) {
94
+ if (isIpLiteral(host)) {
95
+ throw new Error(`the Cloud SQL host is the IP address ${host}, but the instance's certificate names only its DNS name, so a verify-full connection to it cannot succeed (#1338). Run the converge (\`cms-provision upgrade\`, or Install update for a cloud-setup release) — it moves the services onto the DNS name — then retry.`);
96
+ }
84
97
  const user = serviceAccountEmail.replace(/\.gserviceaccount\.com$/, "");
85
- const url = (db) => `postgresql://${encodeURIComponent(user)}:${encodeURIComponent(accessToken)}@${host}:5432/${db}?sslmode=require`;
98
+ const url = (db) => `postgresql://${encodeURIComponent(user)}:${encodeURIComponent(accessToken)}@${host}:5432/${db}?${verifyFullQuery(CLOUD_SQL_CA_BUNDLE)}`;
86
99
  return { admin: url("cms_admin"), public: url("cms_public"), user };
87
100
  }
88
101
  //# sourceMappingURL=database-url.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"database-url.js","sourceRoot":"","sources":["../src/database-url.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;GAcG;AAEH,oEAAoE;AACpE,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,0CAA0C,MAAM,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,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,MAAM,UAAU,uBAAuB,CACrC,IAAY,EACZ,mBAA2B,EAC3B,WAAmB;IAEnB,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,uQAAuQ,CACpT,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,mBAAmB,CAAC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;IACxE,MAAM,GAAG,GAAG,CAAC,EAAU,EAAE,EAAE,CACzB,gBAAgB,kBAAkB,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,WAAW,CAAC,IAAI,IAAI,SAAS,EAAE,IAAI,eAAe,CAAC,mBAAmB,CAAC,EAAE,CAAC;IAC3I,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;AACtE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,10 +3,12 @@ export * from "./ai-tools.js";
3
3
  export * from "./auth-forms.js";
4
4
  export * from "./auto-update.js";
5
5
  export * from "./base-css.js";
6
+ export * from "./body-cap.js";
6
7
  export * from "./bug-intake.js";
7
8
  export * from "./build-page.js";
8
9
  export * from "./cap-failures.js";
9
10
  export * from "./change-journal.js";
11
+ export * from "./client-address.js";
10
12
  export * from "./cloud-shell-install.js";
11
13
  export * from "./content.js";
12
14
  export * from "./context.js";
@@ -14,6 +16,7 @@ export * from "./css-gradient-scan.js";
14
16
  export * from "./css-scope-scan.js";
15
17
  export * from "./css-var-aliases.js";
16
18
  export * from "./css-var-scan.js";
19
+ export * from "./database-tls.js";
17
20
  export * from "./database-url.js";
18
21
  export * from "./design-draft-shell.js";
19
22
  export * from "./document-language.js";
@@ -30,6 +33,8 @@ export * from "./google-oauth.js";
30
33
  export * from "./id-safe-truncate.js";
31
34
  export * from "./image-capabilities.js";
32
35
  export * from "./interactions.js";
36
+ export * from "./interim-forwarded-host.js";
37
+ export * from "./json-security-headers.js";
33
38
  export * from "./link-canonicalise.js";
34
39
  export * from "./link-refs.js";
35
40
  export * from "./lists/index.js";
@@ -63,11 +68,13 @@ export * from "./run-batched.js";
63
68
  export * from "./safe-keys.js";
64
69
  export * from "./screenshot-capture.js";
65
70
  export * from "./seo.js";
71
+ export * from "./session-cookie.js";
66
72
  export * from "./skills.js";
67
73
  export * from "./snapshots.js";
68
74
  export * from "./source-text-transport.js";
69
75
  export * from "./stage-status.js";
70
76
  export * from "./staging-gate.js";
77
+ export * from "./staging-plugin-stub.js";
71
78
  export * from "./static-cache-policy.js";
72
79
  export * from "./static-security-headers.js";
73
80
  export * from "./strip-cdata.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,cAAc,CAAC;AAExC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;A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