@decionis/agentsafe 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Cli.js +1 -0
- package/dist/Cli.js.map +1 -1
- package/dist/Index.d.ts +12 -1
- package/dist/Index.d.ts.map +1 -1
- package/dist/Index.js +11 -0
- package/dist/Index.js.map +1 -1
- package/dist/adapters/mcp/McpGuard.d.ts +91 -0
- package/dist/adapters/mcp/McpGuard.d.ts.map +1 -0
- package/dist/adapters/mcp/McpGuard.js +142 -0
- package/dist/adapters/mcp/McpGuard.js.map +1 -0
- package/dist/adapters/mcp/McpIntentBinder.d.ts +54 -0
- package/dist/adapters/mcp/McpIntentBinder.d.ts.map +1 -0
- package/dist/adapters/mcp/McpIntentBinder.js +79 -0
- package/dist/adapters/mcp/McpIntentBinder.js.map +1 -0
- package/dist/adapters/mcp/McpInvocation.d.ts +55 -0
- package/dist/adapters/mcp/McpInvocation.d.ts.map +1 -0
- package/dist/adapters/mcp/McpInvocation.js +88 -0
- package/dist/adapters/mcp/McpInvocation.js.map +1 -0
- package/dist/boundary/BoundaryIdentity.d.ts +88 -0
- package/dist/boundary/BoundaryIdentity.d.ts.map +1 -0
- package/dist/boundary/BoundaryIdentity.js +126 -0
- package/dist/boundary/BoundaryIdentity.js.map +1 -0
- package/dist/cli/Commands.d.ts +1 -1
- package/dist/cli/Commands.d.ts.map +1 -1
- package/dist/cli/Commands.js +5 -0
- package/dist/cli/Commands.js.map +1 -1
- package/dist/cli/Help.d.ts.map +1 -1
- package/dist/cli/Help.js +1 -0
- package/dist/cli/Help.js.map +1 -1
- package/dist/cli/Identity.d.ts +47 -0
- package/dist/cli/Identity.d.ts.map +1 -0
- package/dist/cli/Identity.js +145 -0
- package/dist/cli/Identity.js.map +1 -0
- package/dist/cli/TestCommand.d.ts +8 -0
- package/dist/cli/TestCommand.d.ts.map +1 -1
- package/dist/cli/TestCommand.js +25 -5
- package/dist/cli/TestCommand.js.map +1 -1
- package/dist/gateway/AuthorityAttacks.d.ts +39 -0
- package/dist/gateway/AuthorityAttacks.d.ts.map +1 -0
- package/dist/gateway/AuthorityAttacks.js +158 -0
- package/dist/gateway/AuthorityAttacks.js.map +1 -0
- package/dist/gateway/Gateway.d.ts +7 -0
- package/dist/gateway/Gateway.d.ts.map +1 -1
- package/dist/gateway/Gateway.js +61 -3
- package/dist/gateway/Gateway.js.map +1 -1
- package/dist/gateway/GatewayConfig.d.ts +11 -0
- package/dist/gateway/GatewayConfig.d.ts.map +1 -1
- package/dist/gateway/GatewayConfig.js +18 -0
- package/dist/gateway/GatewayConfig.js.map +1 -1
- package/dist/gateway/GatewayReport.d.ts +31 -1
- package/dist/gateway/GatewayReport.d.ts.map +1 -1
- package/dist/gateway/GatewayReport.js +12 -0
- package/dist/gateway/GatewayReport.js.map +1 -1
- package/dist/provenance/DockerProvenanceProvider.d.ts +23 -0
- package/dist/provenance/DockerProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/DockerProvenanceProvider.js +24 -0
- package/dist/provenance/DockerProvenanceProvider.js.map +1 -0
- package/dist/provenance/KubernetesProvenanceProvider.d.ts +17 -0
- package/dist/provenance/KubernetesProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/KubernetesProvenanceProvider.js +18 -0
- package/dist/provenance/KubernetesProvenanceProvider.js.map +1 -0
- package/dist/provenance/NoneProvenanceProvider.d.ts +15 -0
- package/dist/provenance/NoneProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/NoneProvenanceProvider.js +16 -0
- package/dist/provenance/NoneProvenanceProvider.js.map +1 -0
- package/dist/provenance/ProvenanceProvider.d.ts +94 -0
- package/dist/provenance/ProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/ProvenanceProvider.js +118 -0
- package/dist/provenance/ProvenanceProvider.js.map +1 -0
- package/dist/provenance/StaticProvenanceProvider.d.ts +18 -0
- package/dist/provenance/StaticProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/StaticProvenanceProvider.js +25 -0
- package/dist/provenance/StaticProvenanceProvider.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WorkloadSignal } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import { type ProvenanceFacts, type ProvenanceProvider } from "./ProvenanceProvider.js";
|
|
3
|
+
/**
|
|
4
|
+
* What Docker's own tooling put in this container's environment.
|
|
5
|
+
*
|
|
6
|
+
* Docker establishes what is running: the image, its digest, its provenance,
|
|
7
|
+
* its SBOM, its publisher. None of that is AgentSafe's to determine, and none
|
|
8
|
+
* of it is fabricated here. The image reference and digest arrive because the
|
|
9
|
+
* operator's compose file or `docker run` put them there; no Docker socket is
|
|
10
|
+
* opened, no undocumented API is called, and an image label is never read as
|
|
11
|
+
* cryptographic provenance, because a label is not one.
|
|
12
|
+
*
|
|
13
|
+
* The consequence is stated rather than hidden: what this provider reports is
|
|
14
|
+
* `supplied`. When Docker offers an attested channel — a verified publisher,
|
|
15
|
+
* a Scout status, a provenance attestation this process can check — it
|
|
16
|
+
* belongs behind a provider that can honestly say `verified`, and that
|
|
17
|
+
* provider is a file beside this one.
|
|
18
|
+
*/
|
|
19
|
+
export declare class DockerProvenanceProvider implements ProvenanceProvider {
|
|
20
|
+
readonly id = "docker";
|
|
21
|
+
describe(facts: ProvenanceFacts): WorkloadSignal | null;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=DockerProvenanceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DockerProvenanceProvider.d.ts","sourceRoot":"","sources":["../../src/provenance/DockerProvenanceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,wBAAyB,YAAW,kBAAkB;IACjE,SAAgB,EAAE,YAAY;IAEvB,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,cAAc,GAAG,IAAI;CAG/D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { declaredWorkload, } from "./ProvenanceProvider.js";
|
|
2
|
+
/**
|
|
3
|
+
* What Docker's own tooling put in this container's environment.
|
|
4
|
+
*
|
|
5
|
+
* Docker establishes what is running: the image, its digest, its provenance,
|
|
6
|
+
* its SBOM, its publisher. None of that is AgentSafe's to determine, and none
|
|
7
|
+
* of it is fabricated here. The image reference and digest arrive because the
|
|
8
|
+
* operator's compose file or `docker run` put them there; no Docker socket is
|
|
9
|
+
* opened, no undocumented API is called, and an image label is never read as
|
|
10
|
+
* cryptographic provenance, because a label is not one.
|
|
11
|
+
*
|
|
12
|
+
* The consequence is stated rather than hidden: what this provider reports is
|
|
13
|
+
* `supplied`. When Docker offers an attested channel — a verified publisher,
|
|
14
|
+
* a Scout status, a provenance attestation this process can check — it
|
|
15
|
+
* belongs behind a provider that can honestly say `verified`, and that
|
|
16
|
+
* provider is a file beside this one.
|
|
17
|
+
*/
|
|
18
|
+
export class DockerProvenanceProvider {
|
|
19
|
+
id = "docker";
|
|
20
|
+
describe(facts) {
|
|
21
|
+
return declaredWorkload(facts, "docker", this.id, "supplied");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=DockerProvenanceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DockerProvenanceProvider.js","sourceRoot":"","sources":["../../src/provenance/DockerProvenanceProvider.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,GAGjB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,wBAAwB;IACnB,EAAE,GAAG,QAAQ,CAAC;IAEvB,QAAQ,CAAC,KAAsB;QACpC,OAAO,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { WorkloadSignal } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import { type ProvenanceFacts, type ProvenanceProvider } from "./ProvenanceProvider.js";
|
|
3
|
+
/**
|
|
4
|
+
* What the pod spec declared about the image this container runs.
|
|
5
|
+
*
|
|
6
|
+
* The downward API exposes pod fields, not the image the kubelet resolved, so
|
|
7
|
+
* the digest is one the manifest names and the chart injects. That is a real
|
|
8
|
+
* distinction and it is why this reports `supplied`: the admission controller
|
|
9
|
+
* that pinned the digest is the authority for it, and a cluster that wants
|
|
10
|
+
* more should bind its own attestation and read it through a provider that
|
|
11
|
+
* can check one.
|
|
12
|
+
*/
|
|
13
|
+
export declare class KubernetesProvenanceProvider implements ProvenanceProvider {
|
|
14
|
+
readonly id = "kubernetes";
|
|
15
|
+
describe(facts: ProvenanceFacts): WorkloadSignal | null;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=KubernetesProvenanceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KubernetesProvenanceProvider.d.ts","sourceRoot":"","sources":["../../src/provenance/KubernetesProvenanceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;GASG;AACH,qBAAa,4BAA6B,YAAW,kBAAkB;IACrE,SAAgB,EAAE,gBAAgB;IAE3B,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,cAAc,GAAG,IAAI;CAG/D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { declaredWorkload, } from "./ProvenanceProvider.js";
|
|
2
|
+
/**
|
|
3
|
+
* What the pod spec declared about the image this container runs.
|
|
4
|
+
*
|
|
5
|
+
* The downward API exposes pod fields, not the image the kubelet resolved, so
|
|
6
|
+
* the digest is one the manifest names and the chart injects. That is a real
|
|
7
|
+
* distinction and it is why this reports `supplied`: the admission controller
|
|
8
|
+
* that pinned the digest is the authority for it, and a cluster that wants
|
|
9
|
+
* more should bind its own attestation and read it through a provider that
|
|
10
|
+
* can check one.
|
|
11
|
+
*/
|
|
12
|
+
export class KubernetesProvenanceProvider {
|
|
13
|
+
id = "kubernetes";
|
|
14
|
+
describe(facts) {
|
|
15
|
+
return declaredWorkload(facts, "kubernetes", this.id, "supplied");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=KubernetesProvenanceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KubernetesProvenanceProvider.js","sourceRoot":"","sources":["../../src/provenance/KubernetesProvenanceProvider.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,GAGjB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,OAAO,4BAA4B;IACvB,EAAE,GAAG,YAAY,CAAC;IAE3B,QAAQ,CAAC,KAAsB;QACpC,OAAO,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IACpE,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProvenanceProvider } from "./ProvenanceProvider.js";
|
|
2
|
+
/**
|
|
3
|
+
* No provenance, said out loud.
|
|
4
|
+
*
|
|
5
|
+
* The default everywhere AgentSafe runs outside a described runtime, and the
|
|
6
|
+
* reason nothing degrades into a guess: an intent it contributes to carries
|
|
7
|
+
* no `workload` key at all, so a policy that requires trusted provenance
|
|
8
|
+
* refuses on the signal's absence rather than matching a placeholder that
|
|
9
|
+
* claims there is none.
|
|
10
|
+
*/
|
|
11
|
+
export declare class NoneProvenanceProvider implements ProvenanceProvider {
|
|
12
|
+
readonly id = "none";
|
|
13
|
+
describe(): null;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=NoneProvenanceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoneProvenanceProvider.d.ts","sourceRoot":"","sources":["../../src/provenance/NoneProvenanceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;;;;;;;GAQG;AACH,qBAAa,sBAAuB,YAAW,kBAAkB;IAC/D,SAAgB,EAAE,UAAU;IAErB,QAAQ,IAAI,IAAI;CAGxB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No provenance, said out loud.
|
|
3
|
+
*
|
|
4
|
+
* The default everywhere AgentSafe runs outside a described runtime, and the
|
|
5
|
+
* reason nothing degrades into a guess: an intent it contributes to carries
|
|
6
|
+
* no `workload` key at all, so a policy that requires trusted provenance
|
|
7
|
+
* refuses on the signal's absence rather than matching a placeholder that
|
|
8
|
+
* claims there is none.
|
|
9
|
+
*/
|
|
10
|
+
export class NoneProvenanceProvider {
|
|
11
|
+
id = "none";
|
|
12
|
+
describe() {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=NoneProvenanceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoneProvenanceProvider.js","sourceRoot":"","sources":["../../src/provenance/NoneProvenanceProvider.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,OAAO,sBAAsB;IACjB,EAAE,GAAG,MAAM,CAAC;IAErB,QAAQ;QACb,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { WorkloadSignal, WorkloadTrustLevel } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
/**
|
|
3
|
+
* What software proposed the action, as some runtime reported it.
|
|
4
|
+
*
|
|
5
|
+
* AgentSafe is not the authority for any of this. Docker, OCI tooling and the
|
|
6
|
+
* platform establish what is running; this package carries what they say so
|
|
7
|
+
* that a policy can reason about it and evidence can record it. It does not
|
|
8
|
+
* scan an image, generate an SBOM, verify a publisher or check a signature,
|
|
9
|
+
* and it must never appear to have done so.
|
|
10
|
+
*
|
|
11
|
+
* That is why every workload carries its own `provenance`: who said this, and
|
|
12
|
+
* how far that goes. A field with no trust source beside it is a claim
|
|
13
|
+
* wearing the costume of a fact.
|
|
14
|
+
*
|
|
15
|
+
* The contract is deliberately one method. A family is a file beside this
|
|
16
|
+
* one, the way an effect adapter is a directory beside `banking/`.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* How far the report can be trusted, strictly ordered, weakest first.
|
|
20
|
+
*
|
|
21
|
+
* - `unverified` — nothing trustworthy was available. Recorded, never hidden.
|
|
22
|
+
* - `supplied` — something told us, and nothing checked it. An environment
|
|
23
|
+
* variable an operator's manifest set is this, however true it happens to
|
|
24
|
+
* be: the process cannot distinguish a digest its orchestrator injected
|
|
25
|
+
* from one a compromised entrypoint wrote.
|
|
26
|
+
* - `observed` — the runtime reported it through an interface that is not the
|
|
27
|
+
* workload's to write.
|
|
28
|
+
* - `verified` — a signature or attestation was checked.
|
|
29
|
+
*
|
|
30
|
+
* **AgentSafe emits nothing above `supplied` today, and that is deliberate.**
|
|
31
|
+
* `verified` is reserved for a provider that consumes a signal the platform
|
|
32
|
+
* itself attests. Claiming it without one would be exactly the fabrication
|
|
33
|
+
* this design exists to prevent: a policy reading
|
|
34
|
+
* `workload.provenance.trust_level == "verified"` must be reading a checked
|
|
35
|
+
* signature, not an environment variable with ambitions.
|
|
36
|
+
*/
|
|
37
|
+
export declare const TRUST_ORDER: readonly WorkloadTrustLevel[];
|
|
38
|
+
/** What a provider reads. Never the network, never an undocumented API. */
|
|
39
|
+
export interface ProvenanceFacts {
|
|
40
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
41
|
+
}
|
|
42
|
+
export interface ProvenanceProvider {
|
|
43
|
+
/** Names the trust source this provider speaks for; it appears in `provenance.source`. */
|
|
44
|
+
readonly id: string;
|
|
45
|
+
/**
|
|
46
|
+
* What this provider can say about the running workload, or null when it
|
|
47
|
+
* can say nothing. Bounded, synchronous and side-effect free: a provider
|
|
48
|
+
* that had to reach something to answer would be a provenance authority,
|
|
49
|
+
* which is the thing this abstraction exists not to be.
|
|
50
|
+
*/
|
|
51
|
+
describe(facts: ProvenanceFacts): WorkloadSignal | null;
|
|
52
|
+
}
|
|
53
|
+
/** The strongest level anything in this repository may report. See `TRUST_ORDER`. */
|
|
54
|
+
export declare const MAX_REPORTED_TRUST: WorkloadTrustLevel;
|
|
55
|
+
/**
|
|
56
|
+
* Holds a provider to the ceiling, by refusing rather than clamping.
|
|
57
|
+
*
|
|
58
|
+
* A silent downgrade would hide the bug: a provider reaching for `verified`
|
|
59
|
+
* has decided it checked something, and if it did not, that is a defect to
|
|
60
|
+
* fix and not a value to quietly weaken on its way to a policy.
|
|
61
|
+
*/
|
|
62
|
+
export declare function assertReportable(level: WorkloadTrustLevel): WorkloadTrustLevel;
|
|
63
|
+
/**
|
|
64
|
+
* The variables an operator's own manifest declares about the artifact this
|
|
65
|
+
* process is. There is no interface that hands a container its own image
|
|
66
|
+
* digest — not the Docker API without a socket the gateway must not have, and
|
|
67
|
+
* not the Kubernetes downward API, which exposes pod fields and not the
|
|
68
|
+
* resolved image. So the orchestrator puts it here, and because the workload
|
|
69
|
+
* could in principle write the same variable, what is read here is `supplied`
|
|
70
|
+
* and never more.
|
|
71
|
+
*/
|
|
72
|
+
export declare const WORKLOAD_ENVIRONMENT: {
|
|
73
|
+
readonly image: "AGENTSAFE_WORKLOAD_IMAGE";
|
|
74
|
+
readonly digest: "AGENTSAFE_WORKLOAD_DIGEST";
|
|
75
|
+
readonly publisher: "AGENTSAFE_WORKLOAD_PUBLISHER";
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* An OCI artifact as the declared variables describe it, or null when they
|
|
79
|
+
* describe nothing. A malformed value is dropped rather than carried: a
|
|
80
|
+
* digest that is not a digest would be a field a policy could match on by
|
|
81
|
+
* accident.
|
|
82
|
+
*/
|
|
83
|
+
export declare function declaredWorkload(facts: ProvenanceFacts, runtime: string, source: string, trustLevel: WorkloadTrustLevel): WorkloadSignal | null;
|
|
84
|
+
/**
|
|
85
|
+
* The first provider with something to say, in the order given.
|
|
86
|
+
*
|
|
87
|
+
* Nothing is merged. A workload assembled from two sources would carry one
|
|
88
|
+
* `provenance` describing neither, and the trust level would belong to the
|
|
89
|
+
* wrong fields. Silence is the honest answer when no provider has one: the
|
|
90
|
+
* key is then absent from the intent, so a policy that requires provenance
|
|
91
|
+
* refuses on its absence rather than matching a placeholder.
|
|
92
|
+
*/
|
|
93
|
+
export declare function resolveWorkload(providers: readonly ProvenanceProvider[], facts: ProvenanceFacts): WorkloadSignal | null;
|
|
94
|
+
//# sourceMappingURL=ProvenanceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProvenanceProvider.d.ts","sourceRoot":"","sources":["../../src/provenance/ProvenanceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExF;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,kBAAkB,EAKpD,CAAC;AAEF,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,kBAAkB;IACjC,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,cAAc,GAAG,IAAI,CAAC;CACzD;AAED,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,EAAE,kBAA+B,CAAC;AAEjE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,kBAAkB,CAK9E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC;AAYX;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,GAC7B,cAAc,GAAG,IAAI,CAavB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,SAAS,kBAAkB,EAAE,EACxC,KAAK,EAAE,eAAe,GACrB,cAAc,GAAG,IAAI,CAMvB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What software proposed the action, as some runtime reported it.
|
|
3
|
+
*
|
|
4
|
+
* AgentSafe is not the authority for any of this. Docker, OCI tooling and the
|
|
5
|
+
* platform establish what is running; this package carries what they say so
|
|
6
|
+
* that a policy can reason about it and evidence can record it. It does not
|
|
7
|
+
* scan an image, generate an SBOM, verify a publisher or check a signature,
|
|
8
|
+
* and it must never appear to have done so.
|
|
9
|
+
*
|
|
10
|
+
* That is why every workload carries its own `provenance`: who said this, and
|
|
11
|
+
* how far that goes. A field with no trust source beside it is a claim
|
|
12
|
+
* wearing the costume of a fact.
|
|
13
|
+
*
|
|
14
|
+
* The contract is deliberately one method. A family is a file beside this
|
|
15
|
+
* one, the way an effect adapter is a directory beside `banking/`.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* How far the report can be trusted, strictly ordered, weakest first.
|
|
19
|
+
*
|
|
20
|
+
* - `unverified` — nothing trustworthy was available. Recorded, never hidden.
|
|
21
|
+
* - `supplied` — something told us, and nothing checked it. An environment
|
|
22
|
+
* variable an operator's manifest set is this, however true it happens to
|
|
23
|
+
* be: the process cannot distinguish a digest its orchestrator injected
|
|
24
|
+
* from one a compromised entrypoint wrote.
|
|
25
|
+
* - `observed` — the runtime reported it through an interface that is not the
|
|
26
|
+
* workload's to write.
|
|
27
|
+
* - `verified` — a signature or attestation was checked.
|
|
28
|
+
*
|
|
29
|
+
* **AgentSafe emits nothing above `supplied` today, and that is deliberate.**
|
|
30
|
+
* `verified` is reserved for a provider that consumes a signal the platform
|
|
31
|
+
* itself attests. Claiming it without one would be exactly the fabrication
|
|
32
|
+
* this design exists to prevent: a policy reading
|
|
33
|
+
* `workload.provenance.trust_level == "verified"` must be reading a checked
|
|
34
|
+
* signature, not an environment variable with ambitions.
|
|
35
|
+
*/
|
|
36
|
+
export const TRUST_ORDER = [
|
|
37
|
+
"unverified",
|
|
38
|
+
"supplied",
|
|
39
|
+
"observed",
|
|
40
|
+
"verified",
|
|
41
|
+
];
|
|
42
|
+
/** The strongest level anything in this repository may report. See `TRUST_ORDER`. */
|
|
43
|
+
export const MAX_REPORTED_TRUST = "supplied";
|
|
44
|
+
/**
|
|
45
|
+
* Holds a provider to the ceiling, by refusing rather than clamping.
|
|
46
|
+
*
|
|
47
|
+
* A silent downgrade would hide the bug: a provider reaching for `verified`
|
|
48
|
+
* has decided it checked something, and if it did not, that is a defect to
|
|
49
|
+
* fix and not a value to quietly weaken on its way to a policy.
|
|
50
|
+
*/
|
|
51
|
+
export function assertReportable(level) {
|
|
52
|
+
if (TRUST_ORDER.indexOf(level) > TRUST_ORDER.indexOf(MAX_REPORTED_TRUST)) {
|
|
53
|
+
throw new Error("WORKLOAD_TRUST_NOT_REPORTABLE");
|
|
54
|
+
}
|
|
55
|
+
return level;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The variables an operator's own manifest declares about the artifact this
|
|
59
|
+
* process is. There is no interface that hands a container its own image
|
|
60
|
+
* digest — not the Docker API without a socket the gateway must not have, and
|
|
61
|
+
* not the Kubernetes downward API, which exposes pod fields and not the
|
|
62
|
+
* resolved image. So the orchestrator puts it here, and because the workload
|
|
63
|
+
* could in principle write the same variable, what is read here is `supplied`
|
|
64
|
+
* and never more.
|
|
65
|
+
*/
|
|
66
|
+
export const WORKLOAD_ENVIRONMENT = {
|
|
67
|
+
image: "AGENTSAFE_WORKLOAD_IMAGE",
|
|
68
|
+
digest: "AGENTSAFE_WORKLOAD_DIGEST",
|
|
69
|
+
publisher: "AGENTSAFE_WORKLOAD_PUBLISHER",
|
|
70
|
+
};
|
|
71
|
+
const IMAGE = /^[\w.:/@-]{1,500}$/;
|
|
72
|
+
const DIGEST = /^sha256:[0-9a-f]{64}$/;
|
|
73
|
+
const PUBLISHER = /^[\w .:/@-]{1,200}$/;
|
|
74
|
+
function match(value, pattern) {
|
|
75
|
+
if (value === undefined)
|
|
76
|
+
return undefined;
|
|
77
|
+
const trimmed = value.trim();
|
|
78
|
+
return pattern.test(trimmed) ? trimmed : undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* An OCI artifact as the declared variables describe it, or null when they
|
|
82
|
+
* describe nothing. A malformed value is dropped rather than carried: a
|
|
83
|
+
* digest that is not a digest would be a field a policy could match on by
|
|
84
|
+
* accident.
|
|
85
|
+
*/
|
|
86
|
+
export function declaredWorkload(facts, runtime, source, trustLevel) {
|
|
87
|
+
const image = match(facts.env[WORKLOAD_ENVIRONMENT.image], IMAGE);
|
|
88
|
+
const digest = match(facts.env[WORKLOAD_ENVIRONMENT.digest], DIGEST);
|
|
89
|
+
const publisher = match(facts.env[WORKLOAD_ENVIRONMENT.publisher], PUBLISHER);
|
|
90
|
+
if (image === undefined && digest === undefined && publisher === undefined)
|
|
91
|
+
return null;
|
|
92
|
+
return {
|
|
93
|
+
runtime,
|
|
94
|
+
artifact_type: "oci",
|
|
95
|
+
...(image === undefined ? {} : { image }),
|
|
96
|
+
...(digest === undefined ? {} : { digest }),
|
|
97
|
+
...(publisher === undefined ? {} : { publisher }),
|
|
98
|
+
provenance: { source, trust_level: assertReportable(trustLevel) },
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The first provider with something to say, in the order given.
|
|
103
|
+
*
|
|
104
|
+
* Nothing is merged. A workload assembled from two sources would carry one
|
|
105
|
+
* `provenance` describing neither, and the trust level would belong to the
|
|
106
|
+
* wrong fields. Silence is the honest answer when no provider has one: the
|
|
107
|
+
* key is then absent from the intent, so a policy that requires provenance
|
|
108
|
+
* refuses on its absence rather than matching a placeholder.
|
|
109
|
+
*/
|
|
110
|
+
export function resolveWorkload(providers, facts) {
|
|
111
|
+
for (const provider of providers) {
|
|
112
|
+
const described = provider.describe(facts);
|
|
113
|
+
if (described !== null)
|
|
114
|
+
return described;
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=ProvenanceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProvenanceProvider.js","sourceRoot":"","sources":["../../src/provenance/ProvenanceProvider.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAkC;IACxD,YAAY;IACZ,UAAU;IACV,UAAU;IACV,UAAU;CACX,CAAC;AAmBF,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAuB,UAAU,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAyB;IACxD,IAAI,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,0BAA0B;IACjC,MAAM,EAAE,2BAA2B;IACnC,SAAS,EAAE,8BAA8B;CACjC,CAAC;AAEX,MAAM,KAAK,GAAG,oBAAoB,CAAC;AACnC,MAAM,MAAM,GAAG,uBAAuB,CAAC;AACvC,MAAM,SAAS,GAAG,qBAAqB,CAAC;AAExC,SAAS,KAAK,CAAC,KAAyB,EAAE,OAAe;IACvD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAsB,EACtB,OAAe,EACf,MAAc,EACd,UAA8B;IAE9B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;IAC9E,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACxF,OAAO;QACL,OAAO;QACP,aAAa,EAAE,KAAK;QACpB,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;QACzC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3C,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;QACjD,UAAU,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,CAAC,UAAU,CAAC,EAAE;KAClE,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAwC,EACxC,KAAsB;IAEtB,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,SAAS,KAAK,IAAI;YAAE,OAAO,SAAS,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WorkloadSignal } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import { type ProvenanceProvider } from "./ProvenanceProvider.js";
|
|
3
|
+
/**
|
|
4
|
+
* A workload an operator states in code, for a deployment no runtime
|
|
5
|
+
* describes: a systemd unit, a process on a host, a test.
|
|
6
|
+
*
|
|
7
|
+
* It is held to the same ceiling as everything else. An operator writing a
|
|
8
|
+
* digest into a configuration has supplied it, not verified it, and a
|
|
9
|
+
* provider that let a caller declare its own trust level would be the
|
|
10
|
+
* silent upgrade this design exists to prevent.
|
|
11
|
+
*/
|
|
12
|
+
export declare class StaticProvenanceProvider implements ProvenanceProvider {
|
|
13
|
+
readonly id = "operator";
|
|
14
|
+
private readonly workload;
|
|
15
|
+
constructor(workload: Omit<WorkloadSignal, "provenance">);
|
|
16
|
+
describe(): WorkloadSignal;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=StaticProvenanceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticProvenanceProvider.d.ts","sourceRoot":"","sources":["../../src/provenance/StaticProvenanceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,qBAAa,wBAAyB,YAAW,kBAAkB;IACjE,SAAgB,EAAE,cAAc;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;gBAEvB,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC;IAOxD,QAAQ,IAAI,cAAc;CAGlC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { WorkloadSignalSchema } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import { MAX_REPORTED_TRUST, assertReportable, } from "./ProvenanceProvider.js";
|
|
3
|
+
/**
|
|
4
|
+
* A workload an operator states in code, for a deployment no runtime
|
|
5
|
+
* describes: a systemd unit, a process on a host, a test.
|
|
6
|
+
*
|
|
7
|
+
* It is held to the same ceiling as everything else. An operator writing a
|
|
8
|
+
* digest into a configuration has supplied it, not verified it, and a
|
|
9
|
+
* provider that let a caller declare its own trust level would be the
|
|
10
|
+
* silent upgrade this design exists to prevent.
|
|
11
|
+
*/
|
|
12
|
+
export class StaticProvenanceProvider {
|
|
13
|
+
id = "operator";
|
|
14
|
+
workload;
|
|
15
|
+
constructor(workload) {
|
|
16
|
+
this.workload = WorkloadSignalSchema.parse({
|
|
17
|
+
...workload,
|
|
18
|
+
provenance: { source: this.id, trust_level: assertReportable(MAX_REPORTED_TRUST) },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
describe() {
|
|
22
|
+
return this.workload;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=StaticProvenanceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticProvenanceProvider.js","sourceRoot":"","sources":["../../src/provenance/StaticProvenanceProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,OAAO,wBAAwB;IACnB,EAAE,GAAG,UAAU,CAAC;IACf,QAAQ,CAAiB;IAE1C,YAAmB,QAA4C;QAC7D,IAAI,CAAC,QAAQ,GAAG,oBAAoB,CAAC,KAAK,CAAC;YACzC,GAAG,QAAQ;YACX,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,EAAE;SACnF,CAAC,CAAC;IACL,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decionis/agentsafe",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "The trusted executor of the Execution Authority architecture as one deployable process: a proposal in over HTTP, a verdict from the authority, one execution on a claimed single-use grant, and the evidence of each.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"execution-authority",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"jose": "^6.2.10",
|
|
59
59
|
"yaml": "^2.9.0",
|
|
60
60
|
"zod": "^4.5.4",
|
|
61
|
-
"@decionis/agent-safe-pipeline": "^0.3.
|
|
61
|
+
"@decionis/agent-safe-pipeline": "^0.3.5"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@stryker-mutator/core": "10.0.0",
|