@emilia-protocol/gate 0.10.0 → 0.13.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/CHANGELOG.md +91 -0
- package/README.md +272 -0
- package/action-control-manifest.js +3 -268
- package/action-escrow-custodian.js +4 -0
- package/action-escrow-evidence.js +4 -0
- package/action-escrow-package.js +4 -0
- package/action-escrow-postgres.js +4 -0
- package/action-escrow-state.js +4 -0
- package/action-escrow-verifiers.js +4 -0
- package/action-escrow.js +4 -0
- package/action-packs.js +3 -140
- package/adapters/_kit.js +3 -104
- package/adapters/aws.js +3 -108
- package/adapters/cloudflare.js +3 -54
- package/adapters/gcp.js +3 -70
- package/adapters/github.js +3 -109
- package/adapters/jira.js +3 -55
- package/adapters/k8s.js +3 -70
- package/adapters/linear.js +3 -55
- package/adapters/salesforce.js +3 -55
- package/adapters/stripe.js +3 -81
- package/adapters/supabase.js +3 -121
- package/adapters/terraform.js +3 -59
- package/adapters/vercel.js +3 -84
- package/aec-execution.js +3 -312
- package/breakglass.js +3 -582
- package/capability-receipt.js +4 -0
- package/cf1-conformance.js +3 -106
- package/challenge-store.js +3 -69
- package/control-plane.js +3 -340
- package/coverage.js +3 -721
- package/demo.mjs +1 -1
- package/deployment-attestation.js +3 -247
- package/dist/action-control-manifest.d.ts +82 -0
- package/dist/action-control-manifest.d.ts.map +1 -0
- package/dist/action-control-manifest.js +422 -0
- package/dist/action-control-manifest.js.map +1 -0
- package/dist/action-escrow-custodian.d.ts +74 -0
- package/dist/action-escrow-custodian.d.ts.map +1 -0
- package/dist/action-escrow-custodian.js +363 -0
- package/dist/action-escrow-custodian.js.map +1 -0
- package/dist/action-escrow-evidence.d.ts +130 -0
- package/dist/action-escrow-evidence.d.ts.map +1 -0
- package/dist/action-escrow-evidence.js +1012 -0
- package/dist/action-escrow-evidence.js.map +1 -0
- package/dist/action-escrow-package.d.ts +10 -0
- package/dist/action-escrow-package.d.ts.map +1 -0
- package/dist/action-escrow-package.js +1583 -0
- package/dist/action-escrow-package.js.map +1 -0
- package/dist/action-escrow-postgres.d.ts +62 -0
- package/dist/action-escrow-postgres.d.ts.map +1 -0
- package/dist/action-escrow-postgres.js +339 -0
- package/dist/action-escrow-postgres.js.map +1 -0
- package/dist/action-escrow-state.d.ts +141 -0
- package/dist/action-escrow-state.d.ts.map +1 -0
- package/dist/action-escrow-state.js +413 -0
- package/dist/action-escrow-state.js.map +1 -0
- package/dist/action-escrow-verifiers.d.ts +65 -0
- package/dist/action-escrow-verifiers.d.ts.map +1 -0
- package/dist/action-escrow-verifiers.js +421 -0
- package/dist/action-escrow-verifiers.js.map +1 -0
- package/dist/action-escrow.d.ts +112 -0
- package/dist/action-escrow.d.ts.map +1 -0
- package/dist/action-escrow.js +2661 -0
- package/dist/action-escrow.js.map +1 -0
- package/dist/action-packs.d.ts +54 -0
- package/dist/action-packs.d.ts.map +1 -0
- package/dist/action-packs.js +143 -0
- package/dist/action-packs.js.map +1 -0
- package/dist/adapters/_kit.d.ts +50 -0
- package/dist/adapters/_kit.d.ts.map +1 -0
- package/dist/adapters/_kit.js +98 -0
- package/dist/adapters/_kit.js.map +1 -0
- package/dist/adapters/aws.d.ts +158 -0
- package/dist/adapters/aws.d.ts.map +1 -0
- package/dist/adapters/aws.js +136 -0
- package/dist/adapters/aws.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +116 -0
- package/dist/adapters/cloudflare.d.ts.map +1 -0
- package/dist/adapters/cloudflare.js +75 -0
- package/dist/adapters/cloudflare.js.map +1 -0
- package/dist/adapters/gcp.d.ts +139 -0
- package/dist/adapters/gcp.d.ts.map +1 -0
- package/dist/adapters/gcp.js +69 -0
- package/dist/adapters/gcp.js.map +1 -0
- package/dist/adapters/github.d.ts +123 -0
- package/dist/adapters/github.d.ts.map +1 -0
- package/dist/adapters/github.js +105 -0
- package/dist/adapters/github.js.map +1 -0
- package/dist/adapters/jira.d.ts +109 -0
- package/dist/adapters/jira.d.ts.map +1 -0
- package/dist/adapters/jira.js +54 -0
- package/dist/adapters/jira.js.map +1 -0
- package/dist/adapters/k8s.d.ts +139 -0
- package/dist/adapters/k8s.d.ts.map +1 -0
- package/dist/adapters/k8s.js +69 -0
- package/dist/adapters/k8s.js.map +1 -0
- package/dist/adapters/linear.d.ts +109 -0
- package/dist/adapters/linear.d.ts.map +1 -0
- package/dist/adapters/linear.js +54 -0
- package/dist/adapters/linear.js.map +1 -0
- package/dist/adapters/salesforce.d.ts +109 -0
- package/dist/adapters/salesforce.d.ts.map +1 -0
- package/dist/adapters/salesforce.js +54 -0
- package/dist/adapters/salesforce.js.map +1 -0
- package/dist/adapters/stripe.d.ts +116 -0
- package/dist/adapters/stripe.d.ts.map +1 -0
- package/dist/adapters/stripe.js +77 -0
- package/dist/adapters/stripe.js.map +1 -0
- package/dist/adapters/supabase.d.ts +127 -0
- package/dist/adapters/supabase.d.ts.map +1 -0
- package/dist/adapters/supabase.js +112 -0
- package/dist/adapters/supabase.js.map +1 -0
- package/dist/adapters/terraform.d.ts +109 -0
- package/dist/adapters/terraform.d.ts.map +1 -0
- package/dist/adapters/terraform.js +58 -0
- package/dist/adapters/terraform.js.map +1 -0
- package/dist/adapters/vercel.d.ts +114 -0
- package/dist/adapters/vercel.d.ts.map +1 -0
- package/dist/adapters/vercel.js +81 -0
- package/dist/adapters/vercel.js.map +1 -0
- package/dist/aec-execution.d.ts +107 -0
- package/dist/aec-execution.d.ts.map +1 -0
- package/dist/aec-execution.js +334 -0
- package/dist/aec-execution.js.map +1 -0
- package/dist/breakglass.d.ts +205 -0
- package/dist/breakglass.d.ts.map +1 -0
- package/dist/breakglass.js +627 -0
- package/dist/breakglass.js.map +1 -0
- package/dist/capability-receipt.d.ts +601 -0
- package/dist/capability-receipt.d.ts.map +1 -0
- package/dist/capability-receipt.js +1177 -0
- package/dist/capability-receipt.js.map +1 -0
- package/dist/cf1-conformance.d.ts +83 -0
- package/dist/cf1-conformance.d.ts.map +1 -0
- package/dist/cf1-conformance.js +94 -0
- package/dist/cf1-conformance.js.map +1 -0
- package/dist/challenge-store.d.ts +20 -0
- package/dist/challenge-store.d.ts.map +1 -0
- package/dist/challenge-store.js +62 -0
- package/dist/challenge-store.js.map +1 -0
- package/dist/control-plane.d.ts +136 -0
- package/dist/control-plane.d.ts.map +1 -0
- package/dist/control-plane.js +349 -0
- package/dist/control-plane.js.map +1 -0
- package/dist/coverage.d.ts +156 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/coverage.js +768 -0
- package/dist/coverage.js.map +1 -0
- package/dist/deployment-attestation.d.ts +93 -0
- package/dist/deployment-attestation.d.ts.map +1 -0
- package/dist/deployment-attestation.js +262 -0
- package/dist/deployment-attestation.js.map +1 -0
- package/dist/eg1-conformance.d.ts +286 -0
- package/dist/eg1-conformance.d.ts.map +1 -0
- package/dist/eg1-conformance.js +379 -0
- package/dist/eg1-conformance.js.map +1 -0
- package/dist/enterprise.d.ts +88 -0
- package/dist/enterprise.d.ts.map +1 -0
- package/dist/enterprise.js +194 -0
- package/dist/enterprise.js.map +1 -0
- package/dist/evidence-postgres.d.ts +123 -0
- package/dist/evidence-postgres.d.ts.map +1 -0
- package/dist/evidence-postgres.js +343 -0
- package/dist/evidence-postgres.js.map +1 -0
- package/dist/evidence.d.ts +113 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +369 -0
- package/dist/evidence.js.map +1 -0
- package/dist/execution-binding.d.ts +49 -0
- package/dist/execution-binding.d.ts.map +1 -0
- package/dist/execution-binding.js +243 -0
- package/dist/execution-binding.js.map +1 -0
- package/dist/formal-runtime-map.d.ts +42 -0
- package/dist/formal-runtime-map.d.ts.map +1 -0
- package/dist/formal-runtime-map.js +23 -0
- package/dist/formal-runtime-map.js.map +1 -0
- package/dist/index.d.ts +1002 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1736 -0
- package/dist/index.js.map +1 -0
- package/dist/key-registry.d.ts +60 -0
- package/dist/key-registry.d.ts.map +1 -0
- package/dist/key-registry.js +144 -0
- package/dist/key-registry.js.map +1 -0
- package/dist/mcp.d.ts +53 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +112 -0
- package/dist/mcp.js.map +1 -0
- package/dist/metering.d.ts +80 -0
- package/dist/metering.d.ts.map +1 -0
- package/dist/metering.js +227 -0
- package/dist/metering.js.map +1 -0
- package/dist/metrics.d.ts +68 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +242 -0
- package/dist/metrics.js.map +1 -0
- package/dist/network-witness.d.ts +167 -0
- package/dist/network-witness.d.ts.map +1 -0
- package/dist/network-witness.js +520 -0
- package/dist/network-witness.js.map +1 -0
- package/dist/protocol-state.d.ts +141 -0
- package/dist/protocol-state.d.ts.map +1 -0
- package/dist/protocol-state.js +106 -0
- package/dist/protocol-state.js.map +1 -0
- package/dist/receipt-program.d.ts +59 -0
- package/dist/receipt-program.d.ts.map +1 -0
- package/dist/receipt-program.js +1053 -0
- package/dist/receipt-program.js.map +1 -0
- package/dist/reliance-kernel.d.ts +66 -0
- package/dist/reliance-kernel.d.ts.map +1 -0
- package/dist/reliance-kernel.js +103 -0
- package/dist/reliance-kernel.js.map +1 -0
- package/dist/reliance-packet.d.ts +67 -0
- package/dist/reliance-packet.d.ts.map +1 -0
- package/dist/reliance-packet.js +176 -0
- package/dist/reliance-packet.js.map +1 -0
- package/dist/remedy-program-postgres.d.ts +37 -0
- package/dist/remedy-program-postgres.d.ts.map +1 -0
- package/dist/remedy-program-postgres.js +291 -0
- package/dist/remedy-program-postgres.js.map +1 -0
- package/dist/remedy-program-receipt.d.ts +97 -0
- package/dist/remedy-program-receipt.d.ts.map +1 -0
- package/dist/remedy-program-receipt.js +817 -0
- package/dist/remedy-program-receipt.js.map +1 -0
- package/dist/remedy-program.d.ts +76 -0
- package/dist/remedy-program.d.ts.map +1 -0
- package/dist/remedy-program.js +1346 -0
- package/dist/remedy-program.js.map +1 -0
- package/dist/reports/art14.d.ts +101 -0
- package/dist/reports/art14.d.ts.map +1 -0
- package/dist/reports/art14.js +340 -0
- package/dist/reports/art14.js.map +1 -0
- package/dist/reports/assurance-package.d.ts +197 -0
- package/dist/reports/assurance-package.d.ts.map +1 -0
- package/dist/reports/assurance-package.js +313 -0
- package/dist/reports/assurance-package.js.map +1 -0
- package/dist/reports/auditor-workpaper.d.ts +194 -0
- package/dist/reports/auditor-workpaper.d.ts.map +1 -0
- package/dist/reports/auditor-workpaper.js +545 -0
- package/dist/reports/auditor-workpaper.js.map +1 -0
- package/dist/reports/external-verification.d.ts +76 -0
- package/dist/reports/external-verification.d.ts.map +1 -0
- package/dist/reports/external-verification.js +209 -0
- package/dist/reports/external-verification.js.map +1 -0
- package/dist/reports/reperform.d.ts +122 -0
- package/dist/reports/reperform.d.ts.map +1 -0
- package/dist/reports/reperform.js +432 -0
- package/dist/reports/reperform.js.map +1 -0
- package/dist/reports/underwriter.d.ts +127 -0
- package/dist/reports/underwriter.d.ts.map +1 -0
- package/dist/reports/underwriter.js +348 -0
- package/dist/reports/underwriter.js.map +1 -0
- package/dist/retention.d.ts +88 -0
- package/dist/retention.d.ts.map +1 -0
- package/dist/retention.js +90 -0
- package/dist/retention.js.map +1 -0
- package/dist/roster.d.ts +113 -0
- package/dist/roster.d.ts.map +1 -0
- package/dist/roster.js +261 -0
- package/dist/roster.js.map +1 -0
- package/dist/runtime-monitor.d.ts +132 -0
- package/dist/runtime-monitor.d.ts.map +1 -0
- package/dist/runtime-monitor.js +197 -0
- package/dist/runtime-monitor.js.map +1 -0
- package/dist/settlement.d.ts +68 -0
- package/dist/settlement.d.ts.map +1 -0
- package/dist/settlement.js +306 -0
- package/dist/settlement.js.map +1 -0
- package/dist/siem.d.ts +261 -0
- package/dist/siem.d.ts.map +1 -0
- package/dist/siem.js +247 -0
- package/dist/siem.js.map +1 -0
- package/dist/store-postgres.d.ts +107 -0
- package/dist/store-postgres.d.ts.map +1 -0
- package/dist/store-postgres.js +152 -0
- package/dist/store-postgres.js.map +1 -0
- package/dist/store.d.ts +95 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +202 -0
- package/dist/store.js.map +1 -0
- package/dist/strict-json.d.ts +14 -0
- package/dist/strict-json.d.ts.map +1 -0
- package/dist/strict-json.js +132 -0
- package/dist/strict-json.js.map +1 -0
- package/dist/trust-program-adapters.d.ts +122 -0
- package/dist/trust-program-adapters.d.ts.map +1 -0
- package/dist/trust-program-adapters.js +802 -0
- package/dist/trust-program-adapters.js.map +1 -0
- package/dist/trust-program-postgres.d.ts +41 -0
- package/dist/trust-program-postgres.d.ts.map +1 -0
- package/dist/trust-program-postgres.js +346 -0
- package/dist/trust-program-postgres.js.map +1 -0
- package/dist/trust-program-revocation.d.ts +206 -0
- package/dist/trust-program-revocation.d.ts.map +1 -0
- package/dist/trust-program-revocation.js +600 -0
- package/dist/trust-program-revocation.js.map +1 -0
- package/dist/trust-program.d.ts +197 -0
- package/dist/trust-program.d.ts.map +1 -0
- package/dist/trust-program.js +1351 -0
- package/dist/trust-program.js.map +1 -0
- package/dist/witness-postgres.d.ts +43 -0
- package/dist/witness-postgres.d.ts.map +1 -0
- package/dist/witness-postgres.js +92 -0
- package/dist/witness-postgres.js.map +1 -0
- package/dist/zk-range-proof.d.ts +78 -0
- package/dist/zk-range-proof.d.ts.map +1 -0
- package/dist/zk-range-proof.js +228 -0
- package/dist/zk-range-proof.js.map +1 -0
- package/eg1-conformance.js +3 -404
- package/enterprise.js +3 -180
- package/ep-assure.mjs +1 -0
- package/evidence-postgres.js +3 -356
- package/evidence.js +4 -360
- package/execution-binding.js +3 -212
- package/formal-runtime-map.js +4 -0
- package/index.js +4 -1249
- package/key-registry.js +3 -134
- package/mcp.js +3 -109
- package/metering.js +3 -226
- package/metrics.js +3 -231
- package/network-witness.js +3 -499
- package/package.json +47 -4
- package/receipt-program.js +4 -0
- package/reliance-kernel.js +3 -112
- package/reliance-packet.js +3 -175
- package/remedy-program-postgres.js +4 -0
- package/remedy-program-receipt.js +4 -0
- package/remedy-program.js +4 -0
- package/reports/art14.js +0 -0
- package/reports/assurance-package.js +2 -312
- package/reports/auditor-workpaper.js +3 -537
- package/reports/external-verification.js +3 -222
- package/reports/reperform.js +3 -424
- package/reports/underwriter.js +3 -339
- package/retention.js +3 -84
- package/roster.js +3 -264
- package/runtime-monitor.js +4 -0
- package/settlement.js +3 -299
- package/siem.js +3 -235
- package/src/action-control-manifest.ts +424 -0
- package/src/action-escrow-custodian.ts +427 -0
- package/src/action-escrow-evidence.ts +1178 -0
- package/src/action-escrow-package.ts +1821 -0
- package/src/action-escrow-postgres.ts +366 -0
- package/src/action-escrow-state.ts +498 -0
- package/src/action-escrow-verifiers.ts +484 -0
- package/src/action-escrow.ts +3039 -0
- package/src/action-packs.ts +170 -0
- package/src/adapters/_kit.ts +117 -0
- package/src/adapters/aws.ts +142 -0
- package/src/adapters/cloudflare.ts +78 -0
- package/src/adapters/gcp.ts +71 -0
- package/src/adapters/github.ts +110 -0
- package/src/adapters/jira.ts +56 -0
- package/src/adapters/k8s.ts +71 -0
- package/src/adapters/linear.ts +56 -0
- package/src/adapters/salesforce.ts +56 -0
- package/src/adapters/stripe.ts +82 -0
- package/src/adapters/supabase.ts +122 -0
- package/src/adapters/terraform.ts +60 -0
- package/src/adapters/vercel.ts +85 -0
- package/src/aec-execution.ts +354 -0
- package/src/breakglass.ts +647 -0
- package/src/capability-receipt.ts +1258 -0
- package/src/cf1-conformance.ts +120 -0
- package/src/challenge-store.ts +70 -0
- package/src/control-plane.ts +374 -0
- package/src/coverage.ts +832 -0
- package/src/deployment-attestation.ts +259 -0
- package/src/eg1-conformance.ts +471 -0
- package/src/enterprise.ts +195 -0
- package/src/evidence-postgres.ts +374 -0
- package/src/evidence.ts +367 -0
- package/src/execution-binding.ts +236 -0
- package/src/formal-runtime-map.ts +24 -0
- package/src/index.ts +2122 -0
- package/src/key-registry.ts +150 -0
- package/src/mcp.ts +120 -0
- package/src/metering.ts +237 -0
- package/src/metrics.ts +232 -0
- package/src/network-witness.ts +585 -0
- package/src/protocol-state.ts +143 -0
- package/src/protocol-state.typecheck.ts +94 -0
- package/src/receipt-program.ts +1105 -0
- package/src/reliance-kernel.ts +119 -0
- package/src/reliance-packet.ts +206 -0
- package/src/remedy-program-postgres.ts +367 -0
- package/src/remedy-program-receipt.ts +891 -0
- package/src/remedy-program.ts +1388 -0
- package/src/reports/art14.ts +361 -0
- package/src/reports/assurance-package.ts +330 -0
- package/src/reports/auditor-workpaper.ts +558 -0
- package/src/reports/external-verification.ts +232 -0
- package/src/reports/reperform.ts +441 -0
- package/src/reports/underwriter.ts +356 -0
- package/src/retention.ts +100 -0
- package/src/roster.ts +273 -0
- package/src/runtime-monitor.ts +217 -0
- package/src/settlement.ts +313 -0
- package/src/siem.ts +247 -0
- package/src/store-postgres.ts +167 -0
- package/src/store.ts +214 -0
- package/src/strict-json.ts +115 -0
- package/src/trust-program-adapters.ts +847 -0
- package/src/trust-program-postgres.ts +429 -0
- package/src/trust-program-revocation.ts +751 -0
- package/src/trust-program.ts +1460 -0
- package/src/witness-postgres.ts +106 -0
- package/src/zk-range-proof.ts +250 -0
- package/store-postgres.js +3 -161
- package/store.js +4 -198
- package/strict-json.js +3 -85
- package/trust-program-adapters.js +4 -0
- package/trust-program-postgres.js +4 -0
- package/trust-program-revocation.js +4 -0
- package/trust-program.js +4 -0
- package/witness-postgres.js +3 -96
- package/zk-range-proof.js +4 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* EMILIA Gate — Kubernetes System-of-Record adapter.
|
|
4
|
+
*
|
|
5
|
+
* "Install this before your agent can touch the cluster." Guards the operations
|
|
6
|
+
* that take a cluster down or hand it away — namespace delete, workload delete,
|
|
7
|
+
* RBAC binding, secret delete — so they never reach the API server without a
|
|
8
|
+
* receipt bound to THIS namespace/resource. Client is injected (a @kubernetes/
|
|
9
|
+
* client-node wrapper or compatible).
|
|
10
|
+
*/
|
|
11
|
+
import { createAdapter, manifestFromPack } from './_kit.js';
|
|
12
|
+
export const K8S_ACTION_PACK = Object.freeze([
|
|
13
|
+
Object.freeze({
|
|
14
|
+
id: 'k8s.namespace.delete', label: 'Delete namespace', action_type: 'k8s.namespace.delete',
|
|
15
|
+
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
16
|
+
match: { protocol: 'k8s', tool: 'delete_namespace' },
|
|
17
|
+
why: 'Deletes an entire namespace and everything in it. Quorum.',
|
|
18
|
+
execution_binding: { required_fields: ['action_type', 'namespace'] },
|
|
19
|
+
}),
|
|
20
|
+
Object.freeze({
|
|
21
|
+
id: 'k8s.workload.delete', label: 'Delete workload', action_type: 'k8s.workload.delete',
|
|
22
|
+
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
23
|
+
match: { protocol: 'k8s', tool: 'delete_workload' },
|
|
24
|
+
why: 'Deletes a deployment/statefulset/job. Bind namespace+kind+name.',
|
|
25
|
+
execution_binding: { required_fields: ['action_type', 'namespace', 'kind', 'name'] },
|
|
26
|
+
}),
|
|
27
|
+
Object.freeze({
|
|
28
|
+
id: 'k8s.rbac.bind', label: 'RBAC binding', action_type: 'k8s.rbac.bind',
|
|
29
|
+
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
30
|
+
match: { protocol: 'k8s', tool: 'create_role_binding' },
|
|
31
|
+
why: 'Grants cluster permissions. Privilege change → two-person rule.',
|
|
32
|
+
execution_binding: { required_fields: ['action_type', 'subject', 'role', 'namespace'] },
|
|
33
|
+
}),
|
|
34
|
+
Object.freeze({
|
|
35
|
+
id: 'k8s.secret.delete', label: 'Delete secret', action_type: 'k8s.secret.delete',
|
|
36
|
+
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
37
|
+
match: { protocol: 'k8s', tool: 'delete_secret' },
|
|
38
|
+
why: 'Destroys a secret. Bind namespace+name.',
|
|
39
|
+
execution_binding: { required_fields: ['action_type', 'namespace', 'name'] },
|
|
40
|
+
}),
|
|
41
|
+
]);
|
|
42
|
+
const OPS = {
|
|
43
|
+
'namespace.delete': {
|
|
44
|
+
selector: { protocol: 'k8s', tool: 'delete_namespace' },
|
|
45
|
+
observed: (p) => ({ action_type: 'k8s.namespace.delete', namespace: p.namespace }),
|
|
46
|
+
perform: (c, p) => c.deleteNamespace({ namespace: p.namespace }),
|
|
47
|
+
},
|
|
48
|
+
'workload.delete': {
|
|
49
|
+
selector: { protocol: 'k8s', tool: 'delete_workload' },
|
|
50
|
+
observed: (p) => ({ action_type: 'k8s.workload.delete', namespace: p.namespace, kind: p.kind, name: p.name }),
|
|
51
|
+
perform: (c, p) => c.deleteWorkload({ namespace: p.namespace, kind: p.kind, name: p.name }),
|
|
52
|
+
},
|
|
53
|
+
'rbac.bind': {
|
|
54
|
+
selector: { protocol: 'k8s', tool: 'create_role_binding' },
|
|
55
|
+
observed: (p) => ({ action_type: 'k8s.rbac.bind', subject: p.subject, role: p.role, namespace: p.namespace }),
|
|
56
|
+
perform: (c, p) => c.createRoleBinding({ subject: p.subject, role: p.role, namespace: p.namespace }),
|
|
57
|
+
},
|
|
58
|
+
'secret.delete': {
|
|
59
|
+
selector: { protocol: 'k8s', tool: 'delete_secret' },
|
|
60
|
+
observed: (p) => ({ action_type: 'k8s.secret.delete', namespace: p.namespace, name: p.name }),
|
|
61
|
+
perform: (c, p) => c.deleteSecret({ namespace: p.namespace, name: p.name }),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const adapter = createAdapter({ system: 'k8s', ops: OPS });
|
|
65
|
+
export const K8S_OPS = adapter.OPS;
|
|
66
|
+
export function createK8sManifest(extraActions = []) { return manifestFromPack(K8S_ACTION_PACK, extraActions); }
|
|
67
|
+
export function guardK8sMutation(gate, client, args) { return adapter.guard(gate, client, args); }
|
|
68
|
+
export default { K8S_ACTION_PACK, K8S_OPS, createK8sManifest, guardK8sMutation };
|
|
69
|
+
//# sourceMappingURL=k8s.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"k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EAAE,GAAG,EAAE,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;AACnC,MAAM,UAAU,iBAAiB,CAAC,YAAY,GAAG,EAAE,IAAI,OAAO,gBAAgB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;AAChH,MAAM,UAAU,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAClG,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export declare const LINEAR_ACTION_PACK: readonly (Readonly<{
|
|
2
|
+
id: "linear.issue.delete";
|
|
3
|
+
label: "Delete issue";
|
|
4
|
+
action_type: "linear.issue.delete";
|
|
5
|
+
risk: "high";
|
|
6
|
+
receipt_required: true;
|
|
7
|
+
assurance_class: "class_a";
|
|
8
|
+
match: {
|
|
9
|
+
protocol: string;
|
|
10
|
+
tool: string;
|
|
11
|
+
};
|
|
12
|
+
why: "Destroys an issue. Bind the issue id.";
|
|
13
|
+
execution_binding: {
|
|
14
|
+
required_fields: string[];
|
|
15
|
+
};
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
id: "linear.issue.bulk_delete";
|
|
18
|
+
label: "Bulk delete issues";
|
|
19
|
+
action_type: "linear.issue.bulk_delete";
|
|
20
|
+
risk: "critical";
|
|
21
|
+
receipt_required: true;
|
|
22
|
+
assurance_class: "class_a";
|
|
23
|
+
match: {
|
|
24
|
+
protocol: string;
|
|
25
|
+
tool: string;
|
|
26
|
+
};
|
|
27
|
+
why: "Mass-destroys issues. Bind the exact query.";
|
|
28
|
+
execution_binding: {
|
|
29
|
+
required_fields: string[];
|
|
30
|
+
};
|
|
31
|
+
}> | Readonly<{
|
|
32
|
+
id: "linear.team.delete";
|
|
33
|
+
label: "Delete team";
|
|
34
|
+
action_type: "linear.team.delete";
|
|
35
|
+
risk: "critical";
|
|
36
|
+
receipt_required: true;
|
|
37
|
+
assurance_class: "quorum";
|
|
38
|
+
match: {
|
|
39
|
+
protocol: string;
|
|
40
|
+
tool: string;
|
|
41
|
+
};
|
|
42
|
+
why: "Deletes a team and its issues. Quorum.";
|
|
43
|
+
execution_binding: {
|
|
44
|
+
required_fields: string[];
|
|
45
|
+
};
|
|
46
|
+
}>)[];
|
|
47
|
+
export declare const LINEAR_OPS: readonly string[];
|
|
48
|
+
export declare function createLinearManifest(extra?: never[]): {
|
|
49
|
+
'@version': string;
|
|
50
|
+
actions: any[];
|
|
51
|
+
};
|
|
52
|
+
export declare function guardLinearMutation(gate: any, client: any, args: any): Promise<{
|
|
53
|
+
result: any;
|
|
54
|
+
reliance: any;
|
|
55
|
+
execution: any;
|
|
56
|
+
}>;
|
|
57
|
+
declare const _default: {
|
|
58
|
+
LINEAR_ACTION_PACK: readonly (Readonly<{
|
|
59
|
+
id: "linear.issue.delete";
|
|
60
|
+
label: "Delete issue";
|
|
61
|
+
action_type: "linear.issue.delete";
|
|
62
|
+
risk: "high";
|
|
63
|
+
receipt_required: true;
|
|
64
|
+
assurance_class: "class_a";
|
|
65
|
+
match: {
|
|
66
|
+
protocol: string;
|
|
67
|
+
tool: string;
|
|
68
|
+
};
|
|
69
|
+
why: "Destroys an issue. Bind the issue id.";
|
|
70
|
+
execution_binding: {
|
|
71
|
+
required_fields: string[];
|
|
72
|
+
};
|
|
73
|
+
}> | Readonly<{
|
|
74
|
+
id: "linear.issue.bulk_delete";
|
|
75
|
+
label: "Bulk delete issues";
|
|
76
|
+
action_type: "linear.issue.bulk_delete";
|
|
77
|
+
risk: "critical";
|
|
78
|
+
receipt_required: true;
|
|
79
|
+
assurance_class: "class_a";
|
|
80
|
+
match: {
|
|
81
|
+
protocol: string;
|
|
82
|
+
tool: string;
|
|
83
|
+
};
|
|
84
|
+
why: "Mass-destroys issues. Bind the exact query.";
|
|
85
|
+
execution_binding: {
|
|
86
|
+
required_fields: string[];
|
|
87
|
+
};
|
|
88
|
+
}> | Readonly<{
|
|
89
|
+
id: "linear.team.delete";
|
|
90
|
+
label: "Delete team";
|
|
91
|
+
action_type: "linear.team.delete";
|
|
92
|
+
risk: "critical";
|
|
93
|
+
receipt_required: true;
|
|
94
|
+
assurance_class: "quorum";
|
|
95
|
+
match: {
|
|
96
|
+
protocol: string;
|
|
97
|
+
tool: string;
|
|
98
|
+
};
|
|
99
|
+
why: "Deletes a team and its issues. Quorum.";
|
|
100
|
+
execution_binding: {
|
|
101
|
+
required_fields: string[];
|
|
102
|
+
};
|
|
103
|
+
}>)[];
|
|
104
|
+
LINEAR_OPS: readonly string[];
|
|
105
|
+
createLinearManifest: typeof createLinearManifest;
|
|
106
|
+
guardLinearMutation: typeof guardLinearMutation;
|
|
107
|
+
};
|
|
108
|
+
export default _default;
|
|
109
|
+
//# sourceMappingURL=linear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear.d.ts","sourceRoot":"","sources":["../../src/adapters/linear.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsB7B,CAAC;AAsBH,eAAO,MAAM,UAAU,mBAAc,CAAC;AACtC,wBAAgB,oBAAoB,CAAC,KAAK,UAAK;;;EAAyD;AACxG,wBAAgB,mBAAmB,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,EAAE,IAAI,KAAA;;;;GAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACrG,wBAA6F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* EMILIA Gate — Linear System-of-Record adapter.
|
|
4
|
+
* Guards issue deletion, bulk delete, and team deletion so they never reach
|
|
5
|
+
* Linear without a receipt bound to THIS resource. Client injected.
|
|
6
|
+
*/
|
|
7
|
+
import { createAdapter, manifestFromPack, hashCanonical } from './_kit.js';
|
|
8
|
+
export const LINEAR_ACTION_PACK = Object.freeze([
|
|
9
|
+
Object.freeze({
|
|
10
|
+
id: 'linear.issue.delete', label: 'Delete issue', action_type: 'linear.issue.delete',
|
|
11
|
+
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
12
|
+
match: { protocol: 'linear', tool: 'delete_issue' },
|
|
13
|
+
why: 'Destroys an issue. Bind the issue id.',
|
|
14
|
+
execution_binding: { required_fields: ['action_type', 'issue_id'] },
|
|
15
|
+
}),
|
|
16
|
+
Object.freeze({
|
|
17
|
+
id: 'linear.issue.bulk_delete', label: 'Bulk delete issues', action_type: 'linear.issue.bulk_delete',
|
|
18
|
+
risk: 'critical', receipt_required: true, assurance_class: 'class_a',
|
|
19
|
+
match: { protocol: 'linear', tool: 'bulk_delete_issues' },
|
|
20
|
+
why: 'Mass-destroys issues. Bind the exact query.',
|
|
21
|
+
execution_binding: { required_fields: ['action_type', 'team', 'query_hash'] },
|
|
22
|
+
}),
|
|
23
|
+
Object.freeze({
|
|
24
|
+
id: 'linear.team.delete', label: 'Delete team', action_type: 'linear.team.delete',
|
|
25
|
+
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
26
|
+
match: { protocol: 'linear', tool: 'delete_team' },
|
|
27
|
+
why: 'Deletes a team and its issues. Quorum.',
|
|
28
|
+
execution_binding: { required_fields: ['action_type', 'team_id'] },
|
|
29
|
+
}),
|
|
30
|
+
]);
|
|
31
|
+
const OPS = {
|
|
32
|
+
'issue.delete': {
|
|
33
|
+
selector: { protocol: 'linear', tool: 'delete_issue' },
|
|
34
|
+
observed: (p) => ({ action_type: 'linear.issue.delete', issue_id: p.issue_id }),
|
|
35
|
+
perform: (c, p) => c.deleteIssue({ issueId: p.issue_id }),
|
|
36
|
+
},
|
|
37
|
+
'issue.bulk_delete': {
|
|
38
|
+
selector: { protocol: 'linear', tool: 'bulk_delete_issues' },
|
|
39
|
+
observed: (p) => ({ action_type: 'linear.issue.bulk_delete', team: p.team, query_hash: hashCanonical(String(p.query || '').trim()) }),
|
|
40
|
+
actuator: (p, observed) => ({ ...observed, query: p.query }),
|
|
41
|
+
perform: (c, p) => c.bulkDeleteIssues({ team: p.team, query: p.query }),
|
|
42
|
+
},
|
|
43
|
+
'team.delete': {
|
|
44
|
+
selector: { protocol: 'linear', tool: 'delete_team' },
|
|
45
|
+
observed: (p) => ({ action_type: 'linear.team.delete', team_id: p.team_id }),
|
|
46
|
+
perform: (c, p) => c.deleteTeam({ teamId: p.team_id }),
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const adapter = createAdapter({ system: 'linear', ops: OPS });
|
|
50
|
+
export const LINEAR_OPS = adapter.OPS;
|
|
51
|
+
export function createLinearManifest(extra = []) { return manifestFromPack(LINEAR_ACTION_PACK, extra); }
|
|
52
|
+
export function guardLinearMutation(gate, client, args) { return adapter.guard(gate, client, args); }
|
|
53
|
+
export default { LINEAR_ACTION_PACK, LINEAR_OPS, createLinearManifest, guardLinearMutation };
|
|
54
|
+
//# sourceMappingURL=linear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear.js","sourceRoot":"","sources":["../../src/adapters/linear.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,MAAM,CAAC,MAAM,CAAC;QACZ,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB;QACpF,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS;QAChE,KAAK,EAA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MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;AACtC,MAAM,UAAU,oBAAoB,CAAC,KAAK,GAAG,EAAE,IAAI,OAAO,gBAAgB,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACxG,MAAM,UAAU,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACrG,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export declare const SALESFORCE_ACTION_PACK: readonly (Readonly<{
|
|
2
|
+
id: "salesforce.records.bulk_delete";
|
|
3
|
+
label: "Bulk delete records";
|
|
4
|
+
action_type: "salesforce.records.bulk_delete";
|
|
5
|
+
risk: "critical";
|
|
6
|
+
receipt_required: true;
|
|
7
|
+
assurance_class: "class_a";
|
|
8
|
+
match: {
|
|
9
|
+
protocol: string;
|
|
10
|
+
tool: string;
|
|
11
|
+
};
|
|
12
|
+
why: "Mass-destroys CRM records. Bind object + the exact SOQL.";
|
|
13
|
+
execution_binding: {
|
|
14
|
+
required_fields: string[];
|
|
15
|
+
};
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
id: "salesforce.data.export";
|
|
18
|
+
label: "Bulk data export";
|
|
19
|
+
action_type: "salesforce.data.export";
|
|
20
|
+
risk: "high";
|
|
21
|
+
receipt_required: true;
|
|
22
|
+
assurance_class: "class_a";
|
|
23
|
+
match: {
|
|
24
|
+
protocol: string;
|
|
25
|
+
tool: string;
|
|
26
|
+
};
|
|
27
|
+
why: "Exfiltrates CRM data. Bind object + recipient.";
|
|
28
|
+
execution_binding: {
|
|
29
|
+
required_fields: string[];
|
|
30
|
+
};
|
|
31
|
+
}> | Readonly<{
|
|
32
|
+
id: "salesforce.permission_set.assign";
|
|
33
|
+
label: "Assign permission set";
|
|
34
|
+
action_type: "salesforce.permission_set.assign";
|
|
35
|
+
risk: "critical";
|
|
36
|
+
receipt_required: true;
|
|
37
|
+
assurance_class: "quorum";
|
|
38
|
+
match: {
|
|
39
|
+
protocol: string;
|
|
40
|
+
tool: string;
|
|
41
|
+
};
|
|
42
|
+
why: "Grants privileges. Quorum + bind user + permission set.";
|
|
43
|
+
execution_binding: {
|
|
44
|
+
required_fields: string[];
|
|
45
|
+
};
|
|
46
|
+
}>)[];
|
|
47
|
+
export declare const SALESFORCE_OPS: readonly string[];
|
|
48
|
+
export declare function createSalesforceManifest(extra?: never[]): {
|
|
49
|
+
'@version': string;
|
|
50
|
+
actions: any[];
|
|
51
|
+
};
|
|
52
|
+
export declare function guardSalesforceMutation(gate: any, client: any, args: any): Promise<{
|
|
53
|
+
result: any;
|
|
54
|
+
reliance: any;
|
|
55
|
+
execution: any;
|
|
56
|
+
}>;
|
|
57
|
+
declare const _default: {
|
|
58
|
+
SALESFORCE_ACTION_PACK: readonly (Readonly<{
|
|
59
|
+
id: "salesforce.records.bulk_delete";
|
|
60
|
+
label: "Bulk delete records";
|
|
61
|
+
action_type: "salesforce.records.bulk_delete";
|
|
62
|
+
risk: "critical";
|
|
63
|
+
receipt_required: true;
|
|
64
|
+
assurance_class: "class_a";
|
|
65
|
+
match: {
|
|
66
|
+
protocol: string;
|
|
67
|
+
tool: string;
|
|
68
|
+
};
|
|
69
|
+
why: "Mass-destroys CRM records. Bind object + the exact SOQL.";
|
|
70
|
+
execution_binding: {
|
|
71
|
+
required_fields: string[];
|
|
72
|
+
};
|
|
73
|
+
}> | Readonly<{
|
|
74
|
+
id: "salesforce.data.export";
|
|
75
|
+
label: "Bulk data export";
|
|
76
|
+
action_type: "salesforce.data.export";
|
|
77
|
+
risk: "high";
|
|
78
|
+
receipt_required: true;
|
|
79
|
+
assurance_class: "class_a";
|
|
80
|
+
match: {
|
|
81
|
+
protocol: string;
|
|
82
|
+
tool: string;
|
|
83
|
+
};
|
|
84
|
+
why: "Exfiltrates CRM data. Bind object + recipient.";
|
|
85
|
+
execution_binding: {
|
|
86
|
+
required_fields: string[];
|
|
87
|
+
};
|
|
88
|
+
}> | Readonly<{
|
|
89
|
+
id: "salesforce.permission_set.assign";
|
|
90
|
+
label: "Assign permission set";
|
|
91
|
+
action_type: "salesforce.permission_set.assign";
|
|
92
|
+
risk: "critical";
|
|
93
|
+
receipt_required: true;
|
|
94
|
+
assurance_class: "quorum";
|
|
95
|
+
match: {
|
|
96
|
+
protocol: string;
|
|
97
|
+
tool: string;
|
|
98
|
+
};
|
|
99
|
+
why: "Grants privileges. Quorum + bind user + permission set.";
|
|
100
|
+
execution_binding: {
|
|
101
|
+
required_fields: string[];
|
|
102
|
+
};
|
|
103
|
+
}>)[];
|
|
104
|
+
SALESFORCE_OPS: readonly string[];
|
|
105
|
+
createSalesforceManifest: typeof createSalesforceManifest;
|
|
106
|
+
guardSalesforceMutation: typeof guardSalesforceMutation;
|
|
107
|
+
};
|
|
108
|
+
export default _default;
|
|
109
|
+
//# sourceMappingURL=salesforce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"salesforce.d.ts","sourceRoot":"","sources":["../../src/adapters/salesforce.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsBjC,CAAC;AAsBH,eAAO,MAAM,cAAc,mBAAc,CAAC;AAC1C,wBAAgB,wBAAwB,CAAC,KAAK,UAAK;;;EAA6D;AAChH,wBAAgB,uBAAuB,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,EAAE,IAAI,KAAA;;;;GAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACzG,wBAA6G"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* EMILIA Gate — Salesforce System-of-Record adapter.
|
|
4
|
+
* Guards bulk record delete, data export, and permission-set assignment so they
|
|
5
|
+
* never reach Salesforce without a receipt bound to THIS object. Client injected.
|
|
6
|
+
*/
|
|
7
|
+
import { createAdapter, manifestFromPack, hashCanonical } from './_kit.js';
|
|
8
|
+
export const SALESFORCE_ACTION_PACK = Object.freeze([
|
|
9
|
+
Object.freeze({
|
|
10
|
+
id: 'salesforce.records.bulk_delete', label: 'Bulk delete records', action_type: 'salesforce.records.bulk_delete',
|
|
11
|
+
risk: 'critical', receipt_required: true, assurance_class: 'class_a',
|
|
12
|
+
match: { protocol: 'salesforce', tool: 'bulk_delete' },
|
|
13
|
+
why: 'Mass-destroys CRM records. Bind object + the exact SOQL.',
|
|
14
|
+
execution_binding: { required_fields: ['action_type', 'object', 'soql_hash'] },
|
|
15
|
+
}),
|
|
16
|
+
Object.freeze({
|
|
17
|
+
id: 'salesforce.data.export', label: 'Bulk data export', action_type: 'salesforce.data.export',
|
|
18
|
+
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
19
|
+
match: { protocol: 'salesforce', tool: 'export' },
|
|
20
|
+
why: 'Exfiltrates CRM data. Bind object + recipient.',
|
|
21
|
+
execution_binding: { required_fields: ['action_type', 'object', 'recipient'] },
|
|
22
|
+
}),
|
|
23
|
+
Object.freeze({
|
|
24
|
+
id: 'salesforce.permission_set.assign', label: 'Assign permission set', action_type: 'salesforce.permission_set.assign',
|
|
25
|
+
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
26
|
+
match: { protocol: 'salesforce', tool: 'assign_permission_set' },
|
|
27
|
+
why: 'Grants privileges. Quorum + bind user + permission set.',
|
|
28
|
+
execution_binding: { required_fields: ['action_type', 'user', 'permission_set'] },
|
|
29
|
+
}),
|
|
30
|
+
]);
|
|
31
|
+
const OPS = {
|
|
32
|
+
'records.bulk_delete': {
|
|
33
|
+
selector: { protocol: 'salesforce', tool: 'bulk_delete' },
|
|
34
|
+
observed: (p) => ({ action_type: 'salesforce.records.bulk_delete', object: p.object, soql_hash: hashCanonical(String(p.soql || '').trim()) }),
|
|
35
|
+
actuator: (p, observed) => ({ ...observed, soql: p.soql }),
|
|
36
|
+
perform: (c, p) => c.bulkDelete({ object: p.object, soql: p.soql }),
|
|
37
|
+
},
|
|
38
|
+
'data.export': {
|
|
39
|
+
selector: { protocol: 'salesforce', tool: 'export' },
|
|
40
|
+
observed: (p) => ({ action_type: 'salesforce.data.export', object: p.object, recipient: p.recipient }),
|
|
41
|
+
perform: (c, p) => c.export({ object: p.object, recipient: p.recipient }),
|
|
42
|
+
},
|
|
43
|
+
'permission_set.assign': {
|
|
44
|
+
selector: { protocol: 'salesforce', tool: 'assign_permission_set' },
|
|
45
|
+
observed: (p) => ({ action_type: 'salesforce.permission_set.assign', user: p.user, permission_set: p.permission_set }),
|
|
46
|
+
perform: (c, p) => c.assignPermissionSet({ user: p.user, permissionSet: p.permission_set }),
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const adapter = createAdapter({ system: 'salesforce', ops: OPS });
|
|
50
|
+
export const SALESFORCE_OPS = adapter.OPS;
|
|
51
|
+
export function createSalesforceManifest(extra = []) { return manifestFromPack(SALESFORCE_ACTION_PACK, extra); }
|
|
52
|
+
export function guardSalesforceMutation(gate, client, args) { return adapter.guard(gate, client, args); }
|
|
53
|
+
export default { SALESFORCE_ACTION_PACK, SALESFORCE_OPS, createSalesforceManifest, guardSalesforceMutation };
|
|
54
|
+
//# sourceMappingURL=salesforce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"salesforce.js","sourceRoot":"","sources":["../../src/adapters/salesforce.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;I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AAE,CAAC,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC;QACtH,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC;KAC5F;CACF,CAAC;AAEF,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AAClE,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC;AAC1C,MAAM,UAAU,wBAAwB,CAAC,KAAK,GAAG,EAAE,IAAI,OAAO,gBAAgB,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAChH,MAAM,UAAU,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACzG,eAAe,EAAE,sBAAsB,EAAE,cAAc,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export declare const STRIPE_ACTION_PACK: readonly (Readonly<{
|
|
2
|
+
id: "stripe.payout.create";
|
|
3
|
+
label: "Stripe payout";
|
|
4
|
+
action_type: "stripe.payout.create";
|
|
5
|
+
risk: "critical";
|
|
6
|
+
receipt_required: true;
|
|
7
|
+
assurance_class: "class_a";
|
|
8
|
+
match: {
|
|
9
|
+
protocol: string;
|
|
10
|
+
tool: string;
|
|
11
|
+
};
|
|
12
|
+
why: "Moves money out. Bind amount/currency/destination to a named human approval.";
|
|
13
|
+
execution_binding: {
|
|
14
|
+
required_fields: string[];
|
|
15
|
+
};
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
id: "stripe.refund.create";
|
|
18
|
+
label: "Stripe refund";
|
|
19
|
+
action_type: "stripe.refund.create";
|
|
20
|
+
risk: "high";
|
|
21
|
+
receipt_required: true;
|
|
22
|
+
assurance_class: "class_a";
|
|
23
|
+
match: {
|
|
24
|
+
protocol: string;
|
|
25
|
+
tool: string;
|
|
26
|
+
};
|
|
27
|
+
why: "Returns funds. Bind the payment and amount so a refund cannot be silently inflated.";
|
|
28
|
+
execution_binding: {
|
|
29
|
+
required_fields: string[];
|
|
30
|
+
};
|
|
31
|
+
}> | Readonly<{
|
|
32
|
+
id: "stripe.bank_account.change";
|
|
33
|
+
label: "Stripe payout-destination change";
|
|
34
|
+
action_type: "stripe.bank_account.change";
|
|
35
|
+
risk: "critical";
|
|
36
|
+
receipt_required: true;
|
|
37
|
+
assurance_class: "quorum";
|
|
38
|
+
match: {
|
|
39
|
+
protocol: string;
|
|
40
|
+
tool: string;
|
|
41
|
+
};
|
|
42
|
+
why: "Changes WHERE future money flows. Quorum: the classic redirect-the-payouts attack.";
|
|
43
|
+
execution_binding: {
|
|
44
|
+
required_fields: string[];
|
|
45
|
+
};
|
|
46
|
+
}>)[];
|
|
47
|
+
export declare const STRIPE_OPS: readonly string[];
|
|
48
|
+
export declare function createStripeManifest(extraActions?: never[]): {
|
|
49
|
+
'@version': string;
|
|
50
|
+
actions: any[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Guard a destructive Stripe mutation behind the gate.
|
|
54
|
+
* @param {object} gate a gate built with createStripeManifest()
|
|
55
|
+
* @param {object} stripe a Stripe-like client (the official `stripe` SDK or compatible)
|
|
56
|
+
* @param {object} args { op:'payout.create'|'refund.create'|'bank_account.change', params, receipt }
|
|
57
|
+
* @throws Error{code:'EMILIA_RECEIPT_REQUIRED'} if refused — the call never reaches Stripe
|
|
58
|
+
*/
|
|
59
|
+
export declare function guardStripeMutation(gate: any, stripe: any, args: any): Promise<{
|
|
60
|
+
result: any;
|
|
61
|
+
reliance: any;
|
|
62
|
+
execution: any;
|
|
63
|
+
}>;
|
|
64
|
+
declare const _default: {
|
|
65
|
+
STRIPE_ACTION_PACK: readonly (Readonly<{
|
|
66
|
+
id: "stripe.payout.create";
|
|
67
|
+
label: "Stripe payout";
|
|
68
|
+
action_type: "stripe.payout.create";
|
|
69
|
+
risk: "critical";
|
|
70
|
+
receipt_required: true;
|
|
71
|
+
assurance_class: "class_a";
|
|
72
|
+
match: {
|
|
73
|
+
protocol: string;
|
|
74
|
+
tool: string;
|
|
75
|
+
};
|
|
76
|
+
why: "Moves money out. Bind amount/currency/destination to a named human approval.";
|
|
77
|
+
execution_binding: {
|
|
78
|
+
required_fields: string[];
|
|
79
|
+
};
|
|
80
|
+
}> | Readonly<{
|
|
81
|
+
id: "stripe.refund.create";
|
|
82
|
+
label: "Stripe refund";
|
|
83
|
+
action_type: "stripe.refund.create";
|
|
84
|
+
risk: "high";
|
|
85
|
+
receipt_required: true;
|
|
86
|
+
assurance_class: "class_a";
|
|
87
|
+
match: {
|
|
88
|
+
protocol: string;
|
|
89
|
+
tool: string;
|
|
90
|
+
};
|
|
91
|
+
why: "Returns funds. Bind the payment and amount so a refund cannot be silently inflated.";
|
|
92
|
+
execution_binding: {
|
|
93
|
+
required_fields: string[];
|
|
94
|
+
};
|
|
95
|
+
}> | Readonly<{
|
|
96
|
+
id: "stripe.bank_account.change";
|
|
97
|
+
label: "Stripe payout-destination change";
|
|
98
|
+
action_type: "stripe.bank_account.change";
|
|
99
|
+
risk: "critical";
|
|
100
|
+
receipt_required: true;
|
|
101
|
+
assurance_class: "quorum";
|
|
102
|
+
match: {
|
|
103
|
+
protocol: string;
|
|
104
|
+
tool: string;
|
|
105
|
+
};
|
|
106
|
+
why: "Changes WHERE future money flows. Quorum: the classic redirect-the-payouts attack.";
|
|
107
|
+
execution_binding: {
|
|
108
|
+
required_fields: string[];
|
|
109
|
+
};
|
|
110
|
+
}>)[];
|
|
111
|
+
STRIPE_OPS: readonly string[];
|
|
112
|
+
createStripeManifest: typeof createStripeManifest;
|
|
113
|
+
guardStripeMutation: typeof guardStripeMutation;
|
|
114
|
+
};
|
|
115
|
+
export default _default;
|
|
116
|
+
//# sourceMappingURL=stripe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../src/adapters/stripe.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsB7B,CAAC;AAqBH,eAAO,MAAM,UAAU,mBAAc,CAAC;AAEtC,wBAAgB,oBAAoB,CAAC,YAAY,UAAK;;;EAErD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,EAAE,IAAI,KAAA;;;;GAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBAA6F"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* EMILIA Gate — Stripe / payments System-of-Record adapter.
|
|
4
|
+
*
|
|
5
|
+
* "Install this before your agent can move money." Wraps the destructive Stripe
|
|
6
|
+
* operations so a payout, refund, or payout-destination change never reaches
|
|
7
|
+
* Stripe without a valid, sufficiently-assured, non-replayed receipt bound to
|
|
8
|
+
* THIS amount/destination. A receipt for $100 to acct_A cannot authorize
|
|
9
|
+
* $10,000 to acct_B.
|
|
10
|
+
*
|
|
11
|
+
* import Stripe from 'stripe';
|
|
12
|
+
* import { createGate } from '@emilia-protocol/gate';
|
|
13
|
+
* import { createStripeManifest, guardStripeMutation } from '@emilia-protocol/gate/adapters/stripe';
|
|
14
|
+
*
|
|
15
|
+
* const gate = createGate({ manifest: createStripeManifest(), trustedKeys: [ISSUER], store: sharedConsumptionStore });
|
|
16
|
+
* await guardStripeMutation(gate, new Stripe(key), {
|
|
17
|
+
* op: 'payout.create', params: { amount: 40000, currency: 'usd', destination: 'acct_x' }, receipt,
|
|
18
|
+
* });
|
|
19
|
+
*/
|
|
20
|
+
import { createAdapter, manifestFromPack } from './_kit.js';
|
|
21
|
+
export const STRIPE_ACTION_PACK = Object.freeze([
|
|
22
|
+
Object.freeze({
|
|
23
|
+
id: 'stripe.payout.create', label: 'Stripe payout', action_type: 'stripe.payout.create',
|
|
24
|
+
risk: 'critical', receipt_required: true, assurance_class: 'class_a',
|
|
25
|
+
match: { protocol: 'stripe', tool: 'create_payout' },
|
|
26
|
+
why: 'Moves money out. Bind amount/currency/destination to a named human approval.',
|
|
27
|
+
execution_binding: { required_fields: ['action_type', 'amount', 'currency', 'destination'] },
|
|
28
|
+
}),
|
|
29
|
+
Object.freeze({
|
|
30
|
+
id: 'stripe.refund.create', label: 'Stripe refund', action_type: 'stripe.refund.create',
|
|
31
|
+
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
32
|
+
match: { protocol: 'stripe', tool: 'create_refund' },
|
|
33
|
+
why: 'Returns funds. Bind the payment and amount so a refund cannot be silently inflated.',
|
|
34
|
+
execution_binding: { required_fields: ['action_type', 'payment_intent', 'amount'] },
|
|
35
|
+
}),
|
|
36
|
+
Object.freeze({
|
|
37
|
+
id: 'stripe.bank_account.change', label: 'Stripe payout-destination change', action_type: 'stripe.bank_account.change',
|
|
38
|
+
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
39
|
+
match: { protocol: 'stripe', tool: 'update_external_account' },
|
|
40
|
+
why: 'Changes WHERE future money flows. Quorum: the classic redirect-the-payouts attack.',
|
|
41
|
+
execution_binding: { required_fields: ['action_type', 'account', 'external_account'] },
|
|
42
|
+
}),
|
|
43
|
+
]);
|
|
44
|
+
const OPS = {
|
|
45
|
+
'payout.create': {
|
|
46
|
+
selector: { protocol: 'stripe', tool: 'create_payout' },
|
|
47
|
+
observed: (p) => ({ action_type: 'stripe.payout.create', amount: p.amount, currency: p.currency, destination: p.destination }),
|
|
48
|
+
perform: (stripe, p) => stripe.payouts.create({ amount: p.amount, currency: p.currency, destination: p.destination }),
|
|
49
|
+
},
|
|
50
|
+
'refund.create': {
|
|
51
|
+
selector: { protocol: 'stripe', tool: 'create_refund' },
|
|
52
|
+
observed: (p) => ({ action_type: 'stripe.refund.create', payment_intent: p.payment_intent, amount: p.amount }),
|
|
53
|
+
perform: (stripe, p) => stripe.refunds.create({ payment_intent: p.payment_intent, amount: p.amount }),
|
|
54
|
+
},
|
|
55
|
+
'bank_account.change': {
|
|
56
|
+
selector: { protocol: 'stripe', tool: 'update_external_account' },
|
|
57
|
+
observed: (p) => ({ action_type: 'stripe.bank_account.change', account: p.account, external_account: p.external_account }),
|
|
58
|
+
perform: (stripe, p) => stripe.accounts.updateExternalAccount(p.account, p.external_account, p.update || {}),
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
const adapter = createAdapter({ system: 'stripe', ops: OPS });
|
|
62
|
+
export const STRIPE_OPS = adapter.OPS;
|
|
63
|
+
export function createStripeManifest(extraActions = []) {
|
|
64
|
+
return manifestFromPack(STRIPE_ACTION_PACK, extraActions);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Guard a destructive Stripe mutation behind the gate.
|
|
68
|
+
* @param {object} gate a gate built with createStripeManifest()
|
|
69
|
+
* @param {object} stripe a Stripe-like client (the official `stripe` SDK or compatible)
|
|
70
|
+
* @param {object} args { op:'payout.create'|'refund.create'|'bank_account.change', params, receipt }
|
|
71
|
+
* @throws Error{code:'EMILIA_RECEIPT_REQUIRED'} if refused — the call never reaches Stripe
|
|
72
|
+
*/
|
|
73
|
+
export function guardStripeMutation(gate, stripe, args) {
|
|
74
|
+
return adapter.guard(gate, stripe, args);
|
|
75
|
+
}
|
|
76
|
+
export default { STRIPE_ACTION_PACK, STRIPE_OPS, createStripeManifest, guardStripeMutation };
|
|
77
|
+
//# sourceMappingURL=stripe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe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