@caelo-cms/provisioning 0.11.19 → 0.11.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-db.js +32 -0
- package/dist/aws-task-roles.d.ts +11 -0
- package/dist/aws-task-roles.d.ts.map +1 -1
- package/dist/aws-task-roles.js +19 -0
- package/dist/aws-task-roles.js.map +1 -1
- package/dist/azure-secrets.d.ts +22 -0
- package/dist/azure-secrets.d.ts.map +1 -0
- package/dist/azure-secrets.js +14 -0
- package/dist/azure-secrets.js.map +1 -0
- package/dist/caddy.d.ts +7 -0
- package/dist/caddy.d.ts.map +1 -1
- package/dist/caddy.js +22 -1
- package/dist/caddy.js.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/gateway-armor.d.ts +24 -0
- package/dist/gateway-armor.d.ts.map +1 -0
- package/dist/gateway-armor.js +118 -0
- package/dist/gateway-armor.js.map +1 -0
- package/dist/gateway-edge.d.ts +128 -0
- package/dist/gateway-edge.d.ts.map +1 -0
- package/dist/gateway-edge.js +211 -0
- package/dist/gateway-edge.js.map +1 -0
- package/dist/infra-contract.d.ts +1 -1
- package/dist/infra-contract.d.ts.map +1 -1
- package/dist/infra-contract.js +21 -1
- package/dist/infra-contract.js.map +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +8 -1
- package/dist/lifecycle.js.map +1 -1
- package/dist/pool-budget-stack.d.ts +22 -0
- package/dist/pool-budget-stack.d.ts.map +1 -1
- package/dist/pool-budget-stack.js +22 -1
- package/dist/pool-budget-stack.js.map +1 -1
- package/dist/public-service-shape.d.ts +45 -0
- package/dist/public-service-shape.d.ts.map +1 -0
- package/dist/public-service-shape.js +90 -0
- package/dist/public-service-shape.js.map +1 -0
- package/dist/remote-mcp-edge.d.ts +1 -1
- package/dist/remote-mcp-edge.js +1 -1
- package/dist/remote-mcp.d.ts.map +1 -1
- package/dist/remote-mcp.js +12 -2
- package/dist/remote-mcp.js.map +1 -1
- package/dist/serverless-backend.d.ts +27 -0
- package/dist/serverless-backend.d.ts.map +1 -0
- package/dist/serverless-backend.js +30 -0
- package/dist/serverless-backend.js.map +1 -0
- package/dist/stack-contract.d.ts +6 -0
- package/dist/stack-contract.d.ts.map +1 -1
- package/dist/stack-contract.js +24 -0
- package/dist/stack-contract.js.map +1 -1
- package/dist/stack-converge.d.ts +13 -0
- package/dist/stack-converge.d.ts.map +1 -1
- package/dist/stack-converge.js +27 -0
- package/dist/stack-converge.js.map +1 -1
- package/dist/staging-gateway-setup.d.ts +5 -0
- package/dist/staging-gateway-setup.d.ts.map +1 -1
- package/dist/staging-gateway-setup.js +60 -19
- package/dist/staging-gateway-setup.js.map +1 -1
- package/dist/upgrade/app-roll.d.ts +5 -1
- package/dist/upgrade/app-roll.d.ts.map +1 -1
- package/dist/upgrade/app-roll.js +20 -3
- package/dist/upgrade/app-roll.js.map +1 -1
- package/dist/upgrade/converge.d.ts.map +1 -1
- package/dist/upgrade/converge.js +27 -4
- package/dist/upgrade/converge.js.map +1 -1
- package/dist/upgrade/health.d.ts +13 -3
- package/dist/upgrade/health.d.ts.map +1 -1
- package/dist/upgrade/health.js +24 -7
- package/dist/upgrade/health.js.map +1 -1
- package/dist/upgrade/load-balancer-get.d.ts +17 -0
- package/dist/upgrade/load-balancer-get.d.ts.map +1 -0
- package/dist/upgrade/load-balancer-get.js +38 -0
- package/dist/upgrade/load-balancer-get.js.map +1 -0
- package/dist/upgrader-gcp.d.ts.map +1 -1
- package/dist/upgrader-gcp.js +8 -1
- package/dist/upgrader-gcp.js.map +1 -1
- package/dist/wizards/gcp-cost.d.ts +9 -0
- package/dist/wizards/gcp-cost.d.ts.map +1 -1
- package/dist/wizards/gcp-cost.js +69 -34
- package/dist/wizards/gcp-cost.js.map +1 -1
- package/package.json +2 -2
- package/src/aws-task-roles.ts +22 -0
- package/src/azure-secrets.ts +38 -0
- package/src/caddy.test.ts +19 -2
- package/src/caddy.ts +23 -0
- package/src/cli.ts +5 -0
- package/src/gateway-armor.ts +135 -0
- package/src/gateway-bootstrap.test.ts +1 -0
- package/src/gateway-edge.test.ts +262 -0
- package/src/gateway-edge.ts +256 -0
- package/src/gateway-env-isolation.test.ts +45 -6
- package/src/infra-contract.test.ts +5 -3
- package/src/infra-contract.ts +21 -1
- package/src/lifecycle.ts +8 -1
- package/src/pool-budget-stack.ts +25 -0
- package/src/pool-budget-stacks.test.ts +31 -0
- package/src/public-service-shape.test.ts +166 -0
- package/src/public-service-shape.ts +131 -0
- package/src/remote-mcp-edge.ts +1 -1
- package/src/remote-mcp.test.ts +38 -1
- package/src/remote-mcp.ts +25 -3
- package/src/serverless-backend.ts +47 -0
- package/src/stack-contract.test.ts +13 -0
- package/src/stack-contract.ts +25 -0
- package/src/stack-converge.test.ts +28 -1
- package/src/stack-converge.ts +30 -0
- package/src/staging-gateway-setup.test.ts +55 -3
- package/src/staging-gateway-setup.ts +79 -27
- package/src/upgrade/app-roll.ts +27 -3
- package/src/upgrade/converge.ts +33 -4
- package/src/upgrade/health.test.ts +88 -13
- package/src/upgrade/health.ts +32 -7
- package/src/upgrade/load-balancer-get.ts +64 -0
- package/src/upgrade/upgrade.test.ts +96 -3
- package/src/upgrader-gcp.ts +8 -1
- package/src/wizards/gcp-cost.ts +78 -35
- package/stacks/aws/index.ts +24 -22
- package/stacks/azure/index.ts +152 -64
- package/stacks/gcp/index.ts +35 -47
- package/stacks/gcp-firebase/index.ts +25 -13
package/stacks/gcp/index.ts
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Tier 1 — Static site: GCS + Cloud CDN + Managed SSL via single LB
|
|
7
7
|
* Tier 2 — Admin app: Cloud Run + Identity-Aware Proxy (allowlist)
|
|
8
|
-
* Tier 3 — API gateway: Cloud Run + Cloud Armor (path-prefix on the LB)
|
|
8
|
+
* Tier 3 — API gateway: Cloud Run + Cloud Armor (path-prefix on the LB);
|
|
9
|
+
* the staging gateway (#1330) shares the policy.
|
|
10
|
+
* Cloud Armor is an extra layer: the gateways
|
|
11
|
+
* protect themselves without it (E3 of #763)
|
|
9
12
|
* Tier 4 — Database: Cloud SQL Postgres on private VPC IP only
|
|
10
13
|
* Tier 5 — Workers: share the admin's Cloud Run process
|
|
11
14
|
*
|
|
@@ -14,7 +17,8 @@
|
|
|
14
17
|
* mapping (admin.<domain>) so IAP can gate it independently — IAP can't
|
|
15
18
|
* be attached selectively to one path of a multi-backend LB.
|
|
16
19
|
*
|
|
17
|
-
* Defaults: minimal-cost
|
|
20
|
+
* Defaults: minimal-cost; src/wizards/gcp-cost.ts prices every resource
|
|
21
|
+
* (the wizard shows it before `up`). Operators bump knobs to scale up.
|
|
18
22
|
*/
|
|
19
23
|
|
|
20
24
|
import * as gcp from "@pulumi/gcp";
|
|
@@ -22,6 +26,7 @@ import * as pulumi from "@pulumi/pulumi";
|
|
|
22
26
|
import * as random from "@pulumi/random";
|
|
23
27
|
import type { CloudAdapterOutputs, DnsRecord } from "../../dist/adapter.js";
|
|
24
28
|
import { generateBootstrapToken } from "../../dist/bootstrap-token.js";
|
|
29
|
+
import { gatewayArmorRuleArgs } from "../../dist/gateway-edge.js";
|
|
25
30
|
import {
|
|
26
31
|
gatewayServiceAccountId,
|
|
27
32
|
gcpBucketName,
|
|
@@ -969,6 +974,25 @@ const gatewaySvc = deployGateways
|
|
|
969
974
|
})
|
|
970
975
|
: null;
|
|
971
976
|
|
|
977
|
+
// Cloud Run checks a caller's identity whatever the ingress, and a visitor
|
|
978
|
+
// has none: without this binding every /api/ call answers Cloud Run's 403.
|
|
979
|
+
// Public only through the load balancer: the service's ingress closes its
|
|
980
|
+
// run.app URL. The MCP-Auth-Proxy and the staging gateway are CLI-owned and
|
|
981
|
+
// deployed with --allow-unauthenticated.
|
|
982
|
+
if (gatewaySvc) {
|
|
983
|
+
new gcp.cloudrunv2.ServiceIamMember(
|
|
984
|
+
`${namePrefix}-data-gateway-public-invoker`,
|
|
985
|
+
{
|
|
986
|
+
project,
|
|
987
|
+
location: region,
|
|
988
|
+
name: gatewaySvc.name,
|
|
989
|
+
role: "roles/run.invoker",
|
|
990
|
+
member: "allUsers",
|
|
991
|
+
},
|
|
992
|
+
opts,
|
|
993
|
+
);
|
|
994
|
+
}
|
|
995
|
+
|
|
972
996
|
// =========================================================================
|
|
973
997
|
// Tier 1 + Tier 2 + Tier 3 LB — single HTTPS LB serves three backends
|
|
974
998
|
// =========================================================================
|
|
@@ -996,54 +1020,18 @@ const lbIp = new gcp.compute.GlobalAddress(
|
|
|
996
1020
|
opts,
|
|
997
1021
|
);
|
|
998
1022
|
|
|
999
|
-
// Tier 3 — Cloud Armor security policy
|
|
1023
|
+
// Tier 3 — Cloud Armor security policy: per-path rate rules + OWASP packs
|
|
1024
|
+
// (#1339, src/gateway-edge.ts says why each rule is what it is; the converge
|
|
1025
|
+
// applies the same rules to existing installs, gateway-armor.ts). An extra
|
|
1026
|
+
// layer: every protection also lives in the gateway itself (E3 of #763).
|
|
1027
|
+
// #1328 — no remote-MCP rule here any more: the URL map sends /api/mcp/* to
|
|
1028
|
+
// the MCP-Auth-Proxy's backend, whose own policy carries it
|
|
1029
|
+
// (remote-mcp-edge.ts, created by the CLI).
|
|
1000
1030
|
const wafPolicy = new gcp.compute.SecurityPolicy(
|
|
1001
1031
|
`${namePrefix}-waf`,
|
|
1002
1032
|
{
|
|
1003
|
-
description: `Caelo ${env} Cloud Armor — rate
|
|
1004
|
-
rules:
|
|
1005
|
-
// #1328 — no remote-MCP rule here any more: the URL map sends
|
|
1006
|
-
// /api/mcp/* to the MCP-Auth-Proxy's backend, whose own policy carries
|
|
1007
|
-
// it (remote-mcp-edge.ts, created by the CLI; `upgrade` drops the old
|
|
1008
|
-
// rule from this policy).
|
|
1009
|
-
// Rate limit per source IP — 100 req / min sliding window.
|
|
1010
|
-
{
|
|
1011
|
-
action: "rate_based_ban",
|
|
1012
|
-
priority: 1000,
|
|
1013
|
-
match: {
|
|
1014
|
-
versionedExpr: "SRC_IPS_V1",
|
|
1015
|
-
config: { srcIpRanges: ["*"] },
|
|
1016
|
-
},
|
|
1017
|
-
rateLimitOptions: {
|
|
1018
|
-
rateLimitThreshold: { count: 100, intervalSec: 60 },
|
|
1019
|
-
conformAction: "allow",
|
|
1020
|
-
exceedAction: "deny(429)",
|
|
1021
|
-
enforceOnKey: "IP",
|
|
1022
|
-
banDurationSec: 600,
|
|
1023
|
-
},
|
|
1024
|
-
},
|
|
1025
|
-
// OWASP rule pack (preconfigured WAF) — free tier covers the basics.
|
|
1026
|
-
{
|
|
1027
|
-
action: "deny(403)",
|
|
1028
|
-
priority: 2000,
|
|
1029
|
-
match: {
|
|
1030
|
-
expr: { expression: "evaluatePreconfiguredWaf('sqli-v33-stable')" },
|
|
1031
|
-
},
|
|
1032
|
-
},
|
|
1033
|
-
{
|
|
1034
|
-
action: "deny(403)",
|
|
1035
|
-
priority: 2001,
|
|
1036
|
-
match: {
|
|
1037
|
-
expr: { expression: "evaluatePreconfiguredWaf('xss-v33-stable')" },
|
|
1038
|
-
},
|
|
1039
|
-
},
|
|
1040
|
-
// Default allow.
|
|
1041
|
-
{
|
|
1042
|
-
action: "allow",
|
|
1043
|
-
priority: 2147483647,
|
|
1044
|
-
match: { versionedExpr: "SRC_IPS_V1", config: { srcIpRanges: ["*"] } },
|
|
1045
|
-
},
|
|
1046
|
-
],
|
|
1033
|
+
description: `Caelo ${env} Cloud Armor — per-path rate rules + OWASP`,
|
|
1034
|
+
rules: gatewayArmorRuleArgs(),
|
|
1047
1035
|
...(wafAdaptiveProtection
|
|
1048
1036
|
? { adaptiveProtectionConfig: { layer7DdosDefenseConfig: { enable: true } } }
|
|
1049
1037
|
: {}),
|
|
@@ -9,16 +9,27 @@
|
|
|
9
9
|
* + IAP-on-Cloud-Run (no LB IAP)
|
|
10
10
|
* - Gateway: Cloud Run `caelo-<env>-data-gateway` + Firebase
|
|
11
11
|
* Hosting `rewrites` (no LB, no Cloud Armor)
|
|
12
|
+
* - Staging gateway: Cloud Run `caelo-<env>-staging-gateway` behind a
|
|
13
|
+
* second Hosting site's `**` rewrite (#1330)
|
|
12
14
|
* - MCP-Auth-Proxy: Cloud Run on its own run.app URL (#1328; the
|
|
13
15
|
* service that was the gateway, E13 a of #763)
|
|
14
16
|
* - Database: Cloud SQL Postgres on private VPC IP only (same
|
|
15
17
|
* as `gcp/`)
|
|
16
18
|
* - Workers: share admin Cloud Run (same as `gcp/`)
|
|
17
19
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* No load balancer and no WAF (epic #763 decision E3): this is the cheap
|
|
21
|
+
* setup. Leaving out the LB, Cloud CDN and the two Cloud Armor policies
|
|
22
|
+
* saves their lines of the cost table (src/wizards/gcp-cost.ts, the
|
|
23
|
+
* source of every price; about $37 a month at list prices). No protection
|
|
24
|
+
* depends on a WAF: the three public services are publicly invokable on
|
|
25
|
+
* their run.app URLs too (`allUsers`, needed by the Firebase rewrites and
|
|
26
|
+
* by MCP clients), so each one sheds junk and rate-limits itself before
|
|
27
|
+
* the database (in-memory budgets per client and per operation, captcha,
|
|
28
|
+
* per-operation database limits, `public_role`'s connection limit and
|
|
29
|
+
* timeouts; docs/dev/gateway-hardening.md), and the instance caps bound
|
|
30
|
+
* the rest. A public service whose feature is off answers a fixed 404
|
|
31
|
+
* before it reads the request (E14 a). Where a provider has a WAF (gcp:
|
|
32
|
+
* Cloud Armor), it is an extra layer.
|
|
22
33
|
*
|
|
23
34
|
* Code structure mirrors `packages/provisioning/stacks/gcp/index.ts`
|
|
24
35
|
* for the shared blocks (VPC, Secrets, Cloud SQL, run SA, Cloud Run
|
|
@@ -702,9 +713,9 @@ interface CloudRunArgs {
|
|
|
702
713
|
* in-memory filesystem and is lost with the instance.
|
|
703
714
|
*/
|
|
704
715
|
readonly mediaVolume?: ReturnType<typeof adminMediaVolumeTemplate>;
|
|
705
|
-
/** v0.3.1 — admin: ALL (so IAP gates internet traffic).
|
|
706
|
-
*
|
|
707
|
-
* rewrites
|
|
716
|
+
/** v0.3.1 — admin: ALL (so IAP gates internet traffic). Every
|
|
717
|
+
* service is ALL today: the public ones are reached through Firebase
|
|
718
|
+
* Hosting rewrites and their run.app URLs (E3 of #763). */
|
|
708
719
|
readonly ingress: "INGRESS_TRAFFIC_ALL" | "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER";
|
|
709
720
|
/** v0.3.1 — set true on admin so Cloud Run IAP gates traffic. */
|
|
710
721
|
readonly iapEnabled?: boolean;
|
|
@@ -926,9 +937,9 @@ const adminSvc = cloudRunService({
|
|
|
926
937
|
//
|
|
927
938
|
// v0.3.13 — Gateway is PUBLIC by design.
|
|
928
939
|
//
|
|
929
|
-
// Per the gcp-firebase architecture decision: no
|
|
930
|
-
// the gateway;
|
|
931
|
-
//
|
|
940
|
+
// Per the gcp-firebase architecture decision (E3 of #763): no LB and no
|
|
941
|
+
// Cloud Armor on the gateway; its own layers gate abuse (the file
|
|
942
|
+
// comment). The original plan was to grant the
|
|
932
943
|
// Firebase Hosting SA `roles/run.invoker` so Firebase rewrites
|
|
933
944
|
// could call the gateway as that SA. But the gcp-sa-firebasehosting
|
|
934
945
|
// SA is created lazily by Firebase on first Cloud-Run-rewrite
|
|
@@ -1319,9 +1330,10 @@ const out: CloudAdapterOutputs = {
|
|
|
1319
1330
|
bootstrapUrl:
|
|
1320
1331
|
pulumi.interpolate`https://${adminDomain}/setup?token=${tokenInfo.token}` as unknown as string,
|
|
1321
1332
|
dnsRecordsRequired: dnsRecords as unknown as DnsRecord[],
|
|
1322
|
-
//
|
|
1323
|
-
//
|
|
1324
|
-
|
|
1333
|
+
// #1339 — no BigQuery export here (that dataset was never created):
|
|
1334
|
+
// the services' request logs stay in Cloud Logging, the cross-cutting
|
|
1335
|
+
// single sink of CLAUDE.md §11.B, in the project's `_Default` bucket.
|
|
1336
|
+
edgeLogSinkUrl: `logging://${project}/_Default` as unknown as string,
|
|
1325
1337
|
provider: "gcp-firebase",
|
|
1326
1338
|
environment: env,
|
|
1327
1339
|
};
|