@xemahq/biome-supply-chain 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,175 @@
1
+ Xema Business Source License 1.1
2
+
3
+ License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ -----------------------------------------------------------------------------
7
+
8
+ Parameters
9
+
10
+ Licensor: Neuralchowder Inc.
11
+
12
+ Licensed Work: Xema. The Licensed Work is (c) 2026 Neuralchowder Inc..
13
+
14
+ The Licensed Work includes, without limitation, Xema Core, Xema Runtime,
15
+ Xema Kernel, Xema control plane, Xema application runtime, Xema biome
16
+ runtime, Xema biome registry, Xema store services, Xema orchestration
17
+ services, Xema agents, Xema skills, Xema memory services, Xema APIs, Xema
18
+ user interfaces, Xema command-line tools, Xema deployment artifacts, Xema
19
+ templates, Xema specifications, Xema schemas, Xema manifests, Xema
20
+ documentation, Xema examples, and all source code, object code, binaries,
21
+ packages, modules, configuration files, manifests, schemas, examples,
22
+ templates, documentation, and derivative works included in or distributed
23
+ as part of the Xema software project.
24
+
25
+ The Licensed Work does not include any third-party software, libraries,
26
+ dependencies, packages, assets, or components that are distributed with the
27
+ Licensed Work but are governed by their own separate license terms. Such
28
+ third-party materials remain subject to their respective licenses.
29
+
30
+ A specific file, package, component, or directory may state that it is
31
+ governed by a different license. In that case, that specific file, package,
32
+ component, or directory is governed by the license expressly stated therein.
33
+
34
+ Additional Use Grant:
35
+
36
+ You may make production use of the Licensed Work, provided that your use
37
+ does not include offering, providing, making available, distributing,
38
+ hosting, managing, embedding, reselling, white-labeling, sublicensing,
39
+ commercializing, or otherwise making the Licensed Work, or any modified
40
+ version or derivative work of the Licensed Work, available to Third Parties
41
+ as part of a Competitive Offering.
42
+
43
+ The following definitions and clarifications form part of, and govern
44
+ the interpretation of, the Additional Use Grant set out above.
45
+
46
+ 1. "Production Use" means any use of the Licensed Work other than for
47
+ development, testing, evaluation, demonstration, experimentation,
48
+ benchmarking, or other non-production purposes.
49
+
50
+ 2. "Affiliate" means any entity that, directly or indirectly,
51
+ controls, is controlled by, or is under common control with you,
52
+ where "control" means ownership of more than fifty percent (50%) of
53
+ the voting interests of the entity, or the power to direct its
54
+ management.
55
+
56
+ 3. "Third Party" means any natural person or legal entity other than
57
+ you and your Affiliates.
58
+
59
+ 4. "Competitive Offering" means any product or service, made available
60
+ to one or more Third Parties for a fee or other consideration
61
+ (including without limitation on a paid, subscription,
62
+ advertising-supported, hosted, or managed-service basis), that is
63
+ offered or marketed as, or that competes with, a software platform,
64
+ runtime, orchestration system, agent or automation system,
65
+ extension or distribution marketplace, or other software system
66
+ that provides, in substantial part, the same or substantially
67
+ similar capabilities as those provided by the Licensed Work. A
68
+ product or service is a Competitive Offering whether the Licensed
69
+ Work is provided in whole or in part, alone or bundled with other
70
+ software, and whether modified or unmodified.
71
+
72
+ 5. Providing, hosting, or managing the Licensed Work for a Third Party,
73
+ or otherwise making the Licensed Work available to a Third Party as
74
+ a hosted or managed service such that the Third Party obtains the
75
+ principal value or functionality of the Licensed Work, is a
76
+ Competitive Offering and is not permitted by the Additional Use
77
+ Grant.
78
+
79
+ 6. Subject to the foregoing, the Additional Use Grant permits you to
80
+ make Production Use of the Licensed Work for your own internal
81
+ business purposes and to build, operate, and provide your own
82
+ products and services to Third Parties, provided that the Licensed
83
+ Work itself (whether modified or unmodified) is not the product or
84
+ service, and is not a Competitive Offering, made available to those
85
+ Third Parties.
86
+
87
+ 7. You may modify the Licensed Work and create derivative works for
88
+ any purpose permitted by this License. Any Production Use of such
89
+ modified or derivative works remains subject to the same
90
+ restrictions as the Licensed Work, including the prohibition on
91
+ Competitive Offerings.
92
+
93
+ 8. Use of the Licensed Work by your own employees, contractors, and
94
+ agents, acting on your behalf and for your benefit, is not by
95
+ itself making the Licensed Work available to a Third Party.
96
+
97
+ 9. Embedding or distributing the Licensed Work as a component of your
98
+ own product or service is permitted only where the Licensed Work
99
+ does not constitute the principal value of that product or service
100
+ and the product or service is not a Competitive Offering.
101
+
102
+ 10. Nothing in this Additional Use Grant grants any right to use any
103
+ name, trademark, service mark, or logo of the Licensor or its
104
+ Affiliates, except as reasonably required for customary
105
+ attribution.
106
+
107
+ 11. The rights stated in this Additional Use Grant are the maximum
108
+ rights granted for Production Use prior to the Change Date. Any
109
+ Production Use not expressly permitted requires a separate
110
+ commercial license from the Licensor.
111
+
112
+ 12. If any provision of this Additional Use Grant is held invalid or
113
+ unenforceable, that provision shall be limited or eliminated to
114
+ the minimum extent necessary so that the remainder of this
115
+ Additional Use Grant, and of this License, remains in full force
116
+ and effect. The Licensor reserves all rights not expressly granted
117
+ by this License.
118
+
119
+
120
+ Change Date: Four years from the date the specific version of the Licensed
121
+ Work is first publicly released by Licensor.
122
+
123
+ Change License: Mozilla Public License, Version 2.0
124
+
125
+ For information about alternative licensing arrangements, commercial
126
+ licensing, enterprise licensing, OEM licensing, appliance licensing, managed
127
+ service licensing, cloud provider licensing, or other commercial use of the
128
+ Licensed Work, please contact: licensing@neuralchowder.com
129
+
130
+ -----------------------------------------------------------------------------
131
+
132
+ Notice
133
+
134
+ Business Source License 1.1
135
+
136
+ Terms
137
+
138
+ The Licensor hereby grants you the right to copy, modify, create derivative
139
+ works, redistribute, and make non-production use of the Licensed Work. The
140
+ Licensor may make an Additional Use Grant, above, permitting limited
141
+ production use.
142
+
143
+ Effective on the Change Date, or the fourth anniversary of the first publicly
144
+ available distribution of a specific version of the Licensed Work under this
145
+ License, whichever comes first, the Licensor hereby grants you rights under
146
+ the terms of the Change License, and the rights granted in the paragraph above
147
+ terminate.
148
+
149
+ If your use of the Licensed Work does not comply with the requirements
150
+ currently in effect as described in this License, you must purchase a
151
+ commercial license from the Licensor, its affiliated entities, or authorized
152
+ resellers, or you must refrain from using the Licensed Work.
153
+
154
+ All copies of the original and modified Licensed Work, and derivative works of
155
+ the Licensed Work, are subject to this License. This License applies separately
156
+ for each version of the Licensed Work and the Change Date may vary for each
157
+ version of the Licensed Work released by Licensor.
158
+
159
+ You must conspicuously display this License on each original or modified copy
160
+ of the Licensed Work. If you receive the Licensed Work in original or modified
161
+ form from a third party, the terms and conditions set forth in this License
162
+ apply to your use of that work.
163
+
164
+ Any use of the Licensed Work in violation of this License will automatically
165
+ terminate your rights under this License for the current and all other
166
+ versions of the Licensed Work.
167
+
168
+ This License does not grant you any right in any trademark or logo of Licensor
169
+ or its affiliates, provided that you may use a trademark or logo of Licensor
170
+ as expressly required by this License.
171
+
172
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN
173
+ "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS
174
+ OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS
175
+ FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @xemahq/biome-supply-chain
2
+
3
+ This package belongs to Layer 1 — a framework-free runtime SDK utility.
4
+
5
+ Shared cosign supply-chain verification for Xema biomes. It centralizes the two
6
+ things that were previously copy-pasted between `biome-fetcher-api` (OCI bundle
7
+ verification) and `@xemahq/biome-package` (the packaging CLI):
8
+
9
+ - the single cosign CLI invocation (`ensureCosignAvailable`,
10
+ `verifyCosignSignature`, `verifyCosignAttestation`, `verifyCosignBlob`), and
11
+ - the signature / provenance verdict vocabulary (`SignatureVerdict`,
12
+ `ProvenanceVerdict`, `CosignErrorCode`, `CosignVerifyOutcome`).
13
+
14
+ It shells out to the `cosign` binary and uses only Node built-ins — no NestJS,
15
+ no framework, no external runtime dependencies — so it is safe to import from a
16
+ service runtime image and from a build-time CLI alike.
17
+
18
+ ## Usage
19
+
20
+ ```ts
21
+ import {
22
+ ensureCosignAvailable,
23
+ verifyCosignSignature,
24
+ verifyCosignBlob,
25
+ SignatureVerdict,
26
+ CosignVerifyOutcome,
27
+ } from '@xemahq/biome-supply-chain';
28
+
29
+ await ensureCosignAvailable();
30
+
31
+ // OCI ref (keyless identity allowlist)
32
+ await verifyCosignSignature({
33
+ ociRef: 'oci://registry/biome:1.2.0',
34
+ trustedIdentities: ['https://github.com/xema-dev/...'],
35
+ oidcIssuer: 'https://token.actions.githubusercontent.com',
36
+ });
37
+
38
+ // Detached blob (caller owns artifact/bundle files on disk)
39
+ const { outcome, matchedIdentity } = await verifyCosignBlob({
40
+ artifactPath: '/tmp/remoteEntry.js',
41
+ bundlePath: '/tmp/remoteEntry.js.bundle',
42
+ trustedIdentityRegexps: ['^https://github.com/xema-dev/.*$'],
43
+ });
44
+ if (outcome === CosignVerifyOutcome.Verified) {
45
+ // matchedIdentity is the regexp that verified
46
+ }
47
+ ```
48
+
49
+ Artifact resolution (resolving an OCI ref, or fetching + writing a blob to a
50
+ temp file) stays with each consumer; this package owns only the cosign exec and
51
+ the verdict enums.
@@ -0,0 +1,3 @@
1
+ export * from './lib/verdicts';
2
+ export * from './lib/cosign-exec';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib/verdicts"), exports);
18
+ __exportStar(require("./lib/cosign-exec"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,oDAAkC"}
@@ -0,0 +1,32 @@
1
+ import { CosignVerifyOutcome } from './verdicts';
2
+ export declare function ensureCosignAvailable(bin?: string): Promise<void>;
3
+ export interface VerifyCosignSignatureInput {
4
+ readonly ociRef: string;
5
+ readonly trustedIdentities: readonly string[];
6
+ readonly oidcIssuer?: string;
7
+ readonly keyPath?: string;
8
+ readonly bin?: string;
9
+ }
10
+ export declare function verifyCosignSignature(input: VerifyCosignSignatureInput): Promise<void>;
11
+ export interface VerifyCosignAttestationInput {
12
+ readonly ociRef: string;
13
+ readonly predicateType: string;
14
+ readonly trustedIdentities: readonly string[];
15
+ readonly oidcIssuer?: string;
16
+ readonly keyPath?: string;
17
+ readonly bin?: string;
18
+ }
19
+ export declare function verifyCosignAttestation(input: VerifyCosignAttestationInput): Promise<void>;
20
+ export interface VerifyCosignBlobInput {
21
+ readonly artifactPath: string;
22
+ readonly bundlePath: string;
23
+ readonly trustedIdentityRegexps: readonly string[];
24
+ readonly oidcIssuer?: string;
25
+ readonly bin?: string;
26
+ }
27
+ export interface VerifyCosignBlobResult {
28
+ readonly outcome: CosignVerifyOutcome;
29
+ readonly matchedIdentity?: string;
30
+ }
31
+ export declare function verifyCosignBlob(input: VerifyCosignBlobInput): Promise<VerifyCosignBlobResult>;
32
+ //# sourceMappingURL=cosign-exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cosign-exec.d.ts","sourceRoot":"","sources":["../../src/lib/cosign-exec.ts"],"names":[],"mappings":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IACrC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IAEtC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AASD,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CAuBjC"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ensureCosignAvailable = ensureCosignAvailable;
4
+ exports.verifyCosignSignature = verifyCosignSignature;
5
+ exports.verifyCosignAttestation = verifyCosignAttestation;
6
+ exports.verifyCosignBlob = verifyCosignBlob;
7
+ const node_child_process_1 = require("node:child_process");
8
+ const verdicts_1 = require("./verdicts");
9
+ const DEFAULT_COSIGN_BIN = 'cosign';
10
+ function runCosign(bin, args) {
11
+ return new Promise((resolve, reject) => {
12
+ const child = (0, node_child_process_1.spawn)(bin, [...args], {
13
+ stdio: ['ignore', 'pipe', 'pipe'],
14
+ });
15
+ let stderr = '';
16
+ child.stderr?.on('data', (chunk) => {
17
+ stderr += chunk.toString();
18
+ });
19
+ child.on('error', reject);
20
+ child.on('close', (code) => {
21
+ resolve({ code: code ?? 1, stderr });
22
+ });
23
+ });
24
+ }
25
+ async function ensureCosignAvailable(bin = DEFAULT_COSIGN_BIN) {
26
+ try {
27
+ const { code, stderr } = await runCosign(bin, ['version']);
28
+ if (code !== 0) {
29
+ throw new Error(`\`${bin} version\` exited ${code}: ${stderr.slice(-200)}`);
30
+ }
31
+ }
32
+ catch (cause) {
33
+ throw new Error(`cosign CLI is not on PATH — install from https://github.com/sigstore/cosign ` +
34
+ `(${cause instanceof Error ? cause.message : String(cause)})`);
35
+ }
36
+ }
37
+ async function verifyCosignSignature(input) {
38
+ const bin = input.bin ?? DEFAULT_COSIGN_BIN;
39
+ const args = ['verify'];
40
+ if (input.keyPath) {
41
+ args.push('--key', input.keyPath);
42
+ }
43
+ else {
44
+ if (input.trustedIdentities.length === 0) {
45
+ throw new Error('verifyCosignSignature: keyless mode requires at least one trusted identity');
46
+ }
47
+ for (const id of input.trustedIdentities) {
48
+ args.push('--certificate-identity', id);
49
+ }
50
+ if (input.oidcIssuer) {
51
+ args.push('--certificate-oidc-issuer', input.oidcIssuer);
52
+ }
53
+ }
54
+ args.push(input.ociRef);
55
+ const { code, stderr } = await runCosign(bin, args);
56
+ if (code !== 0) {
57
+ throw new Error(`${bin} verify failed (code=${code}): ${stderr.slice(-200)}`);
58
+ }
59
+ }
60
+ async function verifyCosignAttestation(input) {
61
+ const bin = input.bin ?? DEFAULT_COSIGN_BIN;
62
+ const args = ['verify-attestation', '--type', input.predicateType];
63
+ if (input.keyPath) {
64
+ args.push('--key', input.keyPath);
65
+ }
66
+ else {
67
+ if (input.trustedIdentities.length === 0) {
68
+ throw new Error('verifyCosignAttestation: keyless mode requires at least one trusted identity');
69
+ }
70
+ for (const id of input.trustedIdentities) {
71
+ args.push('--certificate-identity', id);
72
+ }
73
+ if (input.oidcIssuer) {
74
+ args.push('--certificate-oidc-issuer', input.oidcIssuer);
75
+ }
76
+ }
77
+ args.push(input.ociRef);
78
+ const { code, stderr } = await runCosign(bin, args);
79
+ if (code !== 0) {
80
+ throw new Error(`${bin} verify-attestation failed (code=${code}): ${stderr.slice(-200)}`);
81
+ }
82
+ }
83
+ async function verifyCosignBlob(input) {
84
+ const bin = input.bin ?? DEFAULT_COSIGN_BIN;
85
+ if (input.trustedIdentityRegexps.length === 0) {
86
+ return { outcome: verdicts_1.CosignVerifyOutcome.Failed };
87
+ }
88
+ for (const identity of input.trustedIdentityRegexps) {
89
+ const args = [
90
+ 'verify-blob',
91
+ '--bundle',
92
+ input.bundlePath,
93
+ '--certificate-identity-regexp',
94
+ identity,
95
+ ];
96
+ if (input.oidcIssuer) {
97
+ args.push('--certificate-oidc-issuer', input.oidcIssuer);
98
+ }
99
+ args.push(input.artifactPath);
100
+ const { code } = await runCosign(bin, args);
101
+ if (code === 0) {
102
+ return { outcome: verdicts_1.CosignVerifyOutcome.Verified, matchedIdentity: identity };
103
+ }
104
+ }
105
+ return { outcome: verdicts_1.CosignVerifyOutcome.Failed };
106
+ }
107
+ //# sourceMappingURL=cosign-exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cosign-exec.js","sourceRoot":"","sources":["../../src/lib/cosign-exec.ts"],"names":[],"mappings":";;AAsCA,sDAcC;AAiBD,sDAyBC;AAeD,0DA2BC;AA0BD,4CAyBC;AA3LD,2DAA2C;AAE3C,yCAAiD;AAGjD,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAapC,SAAS,SAAS,CAChB,GAAW,EACX,IAAuB;IAEvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,IAAA,0BAAK,EAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;YAClC,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;SAClC,CAAC,CAAC;QACH,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAGM,KAAK,UAAU,qBAAqB,CACzC,MAAc,kBAAkB;IAEhC,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,SAA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,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CACzE,CAAC;IACJ,CAAC;AACH,CAAC;AA0BM,KAAK,UAAU,gBAAgB,CACpC,KAA4B;IAE5B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,kBAAkB,CAAC;IAC5C,IAAI,KAAK,CAAC,sBAAsB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,8BAAmB,CAAC,MAAM,EAAE,CAAC;IACjD,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,sBAAsB,EAAE,CAAC;QACpD,MAAM,IAAI,GAAa;YACrB,aAAa;YACb,UAAU;YACV,KAAK,CAAC,UAAU;YAChB,+BAA+B;YAC/B,QAAQ;SACT,CAAC;QACF,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAC3D,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,8BAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC;QAC9E,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,8BAAmB,CAAC,MAAM,EAAE,CAAC;AACjD,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare enum SignatureVerdict {
2
+ Valid = "valid",
3
+ Invalid = "invalid",
4
+ Unsigned = "unsigned"
5
+ }
6
+ export declare enum ProvenanceVerdict {
7
+ Valid = "valid",
8
+ Invalid = "invalid",
9
+ Missing = "missing"
10
+ }
11
+ export declare enum CosignErrorCode {
12
+ SignatureMissing = "BIOME_SIGNATURE_MISSING",
13
+ SignatureInvalid = "BIOME_SIGNATURE_INVALID",
14
+ IdentityNotTrusted = "BIOME_SIGNATURE_IDENTITY_NOT_TRUSTED",
15
+ ProvenanceMissing = "BIOME_PROVENANCE_MISSING",
16
+ ProvenanceInvalid = "BIOME_PROVENANCE_INVALID",
17
+ CosignUnavailable = "BIOME_COSIGN_UNAVAILABLE"
18
+ }
19
+ export declare enum CosignVerifyOutcome {
20
+ Verified = "verified",
21
+ Failed = "failed"
22
+ }
23
+ export declare const SLSA_PROVENANCE_PREDICATE_TYPE: "https://slsa.dev/provenance/v1";
24
+ //# sourceMappingURL=verdicts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verdicts.d.ts","sourceRoot":"","sources":["../../src/lib/verdicts.ts"],"names":[],"mappings":"AAgBA,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAGD,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAGD,oBAAY,eAAe;IACzB,gBAAgB,4BAA4B;IAC5C,gBAAgB,4BAA4B;IAC5C,kBAAkB,yCAAyC;IAC3D,iBAAiB,6BAA6B;IAC9C,iBAAiB,6BAA6B;IAC9C,iBAAiB,6BAA6B;CAC/C;AAOD,oBAAY,mBAAmB;IAC7B,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAGD,eAAO,MAAM,8BAA8B,EACzC,gCAAyC,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SLSA_PROVENANCE_PREDICATE_TYPE = exports.CosignVerifyOutcome = exports.CosignErrorCode = exports.ProvenanceVerdict = exports.SignatureVerdict = void 0;
4
+ var SignatureVerdict;
5
+ (function (SignatureVerdict) {
6
+ SignatureVerdict["Valid"] = "valid";
7
+ SignatureVerdict["Invalid"] = "invalid";
8
+ SignatureVerdict["Unsigned"] = "unsigned";
9
+ })(SignatureVerdict || (exports.SignatureVerdict = SignatureVerdict = {}));
10
+ var ProvenanceVerdict;
11
+ (function (ProvenanceVerdict) {
12
+ ProvenanceVerdict["Valid"] = "valid";
13
+ ProvenanceVerdict["Invalid"] = "invalid";
14
+ ProvenanceVerdict["Missing"] = "missing";
15
+ })(ProvenanceVerdict || (exports.ProvenanceVerdict = ProvenanceVerdict = {}));
16
+ var CosignErrorCode;
17
+ (function (CosignErrorCode) {
18
+ CosignErrorCode["SignatureMissing"] = "BIOME_SIGNATURE_MISSING";
19
+ CosignErrorCode["SignatureInvalid"] = "BIOME_SIGNATURE_INVALID";
20
+ CosignErrorCode["IdentityNotTrusted"] = "BIOME_SIGNATURE_IDENTITY_NOT_TRUSTED";
21
+ CosignErrorCode["ProvenanceMissing"] = "BIOME_PROVENANCE_MISSING";
22
+ CosignErrorCode["ProvenanceInvalid"] = "BIOME_PROVENANCE_INVALID";
23
+ CosignErrorCode["CosignUnavailable"] = "BIOME_COSIGN_UNAVAILABLE";
24
+ })(CosignErrorCode || (exports.CosignErrorCode = CosignErrorCode = {}));
25
+ var CosignVerifyOutcome;
26
+ (function (CosignVerifyOutcome) {
27
+ CosignVerifyOutcome["Verified"] = "verified";
28
+ CosignVerifyOutcome["Failed"] = "failed";
29
+ })(CosignVerifyOutcome || (exports.CosignVerifyOutcome = CosignVerifyOutcome = {}));
30
+ exports.SLSA_PROVENANCE_PREDICATE_TYPE = 'https://slsa.dev/provenance/v1';
31
+ //# sourceMappingURL=verdicts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verdicts.js","sourceRoot":"","sources":["../../src/lib/verdicts.ts"],"names":[],"mappings":";;;AAgBA,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,uCAAmB,CAAA;IACnB,yCAAqB,CAAA;AACvB,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B;AAGD,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,oCAAe,CAAA;IACf,wCAAmB,CAAA;IACnB,wCAAmB,CAAA;AACrB,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B;AAGD,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,+DAA4C,CAAA;IAC5C,+DAA4C,CAAA;IAC5C,8EAA2D,CAAA;IAC3D,iEAA8C,CAAA;IAC9C,iEAA8C,CAAA;IAC9C,iEAA8C,CAAA;AAChD,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAOD,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,4CAAqB,CAAA;IACrB,wCAAiB,CAAA;AACnB,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B;AAGY,QAAA,8BAA8B,GACzC,gCAAyC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@xemahq/biome-supply-chain",
3
+ "version": "0.1.0",
4
+ "description": "Shared cosign supply-chain verification for Xema biomes: the single cosign CLI exec + the signature/provenance verdict enums used by biome-fetcher-api (OCI bundles) and @xemahq/biome-package (packaging CLI). Node-builtins only.",
5
+ "license": "Apache-2.0",
6
+ "author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
7
+ "homepage": "https://xema.dev",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/xema-dev/xema-biome-sdk.git",
11
+ "directory": "packages/sdks/biome-supply-chain"
12
+ },
13
+ "bugs": "https://github.com/xema-dev/xema-biome-sdk/issues",
14
+ "publishConfig": {
15
+ "registry": "https://registry.npmjs.org/",
16
+ "access": "public"
17
+ },
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "xema-source": "./src/index.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./dist/lib/*": {
25
+ "types": "./dist/lib/*.d.ts",
26
+ "default": "./dist/lib/*.js"
27
+ }
28
+ },
29
+ "main": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "files": [
32
+ "dist",
33
+ "src"
34
+ ],
35
+ "devDependencies": {
36
+ "@types/node": "^20.0.0",
37
+ "jest": "^29.0.0",
38
+ "ts-jest": "^29.0.0",
39
+ "typescript": "^5.0.0"
40
+ },
41
+ "keywords": [
42
+ "xema",
43
+ "biome",
44
+ "cosign",
45
+ "sigstore",
46
+ "slsa",
47
+ "supply-chain",
48
+ "signature-verification"
49
+ ],
50
+ "scripts": {
51
+ "build": "tsc",
52
+ "type-check": "tsc --noEmit",
53
+ "lint": "tsc --noEmit",
54
+ "test": "jest --passWithNoTests"
55
+ }
56
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './lib/verdicts';
2
+ export * from './lib/cosign-exec';
@@ -0,0 +1,188 @@
1
+ import { spawn } from 'node:child_process';
2
+
3
+ import { CosignVerifyOutcome } from './verdicts';
4
+
5
+ /** Default cosign binary name (overridable per call). */
6
+ const DEFAULT_COSIGN_BIN = 'cosign';
7
+
8
+ interface CosignRunResult {
9
+ readonly code: number;
10
+ readonly stderr: string;
11
+ }
12
+
13
+ /**
14
+ * The single canonical cosign invocation. Spawns the binary, captures stderr,
15
+ * and resolves with the exit code (never rejects on a non-zero exit — the
16
+ * caller decides whether a non-zero code is an error or a "failed" verdict).
17
+ * Rejects only when the process cannot be spawned at all.
18
+ */
19
+ function runCosign(
20
+ bin: string,
21
+ args: readonly string[],
22
+ ): Promise<CosignRunResult> {
23
+ return new Promise((resolve, reject) => {
24
+ const child = spawn(bin, [...args], {
25
+ stdio: ['ignore', 'pipe', 'pipe'],
26
+ });
27
+ let stderr = '';
28
+ child.stderr?.on('data', (chunk: Buffer) => {
29
+ stderr += chunk.toString();
30
+ });
31
+ child.on('error', reject);
32
+ child.on('close', (code) => {
33
+ resolve({ code: code ?? 1, stderr });
34
+ });
35
+ });
36
+ }
37
+
38
+ /** Throws if the cosign CLI is not available on PATH. */
39
+ export async function ensureCosignAvailable(
40
+ bin: string = DEFAULT_COSIGN_BIN,
41
+ ): Promise<void> {
42
+ try {
43
+ const { code, stderr } = await runCosign(bin, ['version']);
44
+ if (code !== 0) {
45
+ throw new Error(`\`${bin} version\` exited ${code}: ${stderr.slice(-200)}`);
46
+ }
47
+ } catch (cause) {
48
+ throw new Error(
49
+ `cosign CLI is not on PATH — install from https://github.com/sigstore/cosign ` +
50
+ `(${cause instanceof Error ? cause.message : String(cause)})`,
51
+ );
52
+ }
53
+ }
54
+
55
+ export interface VerifyCosignSignatureInput {
56
+ readonly ociRef: string;
57
+ /** Exact keyless certificate-identity URIs (any one may match). */
58
+ readonly trustedIdentities: readonly string[];
59
+ readonly oidcIssuer?: string;
60
+ /** Keyed verification: path to the public key (mutually exclusive w/ keyless). */
61
+ readonly keyPath?: string;
62
+ readonly bin?: string;
63
+ }
64
+
65
+ /**
66
+ * Verify a signature on an OCI ref (keyless identity allowlist OR keyed).
67
+ * Throws on non-verification; resolves on success. Mirrors the fetcher's
68
+ * former inline behaviour.
69
+ */
70
+ export async function verifyCosignSignature(
71
+ input: VerifyCosignSignatureInput,
72
+ ): Promise<void> {
73
+ const bin = input.bin ?? DEFAULT_COSIGN_BIN;
74
+ const args: string[] = ['verify'];
75
+ if (input.keyPath) {
76
+ args.push('--key', input.keyPath);
77
+ } else {
78
+ if (input.trustedIdentities.length === 0) {
79
+ throw new Error(
80
+ 'verifyCosignSignature: keyless mode requires at least one trusted identity',
81
+ );
82
+ }
83
+ for (const id of input.trustedIdentities) {
84
+ args.push('--certificate-identity', id);
85
+ }
86
+ if (input.oidcIssuer) {
87
+ args.push('--certificate-oidc-issuer', input.oidcIssuer);
88
+ }
89
+ }
90
+ args.push(input.ociRef);
91
+ const { code, stderr } = await runCosign(bin, args);
92
+ if (code !== 0) {
93
+ throw new Error(`${bin} verify failed (code=${code}): ${stderr.slice(-200)}`);
94
+ }
95
+ }
96
+
97
+ export interface VerifyCosignAttestationInput {
98
+ readonly ociRef: string;
99
+ readonly predicateType: string;
100
+ readonly trustedIdentities: readonly string[];
101
+ readonly oidcIssuer?: string;
102
+ readonly keyPath?: string;
103
+ readonly bin?: string;
104
+ }
105
+
106
+ /**
107
+ * Verify an in-toto/SLSA attestation on an OCI ref. Throws on
108
+ * non-verification; resolves on success.
109
+ */
110
+ export async function verifyCosignAttestation(
111
+ input: VerifyCosignAttestationInput,
112
+ ): Promise<void> {
113
+ const bin = input.bin ?? DEFAULT_COSIGN_BIN;
114
+ const args: string[] = ['verify-attestation', '--type', input.predicateType];
115
+ if (input.keyPath) {
116
+ args.push('--key', input.keyPath);
117
+ } else {
118
+ if (input.trustedIdentities.length === 0) {
119
+ throw new Error(
120
+ 'verifyCosignAttestation: keyless mode requires at least one trusted identity',
121
+ );
122
+ }
123
+ for (const id of input.trustedIdentities) {
124
+ args.push('--certificate-identity', id);
125
+ }
126
+ if (input.oidcIssuer) {
127
+ args.push('--certificate-oidc-issuer', input.oidcIssuer);
128
+ }
129
+ }
130
+ args.push(input.ociRef);
131
+ const { code, stderr } = await runCosign(bin, args);
132
+ if (code !== 0) {
133
+ throw new Error(
134
+ `${bin} verify-attestation failed (code=${code}): ${stderr.slice(-200)}`,
135
+ );
136
+ }
137
+ }
138
+
139
+ export interface VerifyCosignBlobInput {
140
+ /** Path to the artifact bytes on disk (caller owns fetch/temp-file lifecycle). */
141
+ readonly artifactPath: string;
142
+ /** Path to the detached signature bundle on disk. */
143
+ readonly bundlePath: string;
144
+ /** Keyless certificate-identity REGEXPS (any one may match). */
145
+ readonly trustedIdentityRegexps: readonly string[];
146
+ readonly oidcIssuer?: string;
147
+ readonly bin?: string;
148
+ }
149
+
150
+ export interface VerifyCosignBlobResult {
151
+ readonly outcome: CosignVerifyOutcome;
152
+ /** The identity regexp that matched, when Verified. */
153
+ readonly matchedIdentity?: string;
154
+ }
155
+
156
+ /**
157
+ * Verify a detached signature over a blob (`cosign verify-blob --bundle`).
158
+ * Tries each trusted identity regexp; the first that verifies wins. Returns a
159
+ * neutral {@link CosignVerifyOutcome} (never throws on a failed verification —
160
+ * an empty trust list or all-mismatch resolves to `Failed`). The caller owns
161
+ * artifact/bundle materialisation on disk.
162
+ */
163
+ export async function verifyCosignBlob(
164
+ input: VerifyCosignBlobInput,
165
+ ): Promise<VerifyCosignBlobResult> {
166
+ const bin = input.bin ?? DEFAULT_COSIGN_BIN;
167
+ if (input.trustedIdentityRegexps.length === 0) {
168
+ return { outcome: CosignVerifyOutcome.Failed };
169
+ }
170
+ for (const identity of input.trustedIdentityRegexps) {
171
+ const args: string[] = [
172
+ 'verify-blob',
173
+ '--bundle',
174
+ input.bundlePath,
175
+ '--certificate-identity-regexp',
176
+ identity,
177
+ ];
178
+ if (input.oidcIssuer) {
179
+ args.push('--certificate-oidc-issuer', input.oidcIssuer);
180
+ }
181
+ args.push(input.artifactPath);
182
+ const { code } = await runCosign(bin, args);
183
+ if (code === 0) {
184
+ return { outcome: CosignVerifyOutcome.Verified, matchedIdentity: identity };
185
+ }
186
+ }
187
+ return { outcome: CosignVerifyOutcome.Failed };
188
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Shared cosign supply-chain verdict vocabulary.
3
+ *
4
+ * This is the single source of truth for the lowercase verdict/error enums
5
+ * that `biome-fetcher-api` (OCI bundle verification) and `@xemahq/biome-package`
6
+ * (the packaging CLI) previously duplicated locally. They are value-identical
7
+ * to those former copies, so adopting this package is a pure de-duplication
8
+ * with no wire/behaviour change.
9
+ *
10
+ * NOTE: `xema-store-api` keeps its OWN UPPERCASE `SignatureVerdict` /
11
+ * `ProvenanceVerdict` (persisted + OpenAPI + cross-service event wire); it
12
+ * consumes only the cosign EXEC + {@link CosignVerifyOutcome} from this
13
+ * package, mapping the neutral outcome to its own wire enum.
14
+ */
15
+
16
+ /** Signature verification verdict. */
17
+ export enum SignatureVerdict {
18
+ Valid = 'valid',
19
+ Invalid = 'invalid',
20
+ Unsigned = 'unsigned',
21
+ }
22
+
23
+ /** SLSA attestation / provenance verdict. */
24
+ export enum ProvenanceVerdict {
25
+ Valid = 'valid',
26
+ Invalid = 'invalid',
27
+ Missing = 'missing',
28
+ }
29
+
30
+ /** Stable, typed reasons a cosign verification may reject an artifact. */
31
+ export enum CosignErrorCode {
32
+ SignatureMissing = 'BIOME_SIGNATURE_MISSING',
33
+ SignatureInvalid = 'BIOME_SIGNATURE_INVALID',
34
+ IdentityNotTrusted = 'BIOME_SIGNATURE_IDENTITY_NOT_TRUSTED',
35
+ ProvenanceMissing = 'BIOME_PROVENANCE_MISSING',
36
+ ProvenanceInvalid = 'BIOME_PROVENANCE_INVALID',
37
+ CosignUnavailable = 'BIOME_COSIGN_UNAVAILABLE',
38
+ }
39
+
40
+ /**
41
+ * Casing-neutral internal outcome of a detached-blob verification. The blob
42
+ * path (store) maps this to its own UPPERCASE wire verdict; it deliberately
43
+ * does not leak the wire casing into the shared exec layer.
44
+ */
45
+ export enum CosignVerifyOutcome {
46
+ Verified = 'verified',
47
+ Failed = 'failed',
48
+ }
49
+
50
+ /** Canonical SLSA provenance predicate type. */
51
+ export const SLSA_PROVENANCE_PREDICATE_TYPE =
52
+ 'https://slsa.dev/provenance/v1' as const;