@xemahq/biome-supply-chain 0.5.0 → 0.5.1

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.
Files changed (2) hide show
  1. package/README.md +14 -50
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,79 +1,43 @@
1
1
  # @xemahq/biome-supply-chain
2
2
 
3
- This package belongs to Layer 1 — a framework-free runtime SDK utility.
3
+ Cosign signature and attestation verification for biome artifacts. It wraps the `cosign` CLI and exports the verdict and trust-anchor vocabulary. Node built-ins only, no framework.
4
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 `xema-store-api`:
5
+ ## When to use it
8
6
 
9
- - the single cosign CLI invocation (`ensureCosignAvailable`,
10
- `verifyCosignSignature`, `verifyCosignAttestation`, `verifyCosignBlob`), and
11
- - the signature / provenance verdict vocabulary (`SignatureVerdict`,
12
- `ProvenanceVerdict`, `CosignErrorCode`, `CosignVerifyOutcome`).
7
+ Use it to verify a biome OCI reference or a detached blob against trusted identities or public keys. Fetching the artifact stays with the caller. Needs the `cosign` binary on the path.
13
8
 
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.
9
+ ## Installation
10
+
11
+ ```bash
12
+ pnpm add @xemahq/biome-supply-chain
13
+ ```
17
14
 
18
15
  ## Usage
19
16
 
20
17
  ```ts
21
18
  import {
22
19
  ensureCosignAvailable,
23
- verifyCosignSignature,
24
20
  verifyCosignBlob,
25
21
  CosignTrustAnchorKind,
26
- SignatureVerdict,
27
22
  CosignVerifyOutcome,
28
23
  } from '@xemahq/biome-supply-chain';
29
24
 
30
25
  await ensureCosignAvailable();
31
26
 
32
- // OCI ref (keyless identity allowlist)
33
- await verifyCosignSignature({
34
- ociRef: 'oci://registry/biome:1.2.0',
35
- trustedIdentities: ['https://github.com/xema-dev/...'],
36
- oidcIssuer: 'https://token.actions.githubusercontent.com',
37
- });
38
-
39
- // Detached blob (caller owns artifact/bundle/public-key files on disk).
40
- // A trust anchor is EITHER a keyless certificate-identity pattern OR a NAMED
41
- // public key; both kinds share one list and one result shape, and the anchors
42
- // are tried in order until one verifies.
43
27
  const { outcome, matchedAnchor } = await verifyCosignBlob({
44
- artifactPath: '/tmp/remoteEntry.js',
45
- bundlePath: '/tmp/remoteEntry.js.bundle',
28
+ artifactPath: './remoteEntry.js',
29
+ bundlePath: './remoteEntry.js.bundle',
46
30
  anchors: [
47
- {
48
- kind: CosignTrustAnchorKind.KeylessIdentity,
49
- name: '^https://github.com/xema-dev/.*$', // the name IS the regexp
50
- },
51
- {
52
- kind: CosignTrustAnchorKind.PublicKey,
53
- name: 'release-2026',
54
- publicKeyPath: '/etc/cosign/release.pub',
55
- },
31
+ { kind: CosignTrustAnchorKind.PublicKey, name: 'release-key', publicKeyPath: './release.pub' },
56
32
  ],
57
- // Optional: pin the Sigstore trusted root so KEYLESS anchors verify with
58
- // `--offline --trusted-root` (air-gap capable). A missing, unreadable or
59
- // digest-mismatched root THROWS `CosignTrustedRootError` before cosign is
60
- // spawned — it never falls back to cosign's online default.
61
- trustedRoot: { path: '/etc/sigstore/trusted-root.json', sha256: '<64 hex>' },
62
33
  });
63
34
  if (outcome === CosignVerifyOutcome.Verified) {
64
- // matchedAnchor is { kind, name } — WHICH anchor vouched for the bytes
35
+ // matchedAnchor names the anchor that vouched for the bytes
65
36
  }
66
37
  ```
67
38
 
68
- An empty `anchors` list resolves to `Failed` without spawning cosign, and a
69
- failed verification is a neutral outcome rather than a throw.
70
-
71
- Artifact resolution (resolving an OCI ref, or fetching + writing a blob to a
72
- temp file) stays with each consumer; this package owns only the cosign exec,
73
- the trust-anchor vocabulary and the verdict enums.
39
+ 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`.
74
40
 
75
41
  ## License
76
42
 
77
- Business Source License 1.1 (BSL-1.1) — source-available; converts to MPL-2.0
78
- four years after each release. &copy; Xema — [xema.dev](https://xema.dev). See
79
- the [repository LICENSE](../../../LICENSE).
43
+ LicenseRef-Xema-BSL-1.1 &copy; Xema — [xema.dev](https://xema.dev)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/biome-supply-chain",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
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)",