@xemahq/biome-supply-chain 0.5.1 → 0.7.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/README.md +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cosign-exec.d.ts +5 -12
- package/dist/lib/cosign-exec.d.ts.map +1 -1
- package/dist/lib/cosign-exec.js +43 -54
- package/dist/lib/cosign-exec.js.map +1 -1
- package/dist/lib/expected-signer.d.ts +15 -0
- package/dist/lib/expected-signer.d.ts.map +1 -0
- package/dist/lib/expected-signer.js +31 -0
- package/dist/lib/expected-signer.js.map +1 -0
- package/dist/lib/keyless-entry.d.ts +9 -0
- package/dist/lib/keyless-entry.d.ts.map +1 -0
- package/dist/lib/keyless-entry.js +20 -0
- package/dist/lib/keyless-entry.js.map +1 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -36,6 +36,8 @@ if (outcome === CosignVerifyOutcome.Verified) {
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
OCI verification (`verifyCosignSignature`, `verifyCosignAttestation`) checks a subject against exactly ONE `expectedSigner`, the signer that subject's own trust row declares: `{ kind: CosignTrustAnchorKind.PublicKey, publicKeyPath }` or `{ kind: CosignTrustAnchorKind.KeylessIdentity, identity, issuer }` (exact identity, issuer required). One cosign run each; no other trusted signer is tried, and a missing signer throws `CosignExpectedSignerError` before cosign is spawned. Pass the same signer to the attestation check.
|
|
40
|
+
|
|
39
41
|
Other exports: `verifyCosignSignature`, `verifyCosignAttestation`, `SignatureVerdict`, `ProvenanceVerdict`, `CosignErrorCode`. A failed verification returns an outcome; an empty `anchors` list returns `Failed`. A pinned `trustedRoot` that is missing or has the wrong digest throws `CosignTrustedRootError`.
|
|
40
42
|
|
|
41
43
|
## License
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,4 +18,6 @@ __exportStar(require("./lib/verdicts"), exports);
|
|
|
18
18
|
__exportStar(require("./lib/trust-anchors"), exports);
|
|
19
19
|
__exportStar(require("./lib/registry-auth"), exports);
|
|
20
20
|
__exportStar(require("./lib/cosign-exec"), exports);
|
|
21
|
+
__exportStar(require("./lib/keyless-entry"), exports);
|
|
22
|
+
__exportStar(require("./lib/expected-signer"), exports);
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,sDAAoC;AACpC,sDAAoC;AACpC,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,sDAAoC;AACpC,sDAAoC;AACpC,oDAAkC;AAClC,sDAAoC;AACpC,wDAAsC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type RegistryCredential } from './registry-auth';
|
|
2
2
|
import { type CosignBlobTrustAnchor, type CosignMatchedAnchor, type CosignPinnedTrustedRoot } from './trust-anchors';
|
|
3
|
+
import { type CosignExpectedSigner } from './expected-signer';
|
|
3
4
|
import { CosignFailureKind, CosignVerifyOutcome } from './verdicts';
|
|
4
5
|
interface CosignRunResult {
|
|
5
6
|
readonly code: number;
|
|
@@ -20,25 +21,17 @@ export declare class CosignCommandError extends Error {
|
|
|
20
21
|
static fromRun(command: string, run: CosignRunResult): CosignCommandError;
|
|
21
22
|
}
|
|
22
23
|
export declare function ensureCosignAvailable(bin?: string): Promise<void>;
|
|
23
|
-
|
|
24
|
+
interface CosignOciSubjectInput {
|
|
24
25
|
readonly ociRef: string;
|
|
25
|
-
readonly
|
|
26
|
-
readonly oidcIssuer?: string | undefined;
|
|
27
|
-
readonly keyPath?: string | undefined;
|
|
26
|
+
readonly expectedSigner: CosignExpectedSigner;
|
|
28
27
|
readonly trustedRoot?: CosignPinnedTrustedRoot | undefined;
|
|
29
28
|
readonly registryCredential?: RegistryCredential | undefined;
|
|
30
29
|
readonly bin?: string | undefined;
|
|
31
30
|
}
|
|
31
|
+
export type VerifyCosignSignatureInput = CosignOciSubjectInput;
|
|
32
32
|
export declare function verifyCosignSignature(input: VerifyCosignSignatureInput): Promise<void>;
|
|
33
|
-
export interface VerifyCosignAttestationInput {
|
|
34
|
-
readonly ociRef: string;
|
|
33
|
+
export interface VerifyCosignAttestationInput extends CosignOciSubjectInput {
|
|
35
34
|
readonly predicateType: string;
|
|
36
|
-
readonly trustedIdentities: readonly string[];
|
|
37
|
-
readonly oidcIssuer?: string | undefined;
|
|
38
|
-
readonly keyPath?: string | undefined;
|
|
39
|
-
readonly trustedRoot?: CosignPinnedTrustedRoot | undefined;
|
|
40
|
-
readonly registryCredential?: RegistryCredential | undefined;
|
|
41
|
-
readonly bin?: string | undefined;
|
|
42
35
|
}
|
|
43
36
|
export declare function verifyCosignAttestation(input: VerifyCosignAttestationInput): Promise<void>;
|
|
44
37
|
export interface VerifyCosignBlobInput {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosign-exec.d.ts","sourceRoot":"","sources":["../../src/lib/cosign-exec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"cosign-exec.d.ts","sourceRoot":"","sources":["../../src/lib/cosign-exec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAKpE,UAAU,eAAe;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAgED,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,MAAM,GAAE;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GACtE,MAAM,CAYR;AAiBD,eAAO,MAAM,8BAA8B,EAAE,SAAS,MAAM,EAM3D,CAAC;AAGF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAIvE;AAQD,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,OAAO,EAAE,MAAM;aACf,QAAQ,EAAE,MAAM;aAChB,IAAI,EAAE,iBAAiB;aACvB,UAAU,EAAE,MAAM;gBAHlB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,I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AW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IAOtC,QAAQ,CAAC,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;CAC1D;AAyDD,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CA8BjC"}
|
package/dist/lib/cosign-exec.js
CHANGED
|
@@ -10,6 +10,8 @@ exports.verifyCosignBlob = verifyCosignBlob;
|
|
|
10
10
|
const node_child_process_1 = require("node:child_process");
|
|
11
11
|
const registry_auth_1 = require("./registry-auth");
|
|
12
12
|
const trust_anchors_1 = require("./trust-anchors");
|
|
13
|
+
const keyless_entry_1 = require("./keyless-entry");
|
|
14
|
+
const expected_signer_1 = require("./expected-signer");
|
|
13
15
|
const verdicts_1 = require("./verdicts");
|
|
14
16
|
const DEFAULT_COSIGN_BIN = 'cosign';
|
|
15
17
|
function runCosign(bin, args, env = {}) {
|
|
@@ -96,60 +98,47 @@ function pinnedOciFlags(trustedRoot, keyed) {
|
|
|
96
98
|
? ['--offline']
|
|
97
99
|
: ['--offline', '--trusted-root', trustedRoot.path];
|
|
98
100
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const run = await runCosignAgainstRegistry(bin, args, input.registryCredential);
|
|
122
|
-
if (run.code !== 0) {
|
|
123
|
-
throw CosignCommandError.fromRun(`${bin} verify`, run);
|
|
124
|
-
}
|
|
101
|
+
function buildKeylessArgv(leading, entry, trustedRoot, subject) {
|
|
102
|
+
return [
|
|
103
|
+
...leading,
|
|
104
|
+
'--certificate-identity',
|
|
105
|
+
entry.identity,
|
|
106
|
+
'--certificate-oidc-issuer',
|
|
107
|
+
entry.issuer,
|
|
108
|
+
...pinnedOciFlags(trustedRoot, false),
|
|
109
|
+
subject,
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
function buildSignerOciArgv(leading, signer, trustedRoot, ociRef) {
|
|
113
|
+
if (signer.kind === trust_anchors_1.CosignTrustAnchorKind.PublicKey) {
|
|
114
|
+
return [
|
|
115
|
+
...leading,
|
|
116
|
+
'--key',
|
|
117
|
+
signer.publicKeyPath,
|
|
118
|
+
...pinnedOciFlags(trustedRoot, true),
|
|
119
|
+
ociRef,
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
return buildKeylessArgv(leading, { identity: signer.identity, issuer: signer.issuer }, trustedRoot, ociRef);
|
|
125
123
|
}
|
|
126
|
-
async function
|
|
124
|
+
async function verifyOciAgainstSigner(leading, input) {
|
|
127
125
|
const bin = input.bin ?? DEFAULT_COSIGN_BIN;
|
|
126
|
+
(0, expected_signer_1.assertCosignExpectedSigner)(input.expectedSigner, input.ociRef);
|
|
128
127
|
if (input.trustedRoot) {
|
|
129
128
|
(0, trust_anchors_1.assertPinnedTrustedRoot)(input.trustedRoot);
|
|
130
129
|
}
|
|
131
|
-
const args =
|
|
132
|
-
if (input.keyPath) {
|
|
133
|
-
args.push('--key', input.keyPath);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
if (input.trustedIdentities.length === 0) {
|
|
137
|
-
throw new Error('verifyCosignAttestation: keyless mode requires at least one trusted identity');
|
|
138
|
-
}
|
|
139
|
-
for (const id of input.trustedIdentities) {
|
|
140
|
-
args.push('--certificate-identity', id);
|
|
141
|
-
}
|
|
142
|
-
if (input.oidcIssuer) {
|
|
143
|
-
args.push('--certificate-oidc-issuer', input.oidcIssuer);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
args.push(...pinnedOciFlags(input.trustedRoot, Boolean(input.keyPath)));
|
|
147
|
-
args.push(input.ociRef);
|
|
130
|
+
const args = buildSignerOciArgv(leading, input.expectedSigner, input.trustedRoot, input.ociRef);
|
|
148
131
|
const run = await runCosignAgainstRegistry(bin, args, input.registryCredential);
|
|
149
132
|
if (run.code !== 0) {
|
|
150
|
-
throw CosignCommandError.fromRun(`${bin}
|
|
133
|
+
throw CosignCommandError.fromRun(`${bin} ${leading[0]}`, run);
|
|
151
134
|
}
|
|
152
135
|
}
|
|
136
|
+
function verifyCosignSignature(input) {
|
|
137
|
+
return verifyOciAgainstSigner(['verify'], input);
|
|
138
|
+
}
|
|
139
|
+
function verifyCosignAttestation(input) {
|
|
140
|
+
return verifyOciAgainstSigner(['verify-attestation', '--type', input.predicateType], input);
|
|
141
|
+
}
|
|
153
142
|
function buildBlobVerifyArgs(anchor, input) {
|
|
154
143
|
const args = ['verify-blob'];
|
|
155
144
|
if (anchor.kind === trust_anchors_1.CosignTrustAnchorKind.PublicKey) {
|
|
@@ -157,15 +146,7 @@ function buildBlobVerifyArgs(anchor, input) {
|
|
|
157
146
|
args.push(input.artifactPath);
|
|
158
147
|
return args;
|
|
159
148
|
}
|
|
160
|
-
|
|
161
|
-
if (input.oidcIssuer) {
|
|
162
|
-
args.push('--certificate-oidc-issuer', input.oidcIssuer);
|
|
163
|
-
}
|
|
164
|
-
if (input.trustedRoot) {
|
|
165
|
-
args.push('--offline', '--trusted-root', input.trustedRoot.path);
|
|
166
|
-
}
|
|
167
|
-
args.push(input.artifactPath);
|
|
168
|
-
return args;
|
|
149
|
+
return buildKeylessArgv(['verify-blob', '--bundle', input.bundlePath], { identity: anchor.name, issuer: input.oidcIssuer ?? '' }, input.trustedRoot, input.artifactPath);
|
|
169
150
|
}
|
|
170
151
|
async function verifyCosignBlob(input) {
|
|
171
152
|
const bin = input.bin ?? DEFAULT_COSIGN_BIN;
|
|
@@ -175,6 +156,14 @@ async function verifyCosignBlob(input) {
|
|
|
175
156
|
if (input.trustedRoot) {
|
|
176
157
|
(0, trust_anchors_1.assertPinnedTrustedRoot)(input.trustedRoot);
|
|
177
158
|
}
|
|
159
|
+
for (const anchor of input.anchors) {
|
|
160
|
+
if (anchor.kind === trust_anchors_1.CosignTrustAnchorKind.KeylessIdentity) {
|
|
161
|
+
(0, keyless_entry_1.assertCosignKeylessEntry)({
|
|
162
|
+
identity: anchor.name,
|
|
163
|
+
issuer: input.oidcIssuer ?? '',
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
178
167
|
for (const anchor of input.anchors) {
|
|
179
168
|
const { code } = await runCosign(bin, buildBlobVerifyArgs(anchor, input));
|
|
180
169
|
if (code === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosign-exec.js","sourceRoot":"","sources":["../../src/lib/cosign-exec.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cosign-exec.js","sourceRoot":"","sources":["../../src/lib/cosign-exec.ts"],"names":[],"mappings":";;;AA0FA,gCAeC;AA0BD,sDAIC;AA+BD,sDAcC;AA2KD,sDAIC;AAWD,0DAOC;AAqGD,4CAgCC;AA1fD,2DAA2C;AAE3C,mDAA4E;AAC5E,mDAMyB;AACzB,mDAGyB;AACzB,uDAG2B;AAC3B,yCAAoE;AAGpE,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAkBpC,SAAS,SAAS,CAChB,GAAW,EACX,IAAuB,EACvB,MAAwC,EAAE;IAE1C,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;YACjC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE;SAChC,CAAC,CAAC;QACH,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,CAAC,MAA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,UAAU,IAAI,EAAE;aAC/B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1E,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,8BAAmB,CAAC,QAAQ;gBACrC,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;aACxD,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,8BAAmB,CAAC,MAAM,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CosignKeylessEntry } from './keyless-entry';
|
|
2
|
+
import { CosignTrustAnchorKind } from './trust-anchors';
|
|
3
|
+
export interface CosignKeySigner {
|
|
4
|
+
readonly kind: CosignTrustAnchorKind.PublicKey;
|
|
5
|
+
readonly publicKeyPath: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CosignKeylessSigner extends CosignKeylessEntry {
|
|
8
|
+
readonly kind: CosignTrustAnchorKind.KeylessIdentity;
|
|
9
|
+
}
|
|
10
|
+
export type CosignExpectedSigner = CosignKeySigner | CosignKeylessSigner;
|
|
11
|
+
export declare class CosignExpectedSignerError extends Error {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
export declare function assertCosignExpectedSigner(signer: CosignExpectedSigner | undefined, subject: string): asserts signer is CosignExpectedSigner;
|
|
15
|
+
//# sourceMappingURL=expected-signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expected-signer.d.ts","sourceRoot":"","sources":["../../src/lib/expected-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAYxD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC;IAE/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAGD,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC,eAAe,CAAC;CACtD;AAGD,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAGzE,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAQD,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,oBAAoB,GAAG,SAAS,EACxC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,IAAI,oBAAoB,CAsBxC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosignExpectedSignerError = void 0;
|
|
4
|
+
exports.assertCosignExpectedSigner = assertCosignExpectedSigner;
|
|
5
|
+
const keyless_entry_1 = require("./keyless-entry");
|
|
6
|
+
const trust_anchors_1 = require("./trust-anchors");
|
|
7
|
+
class CosignExpectedSignerError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'CosignExpectedSignerError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CosignExpectedSignerError = CosignExpectedSignerError;
|
|
14
|
+
function assertCosignExpectedSigner(signer, subject) {
|
|
15
|
+
if (!signer) {
|
|
16
|
+
throw new CosignExpectedSignerError(`no signer is declared for ${subject}; refusing to verify it against anything else`);
|
|
17
|
+
}
|
|
18
|
+
switch (signer.kind) {
|
|
19
|
+
case trust_anchors_1.CosignTrustAnchorKind.PublicKey:
|
|
20
|
+
if (!signer.publicKeyPath || signer.publicKeyPath.trim().length === 0) {
|
|
21
|
+
throw new CosignExpectedSignerError(`the key signer declared for ${subject} has no public key path`);
|
|
22
|
+
}
|
|
23
|
+
return;
|
|
24
|
+
case trust_anchors_1.CosignTrustAnchorKind.KeylessIdentity:
|
|
25
|
+
(0, keyless_entry_1.assertCosignKeylessEntry)(signer);
|
|
26
|
+
return;
|
|
27
|
+
default:
|
|
28
|
+
throw new CosignExpectedSignerError(`the signer declared for ${subject} has unknown kind '${String(signer.kind)}'`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=expected-signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expected-signer.js","sourceRoot":"","sources":["../../src/lib/expected-signer.ts"],"names":[],"mappings":";;;AA4CA,gEAyBC;AArED,mDAGyB;AACzB,mDAAwD;AA2BxD,MAAa,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AALD,8DAKC;AAQD,SAAgB,0BAA0B,CACxC,MAAwC,EACxC,OAAe;IAEf,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,yBAAyB,CACjC,6BAA6B,OAAO,+CAA+C,CACpF,CAAC;IACJ,CAAC;IACD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,qCAAqB,CAAC,SAAS;YAClC,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtE,MAAM,IAAI,yBAAyB,CACjC,+BAA+B,OAAO,yBAAyB,CAChE,CAAC;YACJ,CAAC;YACD,OAAO;QACT,KAAK,qCAAqB,CAAC,eAAe;YACxC,IAAA,wCAAwB,EAAC,MAAM,CAAC,CAAC;YACjC,OAAO;QACT;YACE,MAAM,IAAI,yBAAyB,CACjC,2BAA2B,OAAO,sBAAsB,MAAM,CAAE,MAA6B,CAAC,IAAI,CAAC,GAAG,CACvG,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface CosignKeylessEntry {
|
|
2
|
+
readonly identity: string;
|
|
3
|
+
readonly issuer: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class CosignKeylessEntryError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare function assertCosignKeylessEntry(entry: CosignKeylessEntry): void;
|
|
9
|
+
//# sourceMappingURL=keyless-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyless-entry.d.ts","sourceRoot":"","sources":["../../src/lib/keyless-entry.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAGD,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAGD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAWxE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosignKeylessEntryError = void 0;
|
|
4
|
+
exports.assertCosignKeylessEntry = assertCosignKeylessEntry;
|
|
5
|
+
class CosignKeylessEntryError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'CosignKeylessEntryError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CosignKeylessEntryError = CosignKeylessEntryError;
|
|
12
|
+
function assertCosignKeylessEntry(entry) {
|
|
13
|
+
if (!entry.identity || entry.identity.trim().length === 0) {
|
|
14
|
+
throw new CosignKeylessEntryError('cosign keyless entry has no certificate identity');
|
|
15
|
+
}
|
|
16
|
+
if (!entry.issuer || entry.issuer.trim().length === 0) {
|
|
17
|
+
throw new CosignKeylessEntryError(`cosign keyless entry for identity "${entry.identity}" has no OIDC issuer; the issuer is required`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=keyless-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyless-entry.js","sourceRoot":"","sources":["../../src/lib/keyless-entry.ts"],"names":[],"mappings":";;;AAoBA,4DAWC;AAnBD,MAAa,uBAAwB,SAAQ,KAAK;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AALD,0DAKC;AAGD,SAAgB,wBAAwB,CAAC,KAAyB;IAChE,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,uBAAuB,CAC/B,kDAAkD,CACnD,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,uBAAuB,CAC/B,sCAAsC,KAAK,CAAC,QAAQ,8CAA8C,CACnG,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/biome-supply-chain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
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 bundle verification) and xema-store-api. Node-builtins only.",
|
|
5
5
|
"license": "LicenseRef-Xema-BSL-1.1",
|
|
6
6
|
"author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
|
|
@@ -54,5 +54,8 @@
|
|
|
54
54
|
"test": "tsc -p tsconfig.json && node --test \"dist-test/test/**/*.test.js\"",
|
|
55
55
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
56
56
|
"clean": "rm -rf dist dist-test"
|
|
57
|
+
},
|
|
58
|
+
"xemaRelease": {
|
|
59
|
+
"sourceDigest": "sha256:86a1eab069a713e28f5849cd141c7652ff66d3c132618120f2dbf0fc5ecf0673"
|
|
57
60
|
}
|
|
58
|
-
}
|
|
61
|
+
}
|