@sanoma-ai/connector-gcp 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +105 -0
- package/README.md +105 -2
- package/dist/authentication.d.ts +14 -0
- package/dist/authentication.js +59 -0
- package/dist/authentication.js.map +1 -0
- package/dist/connector.d.ts +173 -0
- package/dist/connector.js +23 -0
- package/dist/connector.js.map +1 -0
- package/dist/constraints.d.ts +8 -0
- package/dist/constraints.js +36 -0
- package/dist/constraints.js.map +1 -0
- package/dist/driver.d.ts +4 -0
- package/dist/driver.js +52 -0
- package/dist/driver.js.map +1 -0
- package/dist/fake.d.ts +158 -0
- package/dist/fake.js +18 -0
- package/dist/fake.js.map +1 -0
- package/dist/index.d.ts +350 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/resources.config.d.ts +9 -0
- package/dist/resources.config.js +26 -0
- package/dist/resources.config.js.map +1 -0
- package/dist/resources.d.ts +173 -0
- package/dist/resources.gen.d.ts +402 -0
- package/dist/resources.gen.js +651 -0
- package/dist/resources.gen.js.map +1 -0
- package/dist/resources.js +3 -0
- package/dist/resources.js.map +1 -0
- package/logo.svg +1 -0
- package/package.json +77 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-ALv2
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Sanoma-AI
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,106 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sanoma-ai/connector-gcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Google Cloud KMS and IAM provisioning through the pinned `hashicorp/google` **8.7.0** OpenTofu provider and isolated [bridge sessions](../../packages/bridge/README.md). This connector provisions infrastructure; it does not store credentials or supply the managed Cloud runtime's identity broker ([D1, #492](https://github.com/Sanoma-AI/sanoma/issues/492)).
|
|
4
|
+
|
|
5
|
+
The Google Cloud logo is the [official homepage asset](https://www.gstatic.com/cgc/google-cloud-logo-fullcolor.svg). Provider schema provenance and its verified download pin are recorded in `testdata/`; the provider binary is downloaded separately by the bridge.
|
|
6
|
+
|
|
7
|
+
## Resource types
|
|
8
|
+
|
|
9
|
+
| Constructor | Provider resource | Purpose |
|
|
10
|
+
| ------------------------------ | -------------------------------------------- | -------------------------------------------------------- |
|
|
11
|
+
| `gcp.keyRing` | `google_kms_key_ring` | KMS key ring in a project/location. |
|
|
12
|
+
| `gcp.cryptoKey` | `google_kms_crypto_key` | Symmetric encryption key and rotation settings. |
|
|
13
|
+
| `gcp.keyIamMember` | `google_kms_crypto_key_iam_member` | One member's role on one key. |
|
|
14
|
+
| `gcp.serviceAccount` | `google_service_account` | Service account, without a private key. |
|
|
15
|
+
| `gcp.serviceAccountIamMember` | `google_service_account_iam_member` | One member's role on a service account. |
|
|
16
|
+
| `gcp.workloadIdentityPool` | `google_iam_workload_identity_pool` | Workload identity pool. |
|
|
17
|
+
| `gcp.workloadIdentityProvider` | `google_iam_workload_identity_pool_provider` | OIDC issuer, claim mapping and explicit trust condition. |
|
|
18
|
+
|
|
19
|
+
The resource schemas are generated from the recorded provider schema; field names retain Google's provider spelling. Each type exposes read/import/plan and the apply workflow's create/update/delete operations. KMS key-ring/key deletion is refused, key replacement is refused during update, and key configuration uses `deletion_policy: "PREVENT"`. Retiring a key requires a separate retention procedure covering every encrypted value and recoverable backup. The driver refuses a desired purpose other than `ENCRYPT_DECRYPT` or an algorithm other than `GOOGLE_SYMMETRIC_ENCRYPTION`; signing and asymmetric keys are outside this connector’s scope.
|
|
20
|
+
|
|
21
|
+
## Deployment identity
|
|
22
|
+
|
|
23
|
+
`gcpWithIdentities` binds each named connection ID to trusted deployment configuration. Use the configured connector in `defineConfig`; the exported bare `gcp` has no live identity mapping.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
// sanoma.config.ts: trusted deployment composition, never workflow input
|
|
27
|
+
import { defineConfig, defineConnection } from "sanoma";
|
|
28
|
+
import { gcpWithIdentities } from "@sanoma-ai/connector-gcp";
|
|
29
|
+
|
|
30
|
+
const gcp = gcpWithIdentities({
|
|
31
|
+
"gcp/provisioning": {
|
|
32
|
+
project: "example-company",
|
|
33
|
+
projectNumber: "123456789012",
|
|
34
|
+
serviceAccount: "provisioner@example-company.iam.gserviceaccount.com",
|
|
35
|
+
credentialsFile: "/run/sanoma/gcp-wif.json",
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const provisioning = defineConnection(gcp, {
|
|
39
|
+
name: "provisioning",
|
|
40
|
+
method: "workloadIdentity",
|
|
41
|
+
account: "provisioner@example-company.iam.gserviceaccount.com/example-company/123456789012",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export default defineConfig({ connectors: [gcp], connections: [provisioning] });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The mapping contains a file **path**, not its contents. Deliver the file through the trusted deployment environment; keep its contents and source tokens out of code, resource inputs, fixtures, logs and the secret-entry form. Treat this configuration and its file as security-sensitive even though no service-account private key is involved. Connect/verify the named account through the normal connection lifecycle; a declaration alone is not a verified binding.
|
|
48
|
+
|
|
49
|
+
Only an explicit `external_account` OIDC federation file is accepted. It must use Google's STS endpoint, a JWT subject token and impersonation of the exact configured service account. Service-account key files, executable sources, AWS environment sources and ambient ADC fallback are refused. A successful token exchange and impersonation verify the selected identity; a configured email alone is not proof. Verification returns the account identity and an empty scope list, not the access token or an attestation of individual IAM grants. Google IAM remains authoritative for permissions.
|
|
50
|
+
|
|
51
|
+
The provider receives that explicit federation configuration inside a fresh session for each authorized operation. The driver checks project IDs/numbers in resource identifiers and fields against the selected deployment. The provisioning account's Google IAM grants must also limit its authority: application-side checks do not replace IAM isolation. Give provisioning and company runtime different service accounts and roles; a company runtime must not inherit the provisioning account's IAM administration permissions.
|
|
52
|
+
|
|
53
|
+
### First administrator setup
|
|
54
|
+
|
|
55
|
+
An administrator must first establish the project, billing, required APIs, provisioning service account and initial federation trust using an existing authorized administration path. This connector has no project, billing or API-enablement resource. Grant the provisioning account only the KMS/IAM administration needed for its intended declarations, and grant the approved federated principal service-account impersonation access. Once that trust works, Sanoma can manage subsequent resources or import existing ones. See [Google's deployment-pipeline WIF setup](https://docs.cloud.google.com/iam/docs/workload-identity-federation-with-deployment-pipelines).
|
|
56
|
+
|
|
57
|
+
For GitHub Actions, bind trust to numeric `repository_owner_id` and `repository_id`, which survive name reuse safely. Map `google.subject` and any attributes used in principal bindings. Set an explicit provider condition; do not trust every repository under the shared GitHub issuer. Google describes these numeric claims in its [attribute-mapping guidance](https://docs.cloud.google.com/iam/docs/workload-identity-federation-with-deployment-pipelines#define_an_attribute_mapping).
|
|
58
|
+
|
|
59
|
+
Restrict branch, workflow and environment as well. For example, a policy for a production provisioning job can require all of these claims (replace every example with the intended deployment):
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
assertion.repository_owner_id == '1234567' &&
|
|
63
|
+
assertion.repository_id == '7654321' &&
|
|
64
|
+
assertion.ref == 'refs/heads/main' &&
|
|
65
|
+
assertion.workflow_ref == 'example/company/.github/workflows/provision.yml@refs/heads/main' &&
|
|
66
|
+
assertion.environment == 'production'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The job must use that protected environment and request OIDC with `id-token: write`. Review the actual claims for the workflow; reusable workflows also expose `job_workflow_ref`. Protect changes to the trusted workflow and environment. See [GitHub's OIDC claims and permissions](https://docs.github.com/en/actions/reference/security/oidc). The connector requires a nonempty OIDC trust condition; it does not infer or enforce this particular GitHub policy for you.
|
|
70
|
+
|
|
71
|
+
The subject-token source must remain renewable for the full provisioning operation. A file holding one expiring JWT is not a long-lived identity service. Provide a source that refreshes its token or a supported refreshable URL source; both the Node verifier and provider process must be able to read it. Test renewal through expiry in the target environment. A GitHub job's identity belongs to that job, not to a subsequently hosted company runtime; runtime renewal remains D1's separate boundary.
|
|
72
|
+
|
|
73
|
+
## Authoring resources
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
// resources/gcp.ts
|
|
77
|
+
import { gcp } from "@sanoma-ai/connector-gcp/resources";
|
|
78
|
+
|
|
79
|
+
const connection = { vendor: "gcp", $connection: "gcp/provisioning" } as const;
|
|
80
|
+
export const ring = gcp.keyRing(
|
|
81
|
+
{ project: "example-company", location: "us-central1", name: "company-secrets" },
|
|
82
|
+
{ connection },
|
|
83
|
+
);
|
|
84
|
+
export const key = gcp.cryptoKey(
|
|
85
|
+
{
|
|
86
|
+
name: "production",
|
|
87
|
+
key_ring: ring,
|
|
88
|
+
purpose: "ENCRYPT_DECRYPT",
|
|
89
|
+
version_template: { algorithm: "GOOGLE_SYMMETRIC_ENCRYPTION", protection_level: "SOFTWARE" },
|
|
90
|
+
deletion_policy: "PREVENT",
|
|
91
|
+
},
|
|
92
|
+
{ connection },
|
|
93
|
+
);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Grant runtime encrypt/decrypt access with `keyIamMember` on the specific key. Keep production and preview identities separate. Rotation creates new key versions; it does not by itself re-encrypt stored ciphertext or retire versions needed by backups. This provisioning surface is separate from the credential-storage adapter in [#470](https://github.com/Sanoma-AI/sanoma/issues/470).
|
|
97
|
+
|
|
98
|
+
## Testing and current evidence
|
|
99
|
+
|
|
100
|
+
`fakeGcp` is the bridge's in-memory resource fake; it is not Google IAM or a federation server. Authentication tests use synthetic STS/IAM responses and temporary token/config files, including separate account sources, denied impersonation, rejected key/executable configs and sanitized failures. Driver tests use a provider state double to check concurrent session separation, project/account refusals, symmetric-key and retention guards, OIDC condition requirements, sanitized failures and the fake. The recorded schema/pin in `testdata/` establishes the generated provider contract, not a successful cloud deployment.
|
|
101
|
+
|
|
102
|
+
The [isolated live run](https://github.com/Sanoma-AI/sanoma/actions/runs/41164779676) passed on `e43fb77c1e05d51838687d4574b2678218983386` in project `sanoma-513217`: GitHub OIDC → WIF → scoped provisioning account, denied impersonation of another existing account, real Google-provider key create/read/update, rotation-period update and key-deletion refusal. One provider session remained active for 660 seconds and fetched a fresh OIDC subject token after its ten-minute impersonated token expired. Trust was restricted to numeric repository/owner IDs, branch, workflow and the exact reviewed commit. This proves that provisioning path; it does not establish live CRUD for all seven resource types or a company runtime's identity.
|
|
103
|
+
|
|
104
|
+
The manual `gcp-live.yml` workflow accepts project ID/number, provisioner and denied-account emails, disposable key-ring name and WIF audience as inputs. Administrators must enable billing/APIs, establish narrowly scoped federation and ring permissions, and restrict trust to the intended repository, workflow, ref and reviewed commit before running it. The denied account must exist without an impersonation grant to that federation. No service-account private key is needed. Ordinary CI skips `test/live.test.ts`; only the dedicated workflow enables it. The test creates a synthetic key, so retire all its versions after verification; KMS key/ring metadata remains. Never use a production ring. Provisioning and renewable runtime identity remain separate.
|
|
105
|
+
|
|
106
|
+
Run `pnpm vitest run connectors/gcp` and the repository's type/lint/build checks. Regenerate types with `pnpm --filter @sanoma-ai/connector-gcp generate`; update the recorded schema/pins deliberately, and never edit `resources.gen.ts` by hand. Test-map details are in [test/AGENTS.md](test/AGENTS.md).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AuthenticationContext } from "@sanoma-ai/workflows";
|
|
2
|
+
/** Trusted deployment configuration. The file is generated by the workload's OIDC integration. */
|
|
3
|
+
export interface GcpIdentity {
|
|
4
|
+
project: string;
|
|
5
|
+
projectNumber: string;
|
|
6
|
+
serviceAccount: string;
|
|
7
|
+
credentialsFile: string;
|
|
8
|
+
}
|
|
9
|
+
export type GcpIdentities = Readonly<Record<string, GcpIdentity>>;
|
|
10
|
+
export declare function identityFor(identities: GcpIdentities, context?: AuthenticationContext): GcpIdentity;
|
|
11
|
+
/** Explicit WIF config only: no ambient ADC fallback, service-account key or executable source. */
|
|
12
|
+
export declare function federationCredentials(identity: GcpIdentity): Promise<Record<string, unknown>>;
|
|
13
|
+
export declare const accountOf: (identity: GcpIdentity) => string;
|
|
14
|
+
export declare function gcpAuthentication(identities: GcpIdentities): import("@sanoma-ai/workflows").Authentication<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { GoogleAuth } from "google-auth-library";
|
|
3
|
+
import { AuthenticationError, defineAuthentication } from "@sanoma-ai/workflows";
|
|
4
|
+
export function identityFor(identities, context) {
|
|
5
|
+
const identity = context?.vendor === "gcp" ? identities[context.connectionId] : undefined;
|
|
6
|
+
if (!identity ||
|
|
7
|
+
!/^[a-z][a-z0-9-]{4,28}[a-z0-9]$/.test(identity.project) ||
|
|
8
|
+
!/^[1-9][0-9]+$/.test(identity.projectNumber) ||
|
|
9
|
+
!/^[a-z][a-z0-9-]+@[a-z][a-z0-9-]+\.iam\.gserviceaccount\.com$/.test(identity.serviceAccount) ||
|
|
10
|
+
!identity.credentialsFile)
|
|
11
|
+
throw new AuthenticationError("missing");
|
|
12
|
+
return identity;
|
|
13
|
+
}
|
|
14
|
+
/** Explicit WIF config only: no ambient ADC fallback, service-account key or executable source. */
|
|
15
|
+
export async function federationCredentials(identity) {
|
|
16
|
+
try {
|
|
17
|
+
const text = await readFile(identity.credentialsFile, "utf8");
|
|
18
|
+
if (Buffer.byteLength(text) > 65_536)
|
|
19
|
+
throw new Error();
|
|
20
|
+
const config = JSON.parse(text);
|
|
21
|
+
const impersonation = `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${identity.serviceAccount}:generateAccessToken`;
|
|
22
|
+
if (config.type !== "external_account" ||
|
|
23
|
+
config.token_url !== "https://sts.googleapis.com/v1/token" ||
|
|
24
|
+
config.service_account_impersonation_url !== impersonation ||
|
|
25
|
+
config.subject_token_type !== "urn:ietf:params:oauth:token-type:jwt" ||
|
|
26
|
+
typeof config.audience !== "string" ||
|
|
27
|
+
!config.audience.startsWith("//iam.googleapis.com/projects/") ||
|
|
28
|
+
!config.credential_source ||
|
|
29
|
+
config.credential_source.executable ||
|
|
30
|
+
config.credential_source.environment_id)
|
|
31
|
+
throw new Error();
|
|
32
|
+
return config;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
throw new AuthenticationError("rejected");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export const accountOf = (identity) => `${identity.serviceAccount}/${identity.project}/${identity.projectNumber}`;
|
|
39
|
+
export function gcpAuthentication(identities) {
|
|
40
|
+
return defineAuthentication({
|
|
41
|
+
kind: "workload-identity",
|
|
42
|
+
async verify(context) {
|
|
43
|
+
const identity = identityFor(identities, context);
|
|
44
|
+
const credentials = await federationCredentials(identity);
|
|
45
|
+
try {
|
|
46
|
+
// Successful impersonation proves the source may mint for this exact configured account.
|
|
47
|
+
// The provider independently refreshes the same source during its operation session.
|
|
48
|
+
const auth = new GoogleAuth({ credentials, scopes: ["https://www.googleapis.com/auth/cloud-platform"] });
|
|
49
|
+
if (!(await auth.getAccessToken()))
|
|
50
|
+
throw new Error();
|
|
51
|
+
return { account: accountOf(identity), scopes: [] };
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
throw new AuthenticationError("unavailable");
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=authentication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO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AAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export declare const gcpTf: import("@sanoma-ai/bridge/connector").TfConnector<"gcp", {
|
|
2
|
+
keyRing: import("zod").ZodObject<{
|
|
3
|
+
id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
4
|
+
location: import("zod").ZodString;
|
|
5
|
+
name: import("zod").ZodString;
|
|
6
|
+
project: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
7
|
+
timeouts: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
8
|
+
create: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
9
|
+
delete: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
10
|
+
}, import("zod/v4/core").$strip>>>;
|
|
11
|
+
}, import("zod/v4/core").$strip>;
|
|
12
|
+
cryptoKey: import("zod").ZodObject<{
|
|
13
|
+
crypto_key_backend: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
14
|
+
deletion_policy: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
15
|
+
destroy_scheduled_duration: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
16
|
+
effective_labels: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>>;
|
|
17
|
+
id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
18
|
+
import_only: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
19
|
+
key_ring: import("zod").ZodString;
|
|
20
|
+
labels: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>>;
|
|
21
|
+
name: import("zod").ZodString;
|
|
22
|
+
primary: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodObject<{
|
|
23
|
+
name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
24
|
+
state: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
25
|
+
}, import("zod/v4/core").$strip>>>>;
|
|
26
|
+
purpose: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
27
|
+
rotation_period: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
28
|
+
skip_initial_version_creation: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
29
|
+
terraform_labels: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>>;
|
|
30
|
+
timeouts: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
31
|
+
create: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
32
|
+
delete: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
33
|
+
update: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
34
|
+
}, import("zod/v4/core").$strip>>>;
|
|
35
|
+
version_template: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
36
|
+
algorithm: import("zod").ZodString;
|
|
37
|
+
protection_level: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
38
|
+
}, import("zod/v4/core").$strip>>>;
|
|
39
|
+
}, import("zod/v4/core").$strip>;
|
|
40
|
+
keyIamMember: import("zod").ZodObject<{
|
|
41
|
+
crypto_key_id: import("zod").ZodString;
|
|
42
|
+
etag: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
43
|
+
id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
44
|
+
member: import("zod").ZodString;
|
|
45
|
+
role: import("zod").ZodString;
|
|
46
|
+
condition: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
47
|
+
description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
48
|
+
expression: import("zod").ZodString;
|
|
49
|
+
title: import("zod").ZodString;
|
|
50
|
+
}, import("zod/v4/core").$strip>>>;
|
|
51
|
+
}, import("zod/v4/core").$strip>;
|
|
52
|
+
serviceAccount: import("zod").ZodObject<{
|
|
53
|
+
account_id: import("zod").ZodString;
|
|
54
|
+
create_ignore_already_exists: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
55
|
+
deletion_policy: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
56
|
+
description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
57
|
+
disabled: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
58
|
+
display_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
59
|
+
email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
60
|
+
id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
61
|
+
member: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
62
|
+
name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
63
|
+
project: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
64
|
+
unique_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
65
|
+
timeouts: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
66
|
+
create: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
67
|
+
}, import("zod/v4/core").$strip>>>;
|
|
68
|
+
}, import("zod/v4/core").$strip>;
|
|
69
|
+
serviceAccountIamMember: import("zod").ZodObject<{
|
|
70
|
+
etag: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
71
|
+
id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
72
|
+
member: import("zod").ZodString;
|
|
73
|
+
role: import("zod").ZodString;
|
|
74
|
+
service_account_id: import("zod").ZodString;
|
|
75
|
+
condition: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
76
|
+
description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
77
|
+
expression: import("zod").ZodString;
|
|
78
|
+
title: import("zod").ZodString;
|
|
79
|
+
}, import("zod/v4/core").$strip>>>;
|
|
80
|
+
}, import("zod/v4/core").$strip>;
|
|
81
|
+
workloadIdentityPool: import("zod").ZodObject<{
|
|
82
|
+
deletion_policy: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
83
|
+
description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
84
|
+
disabled: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
85
|
+
display_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
86
|
+
id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
87
|
+
mode: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
88
|
+
name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
89
|
+
project: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
90
|
+
state: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
91
|
+
workload_identity_pool_id: import("zod").ZodString;
|
|
92
|
+
attestation_rules: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodObject<{
|
|
93
|
+
google_cloud_resource: import("zod").ZodString;
|
|
94
|
+
}, import("zod/v4/core").$strip>>>>;
|
|
95
|
+
inline_certificate_issuance_config: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
96
|
+
ca_pools: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>>;
|
|
97
|
+
key_algorithm: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
98
|
+
lifetime: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
99
|
+
rotation_window_percentage: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
100
|
+
use_default_shared_ca: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
101
|
+
}, import("zod/v4/core").$strip>>>;
|
|
102
|
+
inline_trust_config: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
103
|
+
additional_trust_bundles: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodObject<{
|
|
104
|
+
trust_default_shared_ca: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
105
|
+
trust_domain: import("zod").ZodString;
|
|
106
|
+
trust_anchors: import("zod").ZodArray<import("zod").ZodObject<{
|
|
107
|
+
pem_certificate: import("zod").ZodString;
|
|
108
|
+
}, import("zod/v4/core").$strip>>;
|
|
109
|
+
}, import("zod/v4/core").$strip>>>>;
|
|
110
|
+
}, import("zod/v4/core").$strip>>>;
|
|
111
|
+
timeouts: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
112
|
+
create: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
113
|
+
delete: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
114
|
+
update: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
115
|
+
}, import("zod/v4/core").$strip>>>;
|
|
116
|
+
}, import("zod/v4/core").$strip>;
|
|
117
|
+
workloadIdentityProvider: import("zod").ZodObject<{
|
|
118
|
+
attribute_condition: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
119
|
+
attribute_mapping: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>>;
|
|
120
|
+
deletion_policy: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
121
|
+
description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
122
|
+
disabled: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
123
|
+
display_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
124
|
+
id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
125
|
+
name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
126
|
+
project: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
127
|
+
state: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
128
|
+
workload_identity_pool_id: import("zod").ZodString;
|
|
129
|
+
workload_identity_pool_provider_id: import("zod").ZodString;
|
|
130
|
+
aws: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
131
|
+
account_id: import("zod").ZodString;
|
|
132
|
+
}, import("zod/v4/core").$strip>>>;
|
|
133
|
+
oidc: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
134
|
+
allowed_audiences: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodString>>>;
|
|
135
|
+
issuer_uri: import("zod").ZodString;
|
|
136
|
+
jwks_json: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
137
|
+
}, import("zod/v4/core").$strip>>>;
|
|
138
|
+
saml: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
139
|
+
idp_metadata_xml: import("zod").ZodString;
|
|
140
|
+
}, import("zod/v4/core").$strip>>>;
|
|
141
|
+
timeouts: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
142
|
+
create: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
143
|
+
delete: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
144
|
+
update: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
145
|
+
}, import("zod/v4/core").$strip>>>;
|
|
146
|
+
x509: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
|
|
147
|
+
trust_store: import("zod").ZodObject<{
|
|
148
|
+
intermediate_cas: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodObject<{
|
|
149
|
+
pem_certificate: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
150
|
+
}, import("zod/v4/core").$strip>>>>;
|
|
151
|
+
trust_anchors: import("zod").ZodArray<import("zod").ZodObject<{
|
|
152
|
+
pem_certificate: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
153
|
+
}, import("zod/v4/core").$strip>>;
|
|
154
|
+
}, import("zod/v4/core").$strip>;
|
|
155
|
+
}, import("zod/v4/core").$strip>>>;
|
|
156
|
+
}, import("zod/v4/core").$strip>;
|
|
157
|
+
}, {
|
|
158
|
+
readonly cryptoKey: {
|
|
159
|
+
readonly key_ring: {
|
|
160
|
+
readonly type: "gcp.keyRing";
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
readonly keyIamMember: {
|
|
164
|
+
readonly crypto_key_id: {
|
|
165
|
+
readonly type: "gcp.cryptoKey";
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
readonly serviceAccountIamMember: {
|
|
169
|
+
readonly service_account_id: {
|
|
170
|
+
readonly type: "gcp.serviceAccount";
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { tfConnector } from "@sanoma-ai/bridge/connector";
|
|
2
|
+
import { vendorInfo } from "@sanoma-ai/workflows";
|
|
3
|
+
import { provider, google_kms_key_ring, google_kms_crypto_key, google_kms_crypto_key_iam_member, google_service_account, google_service_account_iam_member, google_iam_workload_identity_pool, google_iam_workload_identity_pool_provider, } from "./resources.gen.js";
|
|
4
|
+
export const gcpTf = tfConnector({
|
|
5
|
+
vendor: "gcp",
|
|
6
|
+
provider,
|
|
7
|
+
info: vendorInfo(import.meta.url),
|
|
8
|
+
types: {
|
|
9
|
+
keyRing: { tf: google_kms_key_ring, title: "KMS key ring", writable: true },
|
|
10
|
+
cryptoKey: { tf: google_kms_crypto_key, title: "KMS key", writable: true },
|
|
11
|
+
keyIamMember: { tf: google_kms_crypto_key_iam_member, title: "KMS key access", writable: true },
|
|
12
|
+
serviceAccount: { tf: google_service_account, title: "Service account", writable: true },
|
|
13
|
+
serviceAccountIamMember: { tf: google_service_account_iam_member, title: "Service account access", writable: true },
|
|
14
|
+
workloadIdentityPool: { tf: google_iam_workload_identity_pool, title: "Workload identity pool", writable: true },
|
|
15
|
+
workloadIdentityProvider: { tf: google_iam_workload_identity_pool_provider, title: "OIDC trust", writable: true },
|
|
16
|
+
},
|
|
17
|
+
references: {
|
|
18
|
+
cryptoKey: { key_ring: { type: "gcp.keyRing" } },
|
|
19
|
+
keyIamMember: { crypto_key_id: { type: "gcp.cryptoKey" } },
|
|
20
|
+
serviceAccountIamMember: { service_account_id: { type: "gcp.serviceAccount" } },
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector.js","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,QA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AI,EAAE,oBAAoB,EAAE,EAAE;KAChF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProviderClient } from "@sanoma-ai/bridge";
|
|
2
|
+
/** The same retention and trust rules apply to live and simulated resources. */
|
|
3
|
+
export declare function constrain(operation: string, input: {
|
|
4
|
+
desired?: Record<string, unknown>;
|
|
5
|
+
}): {
|
|
6
|
+
desired?: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
export declare function retainKeys(bridge: ProviderClient): ProviderClient;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DriverError } from "@sanoma-ai/workflows";
|
|
2
|
+
/** The same retention and trust rules apply to live and simulated resources. */
|
|
3
|
+
export function constrain(operation, input) {
|
|
4
|
+
const [type, action] = operation.split(".");
|
|
5
|
+
if ((type === "cryptoKey" || type === "keyRing") && action === "delete")
|
|
6
|
+
throw new DriverError("gcp: retire KMS keys through the explicit retention procedure", { retryable: false });
|
|
7
|
+
const desired = input.desired && { ...input.desired };
|
|
8
|
+
if (desired && type === "cryptoKey") {
|
|
9
|
+
const template = desired.version_template;
|
|
10
|
+
if ((desired.purpose && desired.purpose !== "ENCRYPT_DECRYPT") ||
|
|
11
|
+
(template?.algorithm && template.algorithm !== "GOOGLE_SYMMETRIC_ENCRYPTION"))
|
|
12
|
+
throw new DriverError("gcp: only symmetric encryption keys are supported", { retryable: false });
|
|
13
|
+
if (desired.deletion_policy && desired.deletion_policy !== "PREVENT")
|
|
14
|
+
throw new DriverError("gcp: KMS deletion_policy must be PREVENT", { retryable: false });
|
|
15
|
+
desired.deletion_policy = "PREVENT";
|
|
16
|
+
}
|
|
17
|
+
if (desired &&
|
|
18
|
+
type === "workloadIdentityProvider" &&
|
|
19
|
+
(!desired.oidc || desired.aws || desired.saml || !String(desired.attribute_condition ?? "").trim()))
|
|
20
|
+
throw new DriverError("gcp: OIDC trust requires an issuer and an explicit attribute condition", {
|
|
21
|
+
retryable: false,
|
|
22
|
+
});
|
|
23
|
+
return { ...input, ...(desired && { desired }) };
|
|
24
|
+
}
|
|
25
|
+
export function retainKeys(bridge) {
|
|
26
|
+
return {
|
|
27
|
+
...bridge,
|
|
28
|
+
plan: async (...args) => {
|
|
29
|
+
const result = await bridge.plan(...args);
|
|
30
|
+
if (["google_kms_crypto_key", "google_kms_key_ring"].includes(args[1]) && result.action === "replace")
|
|
31
|
+
throw new DriverError("gcp: KMS replacement requires explicit retirement", { retryable: false });
|
|
32
|
+
return result;
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=constraints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints.js","sourceRoot":"","sources":["../src/constraints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,gFAAgF;AAChF,MAAM,UAAU,SAAS,CAAC,SAAiB,EAAE,KAA4C;IACvF,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,SAAS,CAAC,IAAI,MAAM,KAAK,QAAQ;QACrE,MAAM,IAAI,WAAW,CAAC,+DAA+D,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/G,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IACtD,IAAI,OAAO,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAsD,CAAC;QAChF,IACE,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,iBAAiB,CAAC;YAC1D,CAAC,QAAQ,EAAE,SAAS,IAAI,QAAQ,CAAC,SAAS,KAAK,6BAA6B,CAAC;YAE7E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+1,52 @@
|
|
|
1
|
+
import { defaultBridge } from "@sanoma-ai/bridge";
|
|
2
|
+
import { AuthenticationError, DriverError } from "@sanoma-ai/workflows";
|
|
3
|
+
import { accountOf, federationCredentials, identityFor } from "./authentication.js";
|
|
4
|
+
import { gcpTf } from "./connector.js";
|
|
5
|
+
import { constrain, retainKeys } from "./constraints.js";
|
|
6
|
+
export function gcpDriver(identities, bridge = defaultBridge()) {
|
|
7
|
+
return {
|
|
8
|
+
vendor: "gcp",
|
|
9
|
+
authentication: ["workloadIdentity"],
|
|
10
|
+
ops: Object.fromEntries(Object.keys(gcpTf.driver(bridge, () => ({})).ops).map((operation) => [
|
|
11
|
+
operation,
|
|
12
|
+
async (input, call) => {
|
|
13
|
+
if (call.authentication?.method !== "workloadIdentity" || !call.connection)
|
|
14
|
+
throw new AuthenticationError("missing");
|
|
15
|
+
const identity = identityFor(identities, {
|
|
16
|
+
connectionId: call.connection.id,
|
|
17
|
+
vendor: call.connection.vendor,
|
|
18
|
+
});
|
|
19
|
+
if (call.connection.account !== accountOf(identity))
|
|
20
|
+
throw new AuthenticationError("wrong_account");
|
|
21
|
+
const checked = constrain(operation, input);
|
|
22
|
+
const desired = checked.desired;
|
|
23
|
+
const projects = [identity.project, identity.projectNumber];
|
|
24
|
+
const inProject = (value) => projects.some((project) => value.startsWith(`projects/${project}/`));
|
|
25
|
+
if (input.id && !inProject(input.id))
|
|
26
|
+
throw new AuthenticationError("wrong_account");
|
|
27
|
+
for (const state of [input.state, desired]) {
|
|
28
|
+
if (!state)
|
|
29
|
+
continue;
|
|
30
|
+
if (state.project != null && !projects.includes(String(state.project)))
|
|
31
|
+
throw new AuthenticationError("wrong_account");
|
|
32
|
+
for (const field of ["id", "key_ring", "crypto_key_id", "service_account_id"])
|
|
33
|
+
if (typeof state[field] === "string" && !inProject(state[field]))
|
|
34
|
+
throw new AuthenticationError("wrong_account");
|
|
35
|
+
}
|
|
36
|
+
const credentials = await federationCredentials(identity);
|
|
37
|
+
const driver = gcpTf.driver(retainKeys(bridge), () => ({ credentials: JSON.stringify(credentials), project: identity.project }), undefined, undefined, { authentication: ["workloadIdentity"] });
|
|
38
|
+
try {
|
|
39
|
+
return await driver.ops[operation]({ ...input, ...checked }, call);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
// Provider diagnostics may echo credential-source headers or an access token.
|
|
43
|
+
// Keep actionable retryability, never the SDK/provider message, cause or private state.
|
|
44
|
+
throw new DriverError(`gcp: ${operation} failed`, {
|
|
45
|
+
retryable: error?.retryable === true,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
])),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=driver.js.map
|