@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
package/adapters/jira.js
CHANGED
|
@@ -1,56 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
* reach Jira without a receipt bound to THIS resource. Client injected.
|
|
6
|
-
*/
|
|
7
|
-
import { createAdapter, manifestFromPack, hashCanonical } from './_kit.js';
|
|
8
|
-
|
|
9
|
-
export const JIRA_ACTION_PACK = Object.freeze([
|
|
10
|
-
Object.freeze({
|
|
11
|
-
id: 'jira.issue.bulk_delete', label: 'Bulk delete issues', action_type: 'jira.issue.bulk_delete',
|
|
12
|
-
risk: 'critical', receipt_required: true, assurance_class: 'class_a',
|
|
13
|
-
match: { protocol: 'jira', tool: 'bulk_delete_issues' },
|
|
14
|
-
why: 'Mass-destroys issues. Bind the exact JQL.',
|
|
15
|
-
execution_binding: { required_fields: ['action_type', 'project', 'jql_hash'] },
|
|
16
|
-
}),
|
|
17
|
-
Object.freeze({
|
|
18
|
-
id: 'jira.project.delete', label: 'Delete project', action_type: 'jira.project.delete',
|
|
19
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
20
|
-
match: { protocol: 'jira', tool: 'delete_project' },
|
|
21
|
-
why: 'Deletes a project and its issues. Quorum.',
|
|
22
|
-
execution_binding: { required_fields: ['action_type', 'project_key'] },
|
|
23
|
-
}),
|
|
24
|
-
Object.freeze({
|
|
25
|
-
id: 'jira.permission.grant', label: 'Grant permission', action_type: 'jira.permission.grant',
|
|
26
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
27
|
-
match: { protocol: 'jira', tool: 'grant_permission' },
|
|
28
|
-
why: 'Changes who can act. Quorum + bind project/principal/role.',
|
|
29
|
-
execution_binding: { required_fields: ['action_type', 'project', 'principal', 'role'] },
|
|
30
|
-
}),
|
|
31
|
-
]);
|
|
32
|
-
|
|
33
|
-
const OPS = {
|
|
34
|
-
'issue.bulk_delete': {
|
|
35
|
-
selector: { protocol: 'jira', tool: 'bulk_delete_issues' },
|
|
36
|
-
observed: (p) => ({ action_type: 'jira.issue.bulk_delete', project: p.project, jql_hash: hashCanonical(String(p.jql || '').trim()) }),
|
|
37
|
-
actuator: (p, observed) => ({ ...observed, jql: p.jql }),
|
|
38
|
-
perform: (c, p) => c.bulkDeleteIssues({ project: p.project, jql: p.jql }),
|
|
39
|
-
},
|
|
40
|
-
'project.delete': {
|
|
41
|
-
selector: { protocol: 'jira', tool: 'delete_project' },
|
|
42
|
-
observed: (p) => ({ action_type: 'jira.project.delete', project_key: p.project_key }),
|
|
43
|
-
perform: (c, p) => c.deleteProject({ projectKey: p.project_key }),
|
|
44
|
-
},
|
|
45
|
-
'permission.grant': {
|
|
46
|
-
selector: { protocol: 'jira', tool: 'grant_permission' },
|
|
47
|
-
observed: (p) => ({ action_type: 'jira.permission.grant', project: p.project, principal: p.principal, role: p.role }),
|
|
48
|
-
perform: (c, p) => c.grantPermission({ project: p.project, principal: p.principal, role: p.role }),
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const adapter = createAdapter({ system: 'jira', ops: OPS });
|
|
53
|
-
export const JIRA_OPS = adapter.OPS;
|
|
54
|
-
export function createJiraManifest(extra = []) { return manifestFromPack(JIRA_ACTION_PACK, extra); }
|
|
55
|
-
export function guardJiraMutation(gate, client, args) { return adapter.guard(gate, client, args); }
|
|
56
|
-
export default { JIRA_ACTION_PACK, JIRA_OPS, createJiraManifest, guardJiraMutation };
|
|
2
|
+
// Compatibility entry point for the TypeScript jira adapter module.
|
|
3
|
+
export * from '../dist/adapters/jira.js';
|
|
4
|
+
export { default } from '../dist/adapters/jira.js';
|
package/adapters/k8s.js
CHANGED
|
@@ -1,71 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
|
-
*
|
|
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
|
-
|
|
13
|
-
export const K8S_ACTION_PACK = Object.freeze([
|
|
14
|
-
Object.freeze({
|
|
15
|
-
id: 'k8s.namespace.delete', label: 'Delete namespace', action_type: 'k8s.namespace.delete',
|
|
16
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
17
|
-
match: { protocol: 'k8s', tool: 'delete_namespace' },
|
|
18
|
-
why: 'Deletes an entire namespace and everything in it. Quorum.',
|
|
19
|
-
execution_binding: { required_fields: ['action_type', 'namespace'] },
|
|
20
|
-
}),
|
|
21
|
-
Object.freeze({
|
|
22
|
-
id: 'k8s.workload.delete', label: 'Delete workload', action_type: 'k8s.workload.delete',
|
|
23
|
-
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
24
|
-
match: { protocol: 'k8s', tool: 'delete_workload' },
|
|
25
|
-
why: 'Deletes a deployment/statefulset/job. Bind namespace+kind+name.',
|
|
26
|
-
execution_binding: { required_fields: ['action_type', 'namespace', 'kind', 'name'] },
|
|
27
|
-
}),
|
|
28
|
-
Object.freeze({
|
|
29
|
-
id: 'k8s.rbac.bind', label: 'RBAC binding', action_type: 'k8s.rbac.bind',
|
|
30
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
31
|
-
match: { protocol: 'k8s', tool: 'create_role_binding' },
|
|
32
|
-
why: 'Grants cluster permissions. Privilege change → two-person rule.',
|
|
33
|
-
execution_binding: { required_fields: ['action_type', 'subject', 'role', 'namespace'] },
|
|
34
|
-
}),
|
|
35
|
-
Object.freeze({
|
|
36
|
-
id: 'k8s.secret.delete', label: 'Delete secret', action_type: 'k8s.secret.delete',
|
|
37
|
-
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
38
|
-
match: { protocol: 'k8s', tool: 'delete_secret' },
|
|
39
|
-
why: 'Destroys a secret. Bind namespace+name.',
|
|
40
|
-
execution_binding: { required_fields: ['action_type', 'namespace', 'name'] },
|
|
41
|
-
}),
|
|
42
|
-
]);
|
|
43
|
-
|
|
44
|
-
const OPS = {
|
|
45
|
-
'namespace.delete': {
|
|
46
|
-
selector: { protocol: 'k8s', tool: 'delete_namespace' },
|
|
47
|
-
observed: (p) => ({ action_type: 'k8s.namespace.delete', namespace: p.namespace }),
|
|
48
|
-
perform: (c, p) => c.deleteNamespace({ namespace: p.namespace }),
|
|
49
|
-
},
|
|
50
|
-
'workload.delete': {
|
|
51
|
-
selector: { protocol: 'k8s', tool: 'delete_workload' },
|
|
52
|
-
observed: (p) => ({ action_type: 'k8s.workload.delete', namespace: p.namespace, kind: p.kind, name: p.name }),
|
|
53
|
-
perform: (c, p) => c.deleteWorkload({ namespace: p.namespace, kind: p.kind, name: p.name }),
|
|
54
|
-
},
|
|
55
|
-
'rbac.bind': {
|
|
56
|
-
selector: { protocol: 'k8s', tool: 'create_role_binding' },
|
|
57
|
-
observed: (p) => ({ action_type: 'k8s.rbac.bind', subject: p.subject, role: p.role, namespace: p.namespace }),
|
|
58
|
-
perform: (c, p) => c.createRoleBinding({ subject: p.subject, role: p.role, namespace: p.namespace }),
|
|
59
|
-
},
|
|
60
|
-
'secret.delete': {
|
|
61
|
-
selector: { protocol: 'k8s', tool: 'delete_secret' },
|
|
62
|
-
observed: (p) => ({ action_type: 'k8s.secret.delete', namespace: p.namespace, name: p.name }),
|
|
63
|
-
perform: (c, p) => c.deleteSecret({ namespace: p.namespace, name: p.name }),
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const adapter = createAdapter({ system: 'k8s', ops: OPS });
|
|
68
|
-
export const K8S_OPS = adapter.OPS;
|
|
69
|
-
export function createK8sManifest(extraActions = []) { return manifestFromPack(K8S_ACTION_PACK, extraActions); }
|
|
70
|
-
export function guardK8sMutation(gate, client, args) { return adapter.guard(gate, client, args); }
|
|
71
|
-
export default { K8S_ACTION_PACK, K8S_OPS, createK8sManifest, guardK8sMutation };
|
|
2
|
+
// Compatibility entry point for the TypeScript k8s adapter module.
|
|
3
|
+
export * from '../dist/adapters/k8s.js';
|
|
4
|
+
export { default } from '../dist/adapters/k8s.js';
|
package/adapters/linear.js
CHANGED
|
@@ -1,56 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
* Linear without a receipt bound to THIS resource. Client injected.
|
|
6
|
-
*/
|
|
7
|
-
import { createAdapter, manifestFromPack, hashCanonical } from './_kit.js';
|
|
8
|
-
|
|
9
|
-
export const LINEAR_ACTION_PACK = Object.freeze([
|
|
10
|
-
Object.freeze({
|
|
11
|
-
id: 'linear.issue.delete', label: 'Delete issue', action_type: 'linear.issue.delete',
|
|
12
|
-
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
13
|
-
match: { protocol: 'linear', tool: 'delete_issue' },
|
|
14
|
-
why: 'Destroys an issue. Bind the issue id.',
|
|
15
|
-
execution_binding: { required_fields: ['action_type', 'issue_id'] },
|
|
16
|
-
}),
|
|
17
|
-
Object.freeze({
|
|
18
|
-
id: 'linear.issue.bulk_delete', label: 'Bulk delete issues', action_type: 'linear.issue.bulk_delete',
|
|
19
|
-
risk: 'critical', receipt_required: true, assurance_class: 'class_a',
|
|
20
|
-
match: { protocol: 'linear', tool: 'bulk_delete_issues' },
|
|
21
|
-
why: 'Mass-destroys issues. Bind the exact query.',
|
|
22
|
-
execution_binding: { required_fields: ['action_type', 'team', 'query_hash'] },
|
|
23
|
-
}),
|
|
24
|
-
Object.freeze({
|
|
25
|
-
id: 'linear.team.delete', label: 'Delete team', action_type: 'linear.team.delete',
|
|
26
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
27
|
-
match: { protocol: 'linear', tool: 'delete_team' },
|
|
28
|
-
why: 'Deletes a team and its issues. Quorum.',
|
|
29
|
-
execution_binding: { required_fields: ['action_type', 'team_id'] },
|
|
30
|
-
}),
|
|
31
|
-
]);
|
|
32
|
-
|
|
33
|
-
const OPS = {
|
|
34
|
-
'issue.delete': {
|
|
35
|
-
selector: { protocol: 'linear', tool: 'delete_issue' },
|
|
36
|
-
observed: (p) => ({ action_type: 'linear.issue.delete', issue_id: p.issue_id }),
|
|
37
|
-
perform: (c, p) => c.deleteIssue({ issueId: p.issue_id }),
|
|
38
|
-
},
|
|
39
|
-
'issue.bulk_delete': {
|
|
40
|
-
selector: { protocol: 'linear', tool: 'bulk_delete_issues' },
|
|
41
|
-
observed: (p) => ({ action_type: 'linear.issue.bulk_delete', team: p.team, query_hash: hashCanonical(String(p.query || '').trim()) }),
|
|
42
|
-
actuator: (p, observed) => ({ ...observed, query: p.query }),
|
|
43
|
-
perform: (c, p) => c.bulkDeleteIssues({ team: p.team, query: p.query }),
|
|
44
|
-
},
|
|
45
|
-
'team.delete': {
|
|
46
|
-
selector: { protocol: 'linear', tool: 'delete_team' },
|
|
47
|
-
observed: (p) => ({ action_type: 'linear.team.delete', team_id: p.team_id }),
|
|
48
|
-
perform: (c, p) => c.deleteTeam({ teamId: p.team_id }),
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const adapter = createAdapter({ system: 'linear', ops: OPS });
|
|
53
|
-
export const LINEAR_OPS = adapter.OPS;
|
|
54
|
-
export function createLinearManifest(extra = []) { return manifestFromPack(LINEAR_ACTION_PACK, extra); }
|
|
55
|
-
export function guardLinearMutation(gate, client, args) { return adapter.guard(gate, client, args); }
|
|
56
|
-
export default { LINEAR_ACTION_PACK, LINEAR_OPS, createLinearManifest, guardLinearMutation };
|
|
2
|
+
// Compatibility entry point for the TypeScript linear adapter module.
|
|
3
|
+
export * from '../dist/adapters/linear.js';
|
|
4
|
+
export { default } from '../dist/adapters/linear.js';
|
package/adapters/salesforce.js
CHANGED
|
@@ -1,56 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
* never reach Salesforce without a receipt bound to THIS object. Client injected.
|
|
6
|
-
*/
|
|
7
|
-
import { createAdapter, manifestFromPack, hashCanonical } from './_kit.js';
|
|
8
|
-
|
|
9
|
-
export const SALESFORCE_ACTION_PACK = Object.freeze([
|
|
10
|
-
Object.freeze({
|
|
11
|
-
id: 'salesforce.records.bulk_delete', label: 'Bulk delete records', action_type: 'salesforce.records.bulk_delete',
|
|
12
|
-
risk: 'critical', receipt_required: true, assurance_class: 'class_a',
|
|
13
|
-
match: { protocol: 'salesforce', tool: 'bulk_delete' },
|
|
14
|
-
why: 'Mass-destroys CRM records. Bind object + the exact SOQL.',
|
|
15
|
-
execution_binding: { required_fields: ['action_type', 'object', 'soql_hash'] },
|
|
16
|
-
}),
|
|
17
|
-
Object.freeze({
|
|
18
|
-
id: 'salesforce.data.export', label: 'Bulk data export', action_type: 'salesforce.data.export',
|
|
19
|
-
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
20
|
-
match: { protocol: 'salesforce', tool: 'export' },
|
|
21
|
-
why: 'Exfiltrates CRM data. Bind object + recipient.',
|
|
22
|
-
execution_binding: { required_fields: ['action_type', 'object', 'recipient'] },
|
|
23
|
-
}),
|
|
24
|
-
Object.freeze({
|
|
25
|
-
id: 'salesforce.permission_set.assign', label: 'Assign permission set', action_type: 'salesforce.permission_set.assign',
|
|
26
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
27
|
-
match: { protocol: 'salesforce', tool: 'assign_permission_set' },
|
|
28
|
-
why: 'Grants privileges. Quorum + bind user + permission set.',
|
|
29
|
-
execution_binding: { required_fields: ['action_type', 'user', 'permission_set'] },
|
|
30
|
-
}),
|
|
31
|
-
]);
|
|
32
|
-
|
|
33
|
-
const OPS = {
|
|
34
|
-
'records.bulk_delete': {
|
|
35
|
-
selector: { protocol: 'salesforce', tool: 'bulk_delete' },
|
|
36
|
-
observed: (p) => ({ action_type: 'salesforce.records.bulk_delete', object: p.object, soql_hash: hashCanonical(String(p.soql || '').trim()) }),
|
|
37
|
-
actuator: (p, observed) => ({ ...observed, soql: p.soql }),
|
|
38
|
-
perform: (c, p) => c.bulkDelete({ object: p.object, soql: p.soql }),
|
|
39
|
-
},
|
|
40
|
-
'data.export': {
|
|
41
|
-
selector: { protocol: 'salesforce', tool: 'export' },
|
|
42
|
-
observed: (p) => ({ action_type: 'salesforce.data.export', object: p.object, recipient: p.recipient }),
|
|
43
|
-
perform: (c, p) => c.export({ object: p.object, recipient: p.recipient }),
|
|
44
|
-
},
|
|
45
|
-
'permission_set.assign': {
|
|
46
|
-
selector: { protocol: 'salesforce', tool: 'assign_permission_set' },
|
|
47
|
-
observed: (p) => ({ action_type: 'salesforce.permission_set.assign', user: p.user, permission_set: p.permission_set }),
|
|
48
|
-
perform: (c, p) => c.assignPermissionSet({ user: p.user, permissionSet: p.permission_set }),
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const adapter = createAdapter({ system: 'salesforce', ops: OPS });
|
|
53
|
-
export const SALESFORCE_OPS = adapter.OPS;
|
|
54
|
-
export function createSalesforceManifest(extra = []) { return manifestFromPack(SALESFORCE_ACTION_PACK, extra); }
|
|
55
|
-
export function guardSalesforceMutation(gate, client, args) { return adapter.guard(gate, client, args); }
|
|
56
|
-
export default { SALESFORCE_ACTION_PACK, SALESFORCE_OPS, createSalesforceManifest, guardSalesforceMutation };
|
|
2
|
+
// Compatibility entry point for the TypeScript salesforce adapter module.
|
|
3
|
+
export * from '../dist/adapters/salesforce.js';
|
|
4
|
+
export { default } from '../dist/adapters/salesforce.js';
|
package/adapters/stripe.js
CHANGED
|
@@ -1,82 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
|
-
*
|
|
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
|
-
|
|
22
|
-
export const STRIPE_ACTION_PACK = Object.freeze([
|
|
23
|
-
Object.freeze({
|
|
24
|
-
id: 'stripe.payout.create', label: 'Stripe payout', action_type: 'stripe.payout.create',
|
|
25
|
-
risk: 'critical', receipt_required: true, assurance_class: 'class_a',
|
|
26
|
-
match: { protocol: 'stripe', tool: 'create_payout' },
|
|
27
|
-
why: 'Moves money out. Bind amount/currency/destination to a named human approval.',
|
|
28
|
-
execution_binding: { required_fields: ['action_type', 'amount', 'currency', 'destination'] },
|
|
29
|
-
}),
|
|
30
|
-
Object.freeze({
|
|
31
|
-
id: 'stripe.refund.create', label: 'Stripe refund', action_type: 'stripe.refund.create',
|
|
32
|
-
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
33
|
-
match: { protocol: 'stripe', tool: 'create_refund' },
|
|
34
|
-
why: 'Returns funds. Bind the payment and amount so a refund cannot be silently inflated.',
|
|
35
|
-
execution_binding: { required_fields: ['action_type', 'payment_intent', 'amount'] },
|
|
36
|
-
}),
|
|
37
|
-
Object.freeze({
|
|
38
|
-
id: 'stripe.bank_account.change', label: 'Stripe payout-destination change', action_type: 'stripe.bank_account.change',
|
|
39
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
40
|
-
match: { protocol: 'stripe', tool: 'update_external_account' },
|
|
41
|
-
why: 'Changes WHERE future money flows. Quorum: the classic redirect-the-payouts attack.',
|
|
42
|
-
execution_binding: { required_fields: ['action_type', 'account', 'external_account'] },
|
|
43
|
-
}),
|
|
44
|
-
]);
|
|
45
|
-
|
|
46
|
-
const OPS = {
|
|
47
|
-
'payout.create': {
|
|
48
|
-
selector: { protocol: 'stripe', tool: 'create_payout' },
|
|
49
|
-
observed: (p) => ({ action_type: 'stripe.payout.create', amount: p.amount, currency: p.currency, destination: p.destination }),
|
|
50
|
-
perform: (stripe, p) => stripe.payouts.create({ amount: p.amount, currency: p.currency, destination: p.destination }),
|
|
51
|
-
},
|
|
52
|
-
'refund.create': {
|
|
53
|
-
selector: { protocol: 'stripe', tool: 'create_refund' },
|
|
54
|
-
observed: (p) => ({ action_type: 'stripe.refund.create', payment_intent: p.payment_intent, amount: p.amount }),
|
|
55
|
-
perform: (stripe, p) => stripe.refunds.create({ payment_intent: p.payment_intent, amount: p.amount }),
|
|
56
|
-
},
|
|
57
|
-
'bank_account.change': {
|
|
58
|
-
selector: { protocol: 'stripe', tool: 'update_external_account' },
|
|
59
|
-
observed: (p) => ({ action_type: 'stripe.bank_account.change', account: p.account, external_account: p.external_account }),
|
|
60
|
-
perform: (stripe, p) => stripe.accounts.updateExternalAccount(p.account, p.external_account, p.update || {}),
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const adapter = createAdapter({ system: 'stripe', ops: OPS });
|
|
65
|
-
export const STRIPE_OPS = adapter.OPS;
|
|
66
|
-
|
|
67
|
-
export function createStripeManifest(extraActions = []) {
|
|
68
|
-
return manifestFromPack(STRIPE_ACTION_PACK, extraActions);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Guard a destructive Stripe mutation behind the gate.
|
|
73
|
-
* @param {object} gate a gate built with createStripeManifest()
|
|
74
|
-
* @param {object} stripe a Stripe-like client (the official `stripe` SDK or compatible)
|
|
75
|
-
* @param {object} o { op:'payout.create'|'refund.create'|'bank_account.change', params, receipt }
|
|
76
|
-
* @throws Error{code:'EMILIA_RECEIPT_REQUIRED'} if refused — the call never reaches Stripe
|
|
77
|
-
*/
|
|
78
|
-
export function guardStripeMutation(gate, stripe, args) {
|
|
79
|
-
return adapter.guard(gate, stripe, args);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export default { STRIPE_ACTION_PACK, STRIPE_OPS, createStripeManifest, guardStripeMutation };
|
|
2
|
+
// Compatibility entry point for the TypeScript stripe adapter module.
|
|
3
|
+
export * from '../dist/adapters/stripe.js';
|
|
4
|
+
export { default } from '../dist/adapters/stripe.js';
|
package/adapters/supabase.js
CHANGED
|
@@ -1,122 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
* "Install this before your agent can run destructive SQL." Wraps the dangerous
|
|
6
|
-
* database operations — destructive SQL (DELETE/DROP/TRUNCATE/UPDATE), bulk
|
|
7
|
-
* export, and RLS-policy change — so they never execute without a valid,
|
|
8
|
-
* sufficiently-assured, non-replayed receipt bound to THIS statement/table. The
|
|
9
|
-
* exact statement is bound by hash, so an approval for one DELETE cannot be
|
|
10
|
-
* swapped for a DROP.
|
|
11
|
-
*
|
|
12
|
-
* import { createGate } from '@emilia-protocol/gate';
|
|
13
|
-
* import { createSupabaseManifest, guardSupabaseMutation, isDestructiveSql } from '@emilia-protocol/gate/adapters/supabase';
|
|
14
|
-
*
|
|
15
|
-
* const gate = createGate({ manifest: createSupabaseManifest(), trustedKeys: [ISSUER], store: sharedConsumptionStore });
|
|
16
|
-
* // client: anything with .query(sql) (node-postgres / a Supabase RPC wrapper).
|
|
17
|
-
* await guardSupabaseMutation(gate, client, {
|
|
18
|
-
* op: 'sql.destructive', params: { sql: 'DELETE FROM payments WHERE id=1', table: 'payments' }, receipt,
|
|
19
|
-
* });
|
|
20
|
-
*/
|
|
21
|
-
import { createAdapter, manifestFromPack, hashCanonical } from './_kit.js';
|
|
22
|
-
|
|
23
|
-
export const RLS_DEFINITION_BINDING_VERSION = 'EP-SUPABASE-RLS-DEFINITION-v1';
|
|
24
|
-
|
|
25
|
-
const DESTRUCTIVE = /\b(delete|drop|truncate|alter\s+table)\b/i;
|
|
26
|
-
const UPDATE_NO_WHERE = /\bupdate\b(?:(?!\bwhere\b).)*$/is;
|
|
27
|
-
|
|
28
|
-
/** Heuristic: is this SQL destructive (DELETE/DROP/TRUNCATE/ALTER, or UPDATE without WHERE)? */
|
|
29
|
-
export function isDestructiveSql(sql) {
|
|
30
|
-
const s = String(sql || '');
|
|
31
|
-
return DESTRUCTIVE.test(s) || UPDATE_NO_WHERE.test(s.trim());
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** Canonical hash of a SQL statement, whitespace-collapsed and lowercased. */
|
|
35
|
-
export function statementHash(sql) {
|
|
36
|
-
return hashCanonical(String(sql || '').replace(/\s+/g, ' ').trim().toLowerCase());
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Digest the exact canonical RLS definition without placing it in evidence. */
|
|
40
|
-
export function rlsDefinitionDigest(definition) {
|
|
41
|
-
return hashCanonical({
|
|
42
|
-
version: RLS_DEFINITION_BINDING_VERSION,
|
|
43
|
-
definition,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const SUPABASE_ACTION_PACK = Object.freeze([
|
|
48
|
-
Object.freeze({
|
|
49
|
-
id: 'supabase.sql.destructive', label: 'Destructive SQL', action_type: 'supabase.sql.destructive',
|
|
50
|
-
risk: 'critical', receipt_required: true, assurance_class: 'class_a',
|
|
51
|
-
match: { protocol: 'supabase', tool: 'execute_sql' },
|
|
52
|
-
why: 'DELETE/DROP/TRUNCATE/ALTER destroys or rewrites system-of-record state. Bind the exact statement.',
|
|
53
|
-
execution_binding: { required_fields: ['action_type', 'statement_hash'] },
|
|
54
|
-
}),
|
|
55
|
-
Object.freeze({
|
|
56
|
-
id: 'supabase.data.export', label: 'Bulk data export', action_type: 'supabase.data.export',
|
|
57
|
-
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
58
|
-
match: { protocol: 'supabase', tool: 'export_table' },
|
|
59
|
-
why: 'Moves data out of its system of record. Bind table + recipient to the approval.',
|
|
60
|
-
execution_binding: { required_fields: ['action_type', 'table', 'recipient'] },
|
|
61
|
-
}),
|
|
62
|
-
Object.freeze({
|
|
63
|
-
id: 'supabase.rls.change', label: 'RLS policy change', action_type: 'supabase.rls.change',
|
|
64
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
65
|
-
match: { protocol: 'supabase', tool: 'alter_policy' },
|
|
66
|
-
why: 'Changes who can read/write rows. Row-Level-Security changes deserve the two-person rule.',
|
|
67
|
-
execution_binding: {
|
|
68
|
-
required_fields: [
|
|
69
|
-
'action_type', 'table', 'policy', 'rls_definition_digest', 'rls_definition_version',
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
73
|
-
]);
|
|
74
|
-
|
|
75
|
-
const OPS = {
|
|
76
|
-
'sql.destructive': {
|
|
77
|
-
selector: { protocol: 'supabase', tool: 'execute_sql' },
|
|
78
|
-
observed: (p) => ({ action_type: 'supabase.sql.destructive', statement_hash: statementHash(p.sql) }),
|
|
79
|
-
actuator: (p, observed) => ({ ...observed, sql: p.sql }),
|
|
80
|
-
perform: (client, p) => client.query(p.sql),
|
|
81
|
-
},
|
|
82
|
-
'data.export': {
|
|
83
|
-
selector: { protocol: 'supabase', tool: 'export_table' },
|
|
84
|
-
observed: (p) => ({ action_type: 'supabase.data.export', table: p.table, recipient: p.recipient }),
|
|
85
|
-
perform: (client, p) => client.export(p.table, p.recipient),
|
|
86
|
-
},
|
|
87
|
-
'rls.change': {
|
|
88
|
-
selector: { protocol: 'supabase', tool: 'alter_policy' },
|
|
89
|
-
observed: (p) => ({
|
|
90
|
-
action_type: 'supabase.rls.change',
|
|
91
|
-
table: p.table,
|
|
92
|
-
policy: p.policy,
|
|
93
|
-
rls_definition_digest: rlsDefinitionDigest(p.definition),
|
|
94
|
-
rls_definition_version: RLS_DEFINITION_BINDING_VERSION,
|
|
95
|
-
}),
|
|
96
|
-
actuator: (p, observed) => ({ ...observed, definition: p.definition }),
|
|
97
|
-
perform: (client, p) => client.alterPolicy(p.table, p.policy, p.definition),
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const adapter = createAdapter({ system: 'supabase', ops: OPS });
|
|
102
|
-
export const SUPABASE_OPS = adapter.OPS;
|
|
103
|
-
|
|
104
|
-
export function createSupabaseManifest(extraActions = []) {
|
|
105
|
-
return manifestFromPack(SUPABASE_ACTION_PACK, extraActions);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Guard a destructive Supabase/Postgres mutation behind the gate.
|
|
110
|
-
* @param {object} gate a gate built with createSupabaseManifest()
|
|
111
|
-
* @param {object} client a client exposing { query(sql), export(table,recipient), alterPolicy(table,policy,def) }
|
|
112
|
-
* @param {object} o { op:'sql.destructive'|'data.export'|'rls.change', params, receipt }
|
|
113
|
-
* @throws Error{code:'EMILIA_RECEIPT_REQUIRED'} if refused — the statement never executes
|
|
114
|
-
*/
|
|
115
|
-
export function guardSupabaseMutation(gate, client, args) {
|
|
116
|
-
return adapter.guard(gate, client, args);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export default {
|
|
120
|
-
SUPABASE_ACTION_PACK, SUPABASE_OPS, createSupabaseManifest, guardSupabaseMutation,
|
|
121
|
-
isDestructiveSql, statementHash, rlsDefinitionDigest, RLS_DEFINITION_BINDING_VERSION,
|
|
122
|
-
};
|
|
2
|
+
// Compatibility entry point for the TypeScript supabase adapter module.
|
|
3
|
+
export * from '../dist/adapters/supabase.js';
|
|
4
|
+
export { default } from '../dist/adapters/supabase.js';
|
package/adapters/terraform.js
CHANGED
|
@@ -1,60 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
* "Install this before your agent can destroy infrastructure." Guards the
|
|
6
|
-
* irreversible Terraform operations — destroy, state rm, workspace delete — so
|
|
7
|
-
* they never run without a receipt bound to THIS workspace/plan. The destroy
|
|
8
|
-
* plan is bound by hash, so an approved small destroy cannot be swapped for a
|
|
9
|
-
* full teardown. Runner is injected (a `terraform`/`tofu` CLI wrapper or Cloud
|
|
10
|
-
* API client).
|
|
11
|
-
*/
|
|
12
|
-
import { createAdapter, manifestFromPack } from './_kit.js';
|
|
13
|
-
|
|
14
|
-
export const TERRAFORM_ACTION_PACK = Object.freeze([
|
|
15
|
-
Object.freeze({
|
|
16
|
-
id: 'terraform.apply.destroy', label: 'Terraform destroy', action_type: 'terraform.apply.destroy',
|
|
17
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
18
|
-
match: { protocol: 'terraform', tool: 'destroy' },
|
|
19
|
-
why: 'Tears down real infrastructure. Bind the workspace + plan hash; quorum.',
|
|
20
|
-
execution_binding: { required_fields: ['action_type', 'workspace', 'plan_hash'] },
|
|
21
|
-
}),
|
|
22
|
-
Object.freeze({
|
|
23
|
-
id: 'terraform.state.rm', label: 'Terraform state rm', action_type: 'terraform.state.rm',
|
|
24
|
-
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
25
|
-
match: { protocol: 'terraform', tool: 'state_rm' },
|
|
26
|
-
why: 'Detaches a resource from state (orphans real infra). Bind workspace+address.',
|
|
27
|
-
execution_binding: { required_fields: ['action_type', 'workspace', 'address'] },
|
|
28
|
-
}),
|
|
29
|
-
Object.freeze({
|
|
30
|
-
id: 'terraform.workspace.delete', label: 'Terraform workspace delete', action_type: 'terraform.workspace.delete',
|
|
31
|
-
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
32
|
-
match: { protocol: 'terraform', tool: 'workspace_delete' },
|
|
33
|
-
why: 'Deletes a workspace and its state. Bind the workspace.',
|
|
34
|
-
execution_binding: { required_fields: ['action_type', 'workspace'] },
|
|
35
|
-
}),
|
|
36
|
-
]);
|
|
37
|
-
|
|
38
|
-
const OPS = {
|
|
39
|
-
'apply.destroy': {
|
|
40
|
-
selector: { protocol: 'terraform', tool: 'destroy' },
|
|
41
|
-
observed: (p) => ({ action_type: 'terraform.apply.destroy', workspace: p.workspace, plan_hash: p.plan_hash }),
|
|
42
|
-
perform: (r, p) => r.destroy({ workspace: p.workspace, plan_hash: p.plan_hash }),
|
|
43
|
-
},
|
|
44
|
-
'state.rm': {
|
|
45
|
-
selector: { protocol: 'terraform', tool: 'state_rm' },
|
|
46
|
-
observed: (p) => ({ action_type: 'terraform.state.rm', workspace: p.workspace, address: p.address }),
|
|
47
|
-
perform: (r, p) => r.stateRm({ workspace: p.workspace, address: p.address }),
|
|
48
|
-
},
|
|
49
|
-
'workspace.delete': {
|
|
50
|
-
selector: { protocol: 'terraform', tool: 'workspace_delete' },
|
|
51
|
-
observed: (p) => ({ action_type: 'terraform.workspace.delete', workspace: p.workspace }),
|
|
52
|
-
perform: (r, p) => r.workspaceDelete({ workspace: p.workspace }),
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const adapter = createAdapter({ system: 'terraform', ops: OPS });
|
|
57
|
-
export const TERRAFORM_OPS = adapter.OPS;
|
|
58
|
-
export function createTerraformManifest(extraActions = []) { return manifestFromPack(TERRAFORM_ACTION_PACK, extraActions); }
|
|
59
|
-
export function guardTerraformMutation(gate, runner, args) { return adapter.guard(gate, runner, args); }
|
|
60
|
-
export default { TERRAFORM_ACTION_PACK, TERRAFORM_OPS, createTerraformManifest, guardTerraformMutation };
|
|
2
|
+
// Compatibility entry point for the TypeScript terraform adapter module.
|
|
3
|
+
export * from '../dist/adapters/terraform.js';
|
|
4
|
+
export { default } from '../dist/adapters/terraform.js';
|
package/adapters/vercel.js
CHANGED
|
@@ -1,85 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
* never reach Vercel without a receipt bound to THIS project. Client injected
|
|
6
|
-
* (the Vercel REST client or a thin wrapper).
|
|
7
|
-
*/
|
|
8
|
-
import { createAdapter, manifestFromPack, hashCanonical } from './_kit.js';
|
|
9
|
-
|
|
10
|
-
export const SECRET_VALUE_BINDING_VERSION = 'EP-VERCEL-SECRET-VALUE-v1';
|
|
11
|
-
|
|
12
|
-
/** Digest an exact secret value for receipt binding; callers must never log it. */
|
|
13
|
-
export function secretValueDigest(value) {
|
|
14
|
-
return hashCanonical({
|
|
15
|
-
version: SECRET_VALUE_BINDING_VERSION,
|
|
16
|
-
value,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const VERCEL_ACTION_PACK = Object.freeze([
|
|
21
|
-
Object.freeze({
|
|
22
|
-
id: 'vercel.deploy.promote', label: 'Promote to production', action_type: 'vercel.deploy.promote',
|
|
23
|
-
risk: 'critical', receipt_required: true, assurance_class: 'quorum',
|
|
24
|
-
match: { protocol: 'vercel', tool: 'promote_deployment' },
|
|
25
|
-
why: 'Changes live production. Quorum for the prod cutover.',
|
|
26
|
-
execution_binding: { required_fields: ['action_type', 'project', 'deployment_id'] },
|
|
27
|
-
}),
|
|
28
|
-
Object.freeze({
|
|
29
|
-
id: 'vercel.project.delete', label: 'Delete project', action_type: 'vercel.project.delete',
|
|
30
|
-
risk: 'critical', receipt_required: true, assurance_class: 'class_a',
|
|
31
|
-
match: { protocol: 'vercel', tool: 'delete_project' },
|
|
32
|
-
why: 'Destroys a project and its deployments. Bind the project.',
|
|
33
|
-
execution_binding: { required_fields: ['action_type', 'project'] },
|
|
34
|
-
}),
|
|
35
|
-
Object.freeze({
|
|
36
|
-
id: 'vercel.env.set', label: 'Set env / secret', action_type: 'vercel.env.set',
|
|
37
|
-
risk: 'high', receipt_required: true, assurance_class: 'class_a',
|
|
38
|
-
match: { protocol: 'vercel', tool: 'upsert_env' },
|
|
39
|
-
why: 'Changes production secrets/config. Bind project+key+target.',
|
|
40
|
-
execution_binding: {
|
|
41
|
-
required_fields: [
|
|
42
|
-
'action_type', 'project', 'key', 'target', 'secret_value_digest', 'secret_value_version',
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
}),
|
|
46
|
-
]);
|
|
47
|
-
|
|
48
|
-
const OPS = {
|
|
49
|
-
'deploy.promote': {
|
|
50
|
-
selector: { protocol: 'vercel', tool: 'promote_deployment' },
|
|
51
|
-
observed: (p) => ({ action_type: 'vercel.deploy.promote', project: p.project, deployment_id: p.deployment_id }),
|
|
52
|
-
perform: (c, p) => c.promoteDeployment({ project: p.project, deploymentId: p.deployment_id }),
|
|
53
|
-
},
|
|
54
|
-
'project.delete': {
|
|
55
|
-
selector: { protocol: 'vercel', tool: 'delete_project' },
|
|
56
|
-
observed: (p) => ({ action_type: 'vercel.project.delete', project: p.project }),
|
|
57
|
-
perform: (c, p) => c.deleteProject({ project: p.project }),
|
|
58
|
-
},
|
|
59
|
-
'env.set': {
|
|
60
|
-
selector: { protocol: 'vercel', tool: 'upsert_env' },
|
|
61
|
-
observed: (p) => ({
|
|
62
|
-
action_type: 'vercel.env.set',
|
|
63
|
-
project: p.project,
|
|
64
|
-
key: p.key,
|
|
65
|
-
target: p.target,
|
|
66
|
-
secret_value_digest: secretValueDigest(p.value),
|
|
67
|
-
secret_value_version: SECRET_VALUE_BINDING_VERSION,
|
|
68
|
-
}),
|
|
69
|
-
actuator: (p, observed) => ({ ...observed, value: p.value }),
|
|
70
|
-
perform: (c, p) => c.upsertEnv({ project: p.project, key: p.key, value: p.value, target: p.target }),
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const adapter = createAdapter({ system: 'vercel', ops: OPS });
|
|
75
|
-
export const VERCEL_OPS = adapter.OPS;
|
|
76
|
-
export function createVercelManifest(extra = []) { return manifestFromPack(VERCEL_ACTION_PACK, extra); }
|
|
77
|
-
export function guardVercelMutation(gate, client, args) { return adapter.guard(gate, client, args); }
|
|
78
|
-
export default {
|
|
79
|
-
VERCEL_ACTION_PACK,
|
|
80
|
-
VERCEL_OPS,
|
|
81
|
-
SECRET_VALUE_BINDING_VERSION,
|
|
82
|
-
secretValueDigest,
|
|
83
|
-
createVercelManifest,
|
|
84
|
-
guardVercelMutation,
|
|
85
|
-
};
|
|
2
|
+
// Compatibility entry point for the TypeScript vercel adapter module.
|
|
3
|
+
export * from '../dist/adapters/vercel.js';
|
|
4
|
+
export { default } from '../dist/adapters/vercel.js';
|