@sentropic/artifacts 0.2.18 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +14 -0
- package/dist/adapters/postgres-git-bindings.js +25 -4
- package/dist/http.d.ts +3 -0
- package/dist/http.js +12 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/live-host/accept.d.ts +30 -0
- package/dist/live-host/accept.js +43 -0
- package/dist/live-host/api.d.ts +67 -0
- package/dist/live-host/api.js +60 -0
- package/dist/live-host/candidate.d.ts +21 -0
- package/dist/live-host/candidate.js +41 -0
- package/dist/live-host/errors.d.ts +9 -0
- package/dist/live-host/errors.js +14 -0
- package/dist/live-host/handoff.d.ts +63 -0
- package/dist/live-host/handoff.js +66 -0
- package/dist/live-host/index.d.ts +10 -0
- package/dist/live-host/index.js +10 -0
- package/dist/live-host/keys.d.ts +14 -0
- package/dist/live-host/keys.js +8 -0
- package/dist/live-host/live-format.d.ts +70 -0
- package/dist/live-host/live-format.js +100 -0
- package/dist/live-host/recheck.d.ts +59 -0
- package/dist/live-host/recheck.js +45 -0
- package/dist/mcp-core.d.ts +1 -1
- package/dist/mcp-core.js +4 -1
- package/dist/server/build-contract.d.ts +15 -1
- package/dist/server/build-contract.js +14 -5
- package/dist/server/build-dependencies.d.ts +12 -1
- package/dist/server/build-dependencies.js +41 -13
- package/dist/server/build-integrity.d.ts +48 -0
- package/dist/server/build-integrity.js +70 -0
- package/dist/server/build-output.d.ts +22 -0
- package/dist/server/build-output.js +40 -0
- package/dist/server/build-receipt.d.ts +51 -0
- package/dist/server/build-receipt.js +76 -0
- package/dist/server/failures.d.ts +2 -2
- package/dist/server/failures.js +1 -1
- package/dist/server/git-bindings.d.ts +3 -1
- package/dist/server/git-bindings.js +26 -1
- package/dist/server/git-contracts.d.ts +18 -1
- package/dist/server/git-tools-attach.d.ts +8 -0
- package/dist/server/git-tools-attach.js +139 -0
- package/dist/server/git-tools-contracts.d.ts +59 -0
- package/dist/server/git-tools-contracts.js +1 -0
- package/dist/server/git-tools-fetch.d.ts +21 -0
- package/dist/server/git-tools-fetch.js +65 -0
- package/dist/server/git-tools-publish.d.ts +13 -0
- package/dist/server/git-tools-publish.js +66 -0
- package/dist/server/git-tools.d.ts +4 -0
- package/dist/server/git-tools.js +18 -0
- package/dist/server/live-mutations.d.ts +1 -1
- package/dist/server/live-mutations.js +3 -2
- package/dist/server/live-read.d.ts +1 -1
- package/dist/server/live-read.js +2 -1
- package/dist/server/live-store.d.ts +2 -1
- package/dist/server/live-store.js +2 -0
- package/dist/server/templates.js +26 -1
- package/migrations/0012_git_attach_intents.sql +19 -0
- package/package.json +5 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `@sentropic/artifacts/live-host`: the single home of the code the live host runs or verifies (A-LIVE v2 §8).
|
|
2
|
+
* api, artifact-content and the content host (immo) import it; none re-implements a digest, a signature or a recheck. */
|
|
3
|
+
export { CANDIDATE_DIGEST_TAG, CANDIDATE_LIMITS, candidateDigest, candidatePath } from './candidate.js';
|
|
4
|
+
export { LIVE_HOST_ERROR_CODES, LiveHostError } from './errors.js';
|
|
5
|
+
export { LIVE_KEY_ID, liveKeyId } from './keys.js';
|
|
6
|
+
export { HANDOFF_LIFETIME_MS, jobKey, sealHandoff, verifyReceipt, } from './handoff.js';
|
|
7
|
+
export { publicationRecheck, RECHECK_REFUSALS, resolvePendingJob, } from './recheck.js';
|
|
8
|
+
export { acceptHandoff } from './accept.js';
|
|
9
|
+
export { encodeHandoffRequest, HOST_BUILD_PATHS, JOB_REQUEST_LIFETIME_MS, parseHandoffRequest, refusalFrom, refusalOf, sealJobRequest, verifyJobRequest, } from './api.js';
|
|
10
|
+
export { ASSERTION_HEADER, CONTROL_HEADER, FENCE_HEADER, MAX_ASSERTION_SECONDS, MAX_CONTROL_SECONDS, MAX_SKEW_SECONDS, MAX_SOURCE_REVISION_LENGTH, MIN_KEY_BYTES, signLiveAssertion, signLiveControl, signLiveFence, verifyLiveAssertion, verifyLiveControl, verifyLiveFence, } from './live-format.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import type { KeyObject } from 'node:crypto';
|
|
3
|
+
/** Key id carried in every signed live-host message, so a verifier accepts old and new keys during a rotation overlap. */
|
|
4
|
+
export declare const LIVE_KEY_ID: RegExp;
|
|
5
|
+
export declare const liveKeyId: (kid: unknown) => kid is string;
|
|
6
|
+
/** Current signing key and its id. */
|
|
7
|
+
export interface SigningKey {
|
|
8
|
+
readonly kid: string;
|
|
9
|
+
readonly key: KeyObject;
|
|
10
|
+
}
|
|
11
|
+
/** Verifier key set: returns the public key of a known id, undefined otherwise. */
|
|
12
|
+
export type KeyResolver = (kid: string) => KeyObject | undefined;
|
|
13
|
+
export declare const ed25519: (key: KeyObject | undefined, type: 'private' | 'public') => key is KeyObject;
|
|
14
|
+
export declare function assertSigner(signer: SigningKey): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Key id carried in every signed live-host message, so a verifier accepts old and new keys during a rotation overlap. */
|
|
2
|
+
export const LIVE_KEY_ID = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
3
|
+
export const liveKeyId = (kid) => typeof kid === 'string' && LIVE_KEY_ID.test(kid);
|
|
4
|
+
export const ed25519 = (key, type) => !!key && key.asymmetricKeyType === 'ed25519' && (key.type === type || (type === 'public' && key.type === 'private'));
|
|
5
|
+
export function assertSigner(signer) {
|
|
6
|
+
if (!signer || !liveKeyId(signer.kid) || !ed25519(signer.key, 'private'))
|
|
7
|
+
throw new TypeError('Signer must be an Ed25519 private key with a valid kid');
|
|
8
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A-LIVE §8.2 live edge wire format (W9 / M4-E), pure and dependency-free so the host (immo), the controller
|
|
3
|
+
* (Sentropic API) and `artifact-content` sign and verify with the same code. Three HMAC-SHA256 message kinds, each
|
|
4
|
+
* with its own MAC-bound prefix so none can be replayed as another:
|
|
5
|
+
* - `v1` host assertion (immo → artifact-content), on every live request and websocket upgrade;
|
|
6
|
+
* - `c1` host control (immo → artifact-content): session or invitation revocation;
|
|
7
|
+
* - `f1` controller fence (Sentropic API → artifact-content): generation and route-epoch floor.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ASSERTION_HEADER = "x-live-host-assertion";
|
|
10
|
+
export declare const CONTROL_HEADER = "x-live-host-control";
|
|
11
|
+
export declare const FENCE_HEADER = "x-live-controller-fence";
|
|
12
|
+
export declare const MIN_KEY_BYTES = 32;
|
|
13
|
+
export declare const MAX_ASSERTION_SECONDS = 3600;
|
|
14
|
+
export declare const MAX_CONTROL_SECONDS = 300;
|
|
15
|
+
export declare const MAX_SKEW_SECONDS = 30;
|
|
16
|
+
/** The live source revision is an opaque string (A-LIVE live revisions), compared, never parsed. */
|
|
17
|
+
export declare const MAX_SOURCE_REVISION_LENGTH = 256;
|
|
18
|
+
export interface LiveAssertionClaims {
|
|
19
|
+
v: 1;
|
|
20
|
+
kid: string;
|
|
21
|
+
host: string;
|
|
22
|
+
artifactId: string;
|
|
23
|
+
storageScopeId: string;
|
|
24
|
+
sessionId: string;
|
|
25
|
+
generation: number;
|
|
26
|
+
routeEpoch: number;
|
|
27
|
+
podUid: string;
|
|
28
|
+
podName: string;
|
|
29
|
+
sourceRevision: string;
|
|
30
|
+
principalId: string;
|
|
31
|
+
role: 'binding_owner' | 'invitee';
|
|
32
|
+
invitationId: string;
|
|
33
|
+
invitationEpoch: number;
|
|
34
|
+
invitationExp: number;
|
|
35
|
+
iat: number;
|
|
36
|
+
exp: number;
|
|
37
|
+
}
|
|
38
|
+
/** Host revocation; `epoch` is the invitation's new floor: every assertion below it is refused. */
|
|
39
|
+
export interface LiveControlClaims {
|
|
40
|
+
v: 1;
|
|
41
|
+
kid: string;
|
|
42
|
+
host: string;
|
|
43
|
+
artifactId: string;
|
|
44
|
+
op: 'revoke_session' | 'revoke_invitation';
|
|
45
|
+
sessionId: string;
|
|
46
|
+
invitationId: string;
|
|
47
|
+
epoch: number;
|
|
48
|
+
iat: number;
|
|
49
|
+
exp: number;
|
|
50
|
+
}
|
|
51
|
+
/** Controller fence: routes below this generation, or below this route epoch within it, are refused. */
|
|
52
|
+
export interface LiveFenceClaims {
|
|
53
|
+
v: 1;
|
|
54
|
+
kid: string;
|
|
55
|
+
artifactId: string;
|
|
56
|
+
generation: number;
|
|
57
|
+
routeEpoch: number;
|
|
58
|
+
iat: number;
|
|
59
|
+
exp: number;
|
|
60
|
+
}
|
|
61
|
+
export interface VerifyOptions {
|
|
62
|
+
key(kid: string): Uint8Array | undefined;
|
|
63
|
+
now(): number;
|
|
64
|
+
}
|
|
65
|
+
export declare function signLiveAssertion(claims: LiveAssertionClaims, key: Uint8Array): string;
|
|
66
|
+
export declare const signLiveControl: (claims: LiveControlClaims, key: Uint8Array) => string;
|
|
67
|
+
export declare const signLiveFence: (claims: LiveFenceClaims, key: Uint8Array) => string;
|
|
68
|
+
export declare function verifyLiveAssertion(token: string, options: VerifyOptions): LiveAssertionClaims | undefined;
|
|
69
|
+
export declare function verifyLiveControl(token: string, options: VerifyOptions): LiveControlClaims | undefined;
|
|
70
|
+
export declare function verifyLiveFence(token: string, options: VerifyOptions): LiveFenceClaims | undefined;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* A-LIVE §8.2 live edge wire format (W9 / M4-E), pure and dependency-free so the host (immo), the controller
|
|
4
|
+
* (Sentropic API) and `artifact-content` sign and verify with the same code. Three HMAC-SHA256 message kinds, each
|
|
5
|
+
* with its own MAC-bound prefix so none can be replayed as another:
|
|
6
|
+
* - `v1` host assertion (immo → artifact-content), on every live request and websocket upgrade;
|
|
7
|
+
* - `c1` host control (immo → artifact-content): session or invitation revocation;
|
|
8
|
+
* - `f1` controller fence (Sentropic API → artifact-content): generation and route-epoch floor.
|
|
9
|
+
*/
|
|
10
|
+
export const ASSERTION_HEADER = 'x-live-host-assertion';
|
|
11
|
+
export const CONTROL_HEADER = 'x-live-host-control';
|
|
12
|
+
export const FENCE_HEADER = 'x-live-controller-fence';
|
|
13
|
+
export const MIN_KEY_BYTES = 32;
|
|
14
|
+
export const MAX_ASSERTION_SECONDS = 3600;
|
|
15
|
+
export const MAX_CONTROL_SECONDS = 300;
|
|
16
|
+
export const MAX_SKEW_SECONDS = 30;
|
|
17
|
+
/** The live source revision is an opaque string (A-LIVE live revisions), compared, never parsed. */
|
|
18
|
+
export const MAX_SOURCE_REVISION_LENGTH = 256;
|
|
19
|
+
const revision = (value) => typeof value === 'string' && value.length >= 1 && value.length <= MAX_SOURCE_REVISION_LENGTH;
|
|
20
|
+
const ASSERTION_FIELDS = {
|
|
21
|
+
v: 'number', kid: 'string', host: 'string', artifactId: 'string', storageScopeId: 'string', sessionId: 'string',
|
|
22
|
+
generation: 'number', routeEpoch: 'number', podUid: 'string', podName: 'string', sourceRevision: 'string',
|
|
23
|
+
principalId: 'string', role: 'string', invitationId: 'string', invitationEpoch: 'number', invitationExp: 'number', iat: 'number', exp: 'number',
|
|
24
|
+
};
|
|
25
|
+
const CONTROL_FIELDS = {
|
|
26
|
+
v: 'number', kid: 'string', host: 'string', artifactId: 'string', op: 'string', sessionId: 'string',
|
|
27
|
+
invitationId: 'string', epoch: 'number', iat: 'number', exp: 'number',
|
|
28
|
+
};
|
|
29
|
+
const FENCE_FIELDS = {
|
|
30
|
+
v: 'number', kid: 'string', artifactId: 'string', generation: 'number', routeEpoch: 'number', iat: 'number', exp: 'number',
|
|
31
|
+
};
|
|
32
|
+
const mac = (key, prefix, body) => createHmac('sha256', key).update(`${prefix}.${body}`).digest();
|
|
33
|
+
function sign(prefix, claims, key) {
|
|
34
|
+
if (key.length < MIN_KEY_BYTES)
|
|
35
|
+
throw new Error('Live key must contain at least 32 bytes');
|
|
36
|
+
const body = Buffer.from(JSON.stringify(claims)).toString('base64url');
|
|
37
|
+
return `${prefix}.${body}.${mac(key, prefix, body).toString('base64url')}`;
|
|
38
|
+
}
|
|
39
|
+
function verify(prefix, fields, maxSeconds, token, options) {
|
|
40
|
+
const parts = token.split('.');
|
|
41
|
+
if (parts.length !== 3 || parts[0] !== prefix || token.length > 2048)
|
|
42
|
+
return;
|
|
43
|
+
let claims;
|
|
44
|
+
try {
|
|
45
|
+
claims = JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf8'));
|
|
46
|
+
if (!claims || typeof claims !== 'object' || claims.v !== 1
|
|
47
|
+
|| Object.keys(claims).sort().join() !== Object.keys(fields).sort().join()
|
|
48
|
+
|| Object.entries(fields).some(([name, type]) => {
|
|
49
|
+
const value = claims[name];
|
|
50
|
+
return typeof value !== type || (type === 'number' && (!Number.isSafeInteger(value) || value < 0));
|
|
51
|
+
}))
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const key = options.key(claims.kid);
|
|
58
|
+
if (!key || key.length < MIN_KEY_BYTES)
|
|
59
|
+
return;
|
|
60
|
+
const given = Buffer.from(parts[2], 'base64url');
|
|
61
|
+
const expected = mac(key, prefix, parts[1]);
|
|
62
|
+
if (given.length !== expected.length || !timingSafeEqual(given, expected))
|
|
63
|
+
return;
|
|
64
|
+
const now = options.now() / 1000;
|
|
65
|
+
if (claims.exp <= now || claims.iat > now + MAX_SKEW_SECONDS || claims.exp - claims.iat > maxSeconds)
|
|
66
|
+
return;
|
|
67
|
+
return claims;
|
|
68
|
+
}
|
|
69
|
+
const ID = /^[A-Za-z0-9_-]{1,128}$/;
|
|
70
|
+
/** Owner claims carry no invitation; an invitee claim must name a live invitation that outlasts the assertion. */
|
|
71
|
+
function validRole(c, now) {
|
|
72
|
+
if (c.role === 'binding_owner')
|
|
73
|
+
return c.invitationId === '' && c.invitationEpoch === 0 && c.invitationExp === 0;
|
|
74
|
+
return c.role === 'invitee' && ID.test(c.invitationId) && c.invitationEpoch >= 1
|
|
75
|
+
&& c.invitationExp > now && c.exp <= c.invitationExp;
|
|
76
|
+
}
|
|
77
|
+
function validControl(c) {
|
|
78
|
+
if (c.op === 'revoke_session')
|
|
79
|
+
return ID.test(c.sessionId) && c.invitationId === '' && c.epoch === 0;
|
|
80
|
+
return c.op === 'revoke_invitation' && ID.test(c.invitationId) && c.epoch >= 1 && c.sessionId === '';
|
|
81
|
+
}
|
|
82
|
+
export function signLiveAssertion(claims, key) {
|
|
83
|
+
if (!revision(claims.sourceRevision))
|
|
84
|
+
throw new TypeError('Live source revision must be a string of 1 to 256 characters');
|
|
85
|
+
return sign('v1', claims, key);
|
|
86
|
+
}
|
|
87
|
+
export const signLiveControl = (claims, key) => sign('c1', claims, key);
|
|
88
|
+
export const signLiveFence = (claims, key) => sign('f1', claims, key);
|
|
89
|
+
export function verifyLiveAssertion(token, options) {
|
|
90
|
+
const claims = verify('v1', ASSERTION_FIELDS, MAX_ASSERTION_SECONDS, token, options);
|
|
91
|
+
return claims && revision(claims.sourceRevision) && validRole(claims, options.now() / 1000) ? claims : undefined;
|
|
92
|
+
}
|
|
93
|
+
export function verifyLiveControl(token, options) {
|
|
94
|
+
const claims = verify('c1', CONTROL_FIELDS, MAX_CONTROL_SECONDS, token, options);
|
|
95
|
+
return claims && validControl(claims) ? claims : undefined;
|
|
96
|
+
}
|
|
97
|
+
export function verifyLiveFence(token, options) {
|
|
98
|
+
const claims = verify('f1', FENCE_FIELDS, MAX_CONTROL_SECONDS, token, options);
|
|
99
|
+
return claims && claims.generation >= 1 ? claims : undefined;
|
|
100
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { HandoffClaims } from './handoff.js';
|
|
2
|
+
/** Host state read INSIDE the host publication transaction, on the locked binding and job rows (A-LIVE §8.3). */
|
|
3
|
+
export interface AttemptFence {
|
|
4
|
+
runId: string;
|
|
5
|
+
attempt: number;
|
|
6
|
+
}
|
|
7
|
+
export interface HostRecheckView {
|
|
8
|
+
/** Authenticated host scope; never taken from the handoff. */
|
|
9
|
+
scopeId: string;
|
|
10
|
+
/** Operator pause or kill switch for sandbox publication. */
|
|
11
|
+
killSwitch: boolean;
|
|
12
|
+
/** Exact builder image digest strings (A-LIVE §8.1). */
|
|
13
|
+
imageAllowlist: readonly string[];
|
|
14
|
+
currentReleaseId: string | null;
|
|
15
|
+
/** The required head is reachable on the bound branch, observed in this transaction. */
|
|
16
|
+
headReachable: boolean;
|
|
17
|
+
binding: {
|
|
18
|
+
artifactId: string;
|
|
19
|
+
state: string;
|
|
20
|
+
generation: number;
|
|
21
|
+
executor: string;
|
|
22
|
+
autoPublish: boolean;
|
|
23
|
+
pendingJobId: string | null;
|
|
24
|
+
pendingCommitSha: string | null;
|
|
25
|
+
};
|
|
26
|
+
/** The persisted G0 v3 §2.6 job; `fence` is the attempt last admitted by `resolvePendingJob`. */
|
|
27
|
+
job: {
|
|
28
|
+
jobId: string;
|
|
29
|
+
state: string;
|
|
30
|
+
bindingGeneration: number;
|
|
31
|
+
commitSha: string;
|
|
32
|
+
expectedCurrentReleaseId: string | null;
|
|
33
|
+
fence: AttemptFence | null;
|
|
34
|
+
} | undefined;
|
|
35
|
+
/** Current owner/code rights and host write scope; the automatic policy and the §5.3.1 progress predicate or the
|
|
36
|
+
* separately recorded initial exception. */
|
|
37
|
+
policy: {
|
|
38
|
+
ownerAuthorized: boolean;
|
|
39
|
+
automaticAuthorized: boolean;
|
|
40
|
+
automaticEligible: boolean;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export declare const RECHECK_REFUSALS: readonly ["scope_mismatch", "publication_paused", "generation_mismatch", "job_not_pending", "attempt_fenced", "policy_refused", "head_unreachable", "release_conflict", "image_not_allowed"];
|
|
44
|
+
export type RecheckRefusal = typeof RECHECK_REFUSALS[number];
|
|
45
|
+
/** The host job the builder may build (A-LIVE §8.4 server-resolved commit), from `resolvePendingJob`. */
|
|
46
|
+
export interface HostJob {
|
|
47
|
+
jobId: string;
|
|
48
|
+
generation: number;
|
|
49
|
+
headSha: string;
|
|
50
|
+
expectedReleaseId: string | null;
|
|
51
|
+
}
|
|
52
|
+
/** Every §8.3 final recheck, in order; null admits. acceptHandoff applies it; the host only supplies the view. */
|
|
53
|
+
export declare function publicationRecheck(view: HostRecheckView, claims: HandoffClaims): RecheckRefusal | null;
|
|
54
|
+
/** Host side of the builder's job resolution: only the binding's pending job at its generation, never a caller SHA.
|
|
55
|
+
* The attempt fence is monotonic; the host persists the returned fence on the job in the same transaction. */
|
|
56
|
+
export declare function resolvePendingJob(view: HostRecheckView, jobId: string, fence: AttemptFence): {
|
|
57
|
+
job: HostJob;
|
|
58
|
+
fence: AttemptFence;
|
|
59
|
+
} | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const RECHECK_REFUSALS = ['scope_mismatch', 'publication_paused', 'generation_mismatch', 'job_not_pending',
|
|
2
|
+
'attempt_fenced', 'policy_refused', 'head_unreachable', 'release_conflict', 'image_not_allowed'];
|
|
3
|
+
function pending(view, jobId, generation) {
|
|
4
|
+
const { binding, job } = view;
|
|
5
|
+
return job !== undefined && ['build_pending', 'building'].includes(job.state) && binding.state === 'build_pending'
|
|
6
|
+
&& binding.executor === 'sandbox' && binding.pendingJobId === jobId && job.jobId === jobId
|
|
7
|
+
&& binding.generation === generation && job.bindingGeneration === generation
|
|
8
|
+
&& binding.pendingCommitSha === job.commitSha ? job : undefined;
|
|
9
|
+
}
|
|
10
|
+
/** Every §8.3 final recheck, in order; null admits. acceptHandoff applies it; the host only supplies the view. */
|
|
11
|
+
export function publicationRecheck(view, claims) {
|
|
12
|
+
if (claims.scopeId !== view.scopeId || claims.artifactId !== view.binding.artifactId)
|
|
13
|
+
return 'scope_mismatch';
|
|
14
|
+
if (view.killSwitch || view.binding.state === 'paused')
|
|
15
|
+
return 'publication_paused';
|
|
16
|
+
if (claims.generation !== view.binding.generation)
|
|
17
|
+
return 'generation_mismatch';
|
|
18
|
+
const job = pending(view, claims.jobId, claims.generation);
|
|
19
|
+
if (!job || job.commitSha !== claims.commitSha)
|
|
20
|
+
return 'job_not_pending';
|
|
21
|
+
if (job.fence?.runId !== claims.runId || job.fence.attempt !== claims.attempt)
|
|
22
|
+
return 'attempt_fenced';
|
|
23
|
+
if (claims.kind === 'explicit' ? view.policy.ownerAuthorized !== true
|
|
24
|
+
: !(view.binding.autoPublish === true && view.policy.automaticAuthorized === true && view.policy.automaticEligible === true)) {
|
|
25
|
+
return 'policy_refused';
|
|
26
|
+
}
|
|
27
|
+
if (view.headReachable !== true)
|
|
28
|
+
return 'head_unreachable';
|
|
29
|
+
if (claims.expectedReleaseId !== job.expectedCurrentReleaseId || view.currentReleaseId !== job.expectedCurrentReleaseId)
|
|
30
|
+
return 'release_conflict';
|
|
31
|
+
if (!view.imageAllowlist.includes(claims.tuple.builderImageDigest))
|
|
32
|
+
return 'image_not_allowed';
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
/** Host side of the builder's job resolution: only the binding's pending job at its generation, never a caller SHA.
|
|
36
|
+
* The attempt fence is monotonic; the host persists the returned fence on the job in the same transaction. */
|
|
37
|
+
export function resolvePendingJob(view, jobId, fence) {
|
|
38
|
+
const job = pending(view, jobId, view.binding.generation);
|
|
39
|
+
if (!job || typeof fence?.runId !== 'string' || !fence.runId || !Number.isSafeInteger(fence.attempt) || fence.attempt < 1
|
|
40
|
+
|| (job.fence && (fence.attempt < job.fence.attempt || (fence.attempt === job.fence.attempt && fence.runId !== job.fence.runId)))) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return { job: { jobId, generation: job.bindingGeneration, headSha: job.commitSha, expectedReleaseId: job.expectedCurrentReleaseId },
|
|
44
|
+
fence: { runId: fence.runId, attempt: fence.attempt } };
|
|
45
|
+
}
|
package/dist/mcp-core.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { createRadarKeyDerivation } from './server/command-identity.js';
|
|
|
10
10
|
export type { ArtifactKeyDerivationBinding } from './server/command-identity.js';
|
|
11
11
|
export declare const ARTIFACTS_PROVIDER_ID = "sentropic.artifacts";
|
|
12
12
|
export declare const ARTIFACTS_APP_ID = "sentropic-artifacts";
|
|
13
|
-
export declare const ARTIFACTS_PROVIDER_VERSION = "0.2.
|
|
13
|
+
export declare const ARTIFACTS_PROVIDER_VERSION = "0.2.21";
|
|
14
14
|
export declare const ARTIFACTS_TOOL_NAMES: readonly ["artifacts_get_template", "artifacts_get_api_guide", "artifacts_ensure", "artifacts_publish", "artifacts_create_upload", "artifacts_commit_upload", "artifacts_list", "artifacts_get", "artifacts_get_source", "artifacts_fork", "artifacts_set_access", "artifacts_promote", "artifacts_renew", "artifacts_delete", "artifacts_restore", "artifacts_list_versions", "artifacts_revert", "artifacts_lookup_people", "artifacts_list_access", "artifacts_publish_bundle", "artifacts_revoke_reader_consent", "artifacts_create_upload_page", "artifacts_list_assets", "artifacts_publish_bundle_v2", "artifacts_list_app_sources", "artifacts_fetch_app_source", "artifacts_git_attach", "artifacts_git_commit", "artifacts_git_publish", "artifacts_git_live", "artifacts_live_write", "artifacts_live_read", "artifacts_live_reset", "artifacts_live_status", "artifacts_live_control"];
|
|
15
15
|
export type ArtifactsToolName = (typeof ARTIFACTS_TOOL_NAMES)[number];
|
|
16
16
|
export interface ArtifactsToolDefinition {
|
package/dist/mcp-core.js
CHANGED
|
@@ -7,7 +7,7 @@ export * from './profile/index.js';
|
|
|
7
7
|
export { createRadarKeyDerivation } from './server/command-identity.js';
|
|
8
8
|
export const ARTIFACTS_PROVIDER_ID = 'sentropic.artifacts';
|
|
9
9
|
export const ARTIFACTS_APP_ID = 'sentropic-artifacts';
|
|
10
|
-
export const ARTIFACTS_PROVIDER_VERSION = '0.2.
|
|
10
|
+
export const ARTIFACTS_PROVIDER_VERSION = '0.2.21';
|
|
11
11
|
export const ARTIFACTS_TOOL_NAMES = ARTIFACT_CAPABILITY_NAMES;
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
13
|
// Byte-stable tool definitions (MCP tool-definition stability rule).
|
|
@@ -219,6 +219,9 @@ export function createArtifactsToolExecutor(deps) {
|
|
|
219
219
|
case 'artifacts_live_status':
|
|
220
220
|
case 'artifacts_live_control':
|
|
221
221
|
case 'artifacts_git_commit':
|
|
222
|
+
case 'artifacts_fetch_app_source':
|
|
223
|
+
case 'artifacts_git_attach':
|
|
224
|
+
case 'artifacts_git_publish':
|
|
222
225
|
request = { method: 'POST', path: '/' + input.tool.slice(10), body: args };
|
|
223
226
|
break;
|
|
224
227
|
case 'artifacts_ensure':
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { type HostIntegrityMap } from './build-integrity.js';
|
|
2
|
+
/** Named GB1 port for the supervisor (W3) and the builder service (W7); one public subpath. */
|
|
3
|
+
export { approvedIntegrity, hostIntegrityMapDigest, lockfileSha256, type DependencyIntegrityInventory, type DependencyIntegrityRecord, type HostIntegrityMap, type HostIntegrityMapEntry, } from './build-integrity.js';
|
|
4
|
+
export type { BuildDependencyEvidence, ScriptQualificationRecord } from './build-dependencies.js';
|
|
5
|
+
export { validateBuildOutput, type AdmittedOutputFile, type BuildOutputEntry } from './build-output.js';
|
|
6
|
+
export { candidateInventoryDigest, verifyBuilderReceipt, verifyServedCandidate, type BuilderAttestedEvidence, type BuilderReceiptExpectation, type BuilderReceiptMismatch, type CandidateFileDigest, } from './build-receipt.js';
|
|
1
7
|
/** Frozen G0 v3 §4.1 fields. Install permissions belong to the host. */
|
|
2
8
|
export interface ArtifactBuildDescriptor {
|
|
3
9
|
readonly version: 1;
|
|
@@ -17,6 +23,10 @@ export interface ArtifactBuildSnapshot {
|
|
|
17
23
|
readonly subPath: string;
|
|
18
24
|
readonly files: Readonly<Record<string, string>>;
|
|
19
25
|
readonly postinstallAllowlist?: readonly PostinstallAllowlistEntry[];
|
|
26
|
+
/** Host qualification rows for disabled hooks (A-LIVE §7.3); never an execution grant. */
|
|
27
|
+
readonly scriptQualification?: readonly PostinstallAllowlistEntry[];
|
|
28
|
+
/** Host-sealed integrity map for entries lacking literal SRI (A-LIVE §7.2). */
|
|
29
|
+
readonly integrityMap?: HostIntegrityMap;
|
|
20
30
|
readonly allowedRegistries?: readonly string[];
|
|
21
31
|
}
|
|
22
32
|
export interface ArtifactBuildTuple {
|
|
@@ -49,7 +59,12 @@ export declare function buildJson(text: string | undefined): Record<string, unkn
|
|
|
49
59
|
export declare function buildPath(value: unknown): value is string;
|
|
50
60
|
/** Validation only: no filesystem, network, install, shell or script execution. */
|
|
51
61
|
export declare function validateArtifactBuild(snapshot: ArtifactBuildSnapshot): {
|
|
62
|
+
readonly postinstall: readonly PostinstallAllowlistEntry[];
|
|
63
|
+
readonly scriptQualification: readonly import("./build-dependencies.js").ScriptQualificationRecord[];
|
|
64
|
+
readonly integrity: import("./build-integrity.js").DependencyIntegrityInventory;
|
|
52
65
|
readonly descriptor: ArtifactBuildDescriptor;
|
|
66
|
+
readonly descriptorDigest: string;
|
|
67
|
+
readonly lockfileDigest: string;
|
|
53
68
|
readonly installDirectory: string;
|
|
54
69
|
readonly scriptDirectory: string;
|
|
55
70
|
readonly install: {
|
|
@@ -60,5 +75,4 @@ export declare function validateArtifactBuild(snapshot: ArtifactBuildSnapshot):
|
|
|
60
75
|
readonly command: "npm";
|
|
61
76
|
readonly args: readonly ["run", string];
|
|
62
77
|
};
|
|
63
|
-
readonly postinstall: readonly PostinstallAllowlistEntry[];
|
|
64
78
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ArtifactOperationError } from './failures.js';
|
|
2
2
|
import { validateBuildDependencies } from './build-dependencies.js';
|
|
3
|
+
import { lockfileSha256, sha256Hex } from './build-integrity.js';
|
|
4
|
+
/** Named GB1 port for the supervisor (W3) and the builder service (W7); one public subpath. */
|
|
5
|
+
export { approvedIntegrity, hostIntegrityMapDigest, lockfileSha256, } from './build-integrity.js';
|
|
6
|
+
export { validateBuildOutput } from './build-output.js';
|
|
7
|
+
export { candidateInventoryDigest, verifyBuilderReceipt, verifyServedCandidate, } from './build-receipt.js';
|
|
3
8
|
export function buildRecord(value) {
|
|
4
9
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
5
10
|
}
|
|
@@ -23,7 +28,8 @@ export function validateArtifactBuild(snapshot) {
|
|
|
23
28
|
const invalid = () => { throw new ArtifactOperationError('build_descriptor_invalid'); };
|
|
24
29
|
if (snapshot.subPath !== '' && !buildPath(snapshot.subPath))
|
|
25
30
|
invalid();
|
|
26
|
-
const
|
|
31
|
+
const descriptorText = snapshot.files[join(snapshot.subPath, 'sentropic.artifact.json')];
|
|
32
|
+
const value = buildJson(descriptorText);
|
|
27
33
|
const fields = ['version', 'buildScript', 'outputDir', 'lockfilePath', 'entry', 'publicEnvNames'];
|
|
28
34
|
if (Object.keys(value).some(key => !fields.includes(key)) || value.version !== 1
|
|
29
35
|
|| typeof value.buildScript !== 'string' || !/^[A-Za-z0-9:_-]+$/.test(value.buildScript)
|
|
@@ -42,17 +48,20 @@ export function validateArtifactBuild(snapshot) {
|
|
|
42
48
|
throw new ArtifactOperationError('build_script_missing');
|
|
43
49
|
if (!Object.hasOwn(snapshot.files, descriptor.lockfilePath))
|
|
44
50
|
throw new ArtifactOperationError('lock_missing');
|
|
45
|
-
const
|
|
51
|
+
const lockText = snapshot.files[descriptor.lockfilePath];
|
|
52
|
+
const lock = buildJson(lockText);
|
|
46
53
|
const installDirectory = descriptor.lockfilePath.includes('/')
|
|
47
54
|
? descriptor.lockfilePath.slice(0, descriptor.lockfilePath.lastIndexOf('/')) : '';
|
|
48
55
|
if (installDirectory && snapshot.subPath !== installDirectory
|
|
49
56
|
&& !snapshot.subPath.startsWith(`${installDirectory}/`))
|
|
50
57
|
invalid();
|
|
51
|
-
const
|
|
58
|
+
const lockfileDigest = lockfileSha256(lockText);
|
|
59
|
+
const evidence = validateBuildDependencies(snapshot, lock, installDirectory, lockfileDigest);
|
|
52
60
|
return {
|
|
53
|
-
descriptor,
|
|
61
|
+
descriptor, descriptorDigest: sha256Hex(descriptorText), lockfileDigest,
|
|
62
|
+
installDirectory, scriptDirectory: snapshot.subPath,
|
|
54
63
|
install: { command: 'npm', args: ['ci', '--ignore-scripts'] },
|
|
55
64
|
build: { command: 'npm', args: ['run', descriptor.buildScript] },
|
|
56
|
-
|
|
65
|
+
...evidence,
|
|
57
66
|
};
|
|
58
67
|
}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import type { ArtifactBuildSnapshot, PostinstallAllowlistEntry } from './build-contract.js';
|
|
2
|
+
import { type DependencyIntegrityInventory } from './build-integrity.js';
|
|
3
|
+
/** A-LIVE §7.3 host qualification row: literal lockfile SRI only; disabled rows never authorize execution. */
|
|
4
|
+
export interface ScriptQualificationRecord extends PostinstallAllowlistEntry {
|
|
5
|
+
readonly source: 'lockfile';
|
|
6
|
+
readonly execution: 'disabled' | 'allowlisted';
|
|
7
|
+
}
|
|
8
|
+
export interface BuildDependencyEvidence {
|
|
9
|
+
readonly postinstall: readonly PostinstallAllowlistEntry[];
|
|
10
|
+
readonly scriptQualification: readonly ScriptQualificationRecord[];
|
|
11
|
+
readonly integrity: DependencyIntegrityInventory;
|
|
12
|
+
}
|
|
2
13
|
/** Validate the lock-indexed install closure, including host-owned lifecycle permissions. */
|
|
3
|
-
export declare function validateBuildDependencies(snapshot: ArtifactBuildSnapshot, lock: Record<string, unknown>, installDirectory: string):
|
|
14
|
+
export declare function validateBuildDependencies(snapshot: ArtifactBuildSnapshot, lock: Record<string, unknown>, installDirectory: string, lockfileDigest: string): BuildDependencyEvidence;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ArtifactOperationError } from './failures.js';
|
|
2
2
|
import { buildJson, buildPath, buildRecord } from './build-contract.js';
|
|
3
|
+
import { dependencyIntegrity } from './build-integrity.js';
|
|
3
4
|
const sections = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
|
|
4
5
|
function refuse() { throw new ArtifactOperationError('dep_outside_lock'); }
|
|
6
|
+
const SEMVER = /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?(?:\+[A-Za-z0-9.-]+)?$/;
|
|
5
7
|
function registryUrl(value, registries) {
|
|
6
8
|
if (typeof value !== 'string')
|
|
7
9
|
return false;
|
|
@@ -25,7 +27,7 @@ function registrySpec(value) {
|
|
|
25
27
|
return /^[A-Za-z0-9~^*<>=| .+-]+$/.test(alias ? alias[1] : value);
|
|
26
28
|
}
|
|
27
29
|
/** Validate the lock-indexed install closure, including host-owned lifecycle permissions. */
|
|
28
|
-
export function validateBuildDependencies(snapshot, lock, installDirectory) {
|
|
30
|
+
export function validateBuildDependencies(snapshot, lock, installDirectory, lockfileDigest) {
|
|
29
31
|
if ((lock.lockfileVersion !== 2 && lock.lockfileVersion !== 3) || !buildRecord(lock.packages)
|
|
30
32
|
|| !buildRecord(lock.packages['']))
|
|
31
33
|
throw new ArtifactOperationError('build_descriptor_invalid');
|
|
@@ -42,7 +44,10 @@ export function validateBuildDependencies(snapshot, lock, installDirectory) {
|
|
|
42
44
|
};
|
|
43
45
|
const registries = snapshot.allowedRegistries ?? ['https://registry.npmjs.org/'];
|
|
44
46
|
const allowlist = snapshot.postinstallAllowlist ?? [];
|
|
47
|
+
const qualified = snapshot.scriptQualification ?? [];
|
|
45
48
|
const postinstall = [];
|
|
49
|
+
const scriptQualification = [];
|
|
50
|
+
const lockName = (path, raw) => typeof raw.name === 'string' ? raw.name : path.split('node_modules/').at(-1);
|
|
46
51
|
const repositoryPath = (path) => installDirectory ? `${installDirectory}/${path}` : path;
|
|
47
52
|
const workspaceTargets = new Set();
|
|
48
53
|
for (const [path, raw] of Object.entries(packages)) {
|
|
@@ -60,18 +65,33 @@ export function validateBuildDependencies(snapshot, lock, installDirectory) {
|
|
|
60
65
|
refuse();
|
|
61
66
|
}
|
|
62
67
|
}
|
|
68
|
+
const remote = [];
|
|
69
|
+
for (const [path, raw] of Object.entries(packages)) {
|
|
70
|
+
if (!buildRecord(raw) || raw.link === true || path === '' || workspaceTargets.has(path))
|
|
71
|
+
continue;
|
|
72
|
+
const name = lockName(path, raw);
|
|
73
|
+
if ((raw.resolved !== undefined && !registryUrl(raw.resolved, registries)) || typeof name !== 'string'
|
|
74
|
+
|| typeof raw.version !== 'string' || !SEMVER.test(raw.version))
|
|
75
|
+
refuse();
|
|
76
|
+
remote.push({ path, name, version: raw.version, resolved: raw.resolved, integrity: raw.integrity });
|
|
77
|
+
}
|
|
78
|
+
// Every remote byte sequence is covered before any dependency or script rule admits the lock.
|
|
79
|
+
const integrity = dependencyIntegrity(remote, lockfileDigest, snapshot.integrityMap, value => registryUrl(value, registries));
|
|
80
|
+
const evidence = new Map(integrity.entries.map(entry => [entry.path, entry]));
|
|
63
81
|
for (const [path, raw] of Object.entries(packages)) {
|
|
64
82
|
if (!buildRecord(raw))
|
|
65
83
|
refuse();
|
|
66
84
|
if (raw.link === true)
|
|
67
85
|
continue;
|
|
68
86
|
const local = path === '' || workspaceTargets.has(path);
|
|
69
|
-
if (!local && (!registryUrl(raw.resolved, registries) || typeof raw.version !== 'string'
|
|
70
|
-
|| !/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?(?:\+[A-Za-z0-9.-]+)?$/.test(raw.version)
|
|
71
|
-
|| typeof raw.integrity !== 'string' || !raw.integrity))
|
|
72
|
-
refuse();
|
|
73
87
|
const manifestPath = repositoryPath(path ? `${path}/package.json` : 'package.json');
|
|
74
88
|
const manifest = local ? buildJson(snapshot.files[manifestPath]) : raw;
|
|
89
|
+
// Bundled dependencies ship inside the locked tarball, whose verified integrity covers their bytes.
|
|
90
|
+
const bundle = local ? undefined : raw.bundleDependencies;
|
|
91
|
+
if (bundle !== undefined && bundle !== true
|
|
92
|
+
&& (!Array.isArray(bundle) || bundle.some(name => typeof name !== 'string')))
|
|
93
|
+
refuse();
|
|
94
|
+
const bundled = (name) => bundle === true || (Array.isArray(bundle) && bundle.includes(name));
|
|
75
95
|
for (const source of [raw, manifest]) {
|
|
76
96
|
for (const section of sections) {
|
|
77
97
|
const dependencies = source[section];
|
|
@@ -83,7 +103,7 @@ export function validateBuildDependencies(snapshot, lock, installDirectory) {
|
|
|
83
103
|
if (!registrySpec(spec) || !/^(?:@[A-Za-z0-9._-]+\/)?[A-Za-z0-9._-]+$/.test(name))
|
|
84
104
|
refuse();
|
|
85
105
|
if ((section === 'dependencies' || (local && section === 'devDependencies'))
|
|
86
|
-
&& !lockedPackage(path, name))
|
|
106
|
+
&& !(section === 'dependencies' && bundled(name)) && !lockedPackage(path, name))
|
|
87
107
|
refuse();
|
|
88
108
|
}
|
|
89
109
|
}
|
|
@@ -106,17 +126,25 @@ export function validateBuildDependencies(snapshot, lock, installDirectory) {
|
|
|
106
126
|
|| ['preinstall', 'install', 'postinstall', 'prepare'].some(name => Object.hasOwn(scripts, name));
|
|
107
127
|
if (!hasScript)
|
|
108
128
|
continue;
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
129
|
+
// Only a literal lockfile SRI can close the exact G0 triple; a host-map value never qualifies (A-LIVE §7.3).
|
|
130
|
+
const record = evidence.get(path);
|
|
131
|
+
const entry = { package: local ? manifest.name : lockName(path, raw), version: raw.version,
|
|
132
|
+
integrity: record?.source === 'lockfile' ? record.integrity : undefined };
|
|
133
|
+
if (typeof entry.package !== 'string' || typeof entry.version !== 'string' || entry.integrity === undefined) {
|
|
114
134
|
throw new ArtifactOperationError('install_script_not_allowlisted');
|
|
115
135
|
}
|
|
116
|
-
|
|
136
|
+
const triple = { package: entry.package, version: entry.version, integrity: entry.integrity };
|
|
137
|
+
const same = (row) => row.package === triple.package
|
|
138
|
+
&& row.version === triple.version && row.integrity === triple.integrity;
|
|
139
|
+
const execution = allowlist.some(same) ? 'allowlisted' : qualified.some(same) ? 'disabled' : undefined;
|
|
140
|
+
if (execution === undefined)
|
|
141
|
+
throw new ArtifactOperationError('install_script_not_allowlisted');
|
|
142
|
+
if (execution === 'allowlisted')
|
|
143
|
+
postinstall.push(triple);
|
|
144
|
+
scriptQualification.push({ ...triple, source: 'lockfile', execution });
|
|
117
145
|
}
|
|
118
146
|
const scriptKey = snapshot.subPath.slice(installDirectory ? installDirectory.length + 1 : 0);
|
|
119
147
|
if (scriptKey && !workspaceTargets.has(scriptKey))
|
|
120
148
|
refuse();
|
|
121
|
-
return postinstall;
|
|
149
|
+
return { postinstall, scriptQualification, integrity };
|
|
122
150
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** A-LIVE §7.2: host-sealed value for one lock entry; never supplied by the branch or the cache. */
|
|
2
|
+
export interface HostIntegrityMapEntry {
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly version: string;
|
|
6
|
+
readonly registryUrl: string;
|
|
7
|
+
readonly integrity: string;
|
|
8
|
+
}
|
|
9
|
+
/** Immutable host map tied to the exact lock bytes; the host authenticates its seal before use. */
|
|
10
|
+
export interface HostIntegrityMap {
|
|
11
|
+
readonly lockfileDigest: string;
|
|
12
|
+
readonly entries: readonly HostIntegrityMapEntry[];
|
|
13
|
+
}
|
|
14
|
+
/** Remote lock entry fields the coverage rule reads; `resolved` is already an approved URL. */
|
|
15
|
+
export interface RemoteLockEntry {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly version: string;
|
|
19
|
+
readonly resolved?: string;
|
|
20
|
+
readonly integrity?: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface DependencyIntegrityRecord {
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly version: string;
|
|
26
|
+
readonly registryUrl: string;
|
|
27
|
+
readonly integrity: string;
|
|
28
|
+
readonly source: 'lockfile' | 'host_map';
|
|
29
|
+
}
|
|
30
|
+
/** Complete remote-package inventory; `mapDigest` binds the approved map into cache and build receipts. */
|
|
31
|
+
export interface DependencyIntegrityInventory {
|
|
32
|
+
readonly mapDigest: string | null;
|
|
33
|
+
readonly lockfileSri: number;
|
|
34
|
+
readonly hostMap: number;
|
|
35
|
+
readonly entries: readonly DependencyIntegrityRecord[];
|
|
36
|
+
}
|
|
37
|
+
export declare const sha256Hex: (text: string) => string;
|
|
38
|
+
/** SHA-256 of the exact lockfile text read at the pinned commit. */
|
|
39
|
+
export declare const lockfileSha256: (lockText: string) => string;
|
|
40
|
+
/** npm SRI carrying at least one SHA-256-or-stronger digest; SHA-1-only or malformed values never qualify. */
|
|
41
|
+
export declare function approvedIntegrity(value: unknown): value is string;
|
|
42
|
+
/** Canonical map digest: entries ordered by path, fixed field order. */
|
|
43
|
+
export declare function hostIntegrityMapDigest(map: HostIntegrityMap): string;
|
|
44
|
+
/**
|
|
45
|
+
* Cover every remote lock entry by literal lockfile SRI or the sealed host map, before any fetch.
|
|
46
|
+
* No trust on first use, no reuse across versions or paths, no SHA-1-only pin, no contradicting value.
|
|
47
|
+
*/
|
|
48
|
+
export declare function dependencyIntegrity(remote: readonly RemoteLockEntry[], lockfileDigest: string, map: HostIntegrityMap | undefined, approvedRegistryUrl: (url: unknown) => boolean): DependencyIntegrityInventory;
|