@dsh-enhanced/plugin-control-plane 0.1.31 → 0.1.34
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 +352 -4
- package/bin/dsh-local-release-adapter.js +80 -16
- package/bin/dsh-npm-registry-adapter.js +613 -0
- package/bin/dsh-source-adoption-authority.js +12 -0
- package/bin/dsh-source-approval-authority.js +16 -0
- package/bin/dsh-source-release-authority.js +12 -0
- package/bin/dsh-systemd-host-attestor.js +707 -0
- package/bin/dsh-task-observation-authority.js +15 -0
- package/lib/adapter-process.d.ts +23 -0
- package/lib/adapter-process.d.ts.map +1 -0
- package/lib/adapter-process.js +305 -0
- package/lib/adapter-process.js.map +1 -0
- package/lib/adoption-coordinator.d.ts +63 -0
- package/lib/adoption-coordinator.d.ts.map +1 -0
- package/lib/adoption-coordinator.js +241 -0
- package/lib/adoption-coordinator.js.map +1 -0
- package/lib/adoption-handoff.d.ts +16 -0
- package/lib/adoption-handoff.d.ts.map +1 -0
- package/lib/adoption-handoff.js +11 -0
- package/lib/adoption-handoff.js.map +1 -0
- package/lib/attestation.d.ts.map +1 -1
- package/lib/attestation.js +49 -1
- package/lib/attestation.js.map +1 -1
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +29 -2
- package/lib/catalog.js.map +1 -1
- package/lib/cli.d.ts +33 -9
- package/lib/cli.d.ts.map +1 -1
- package/lib/cli.js +624 -178
- package/lib/cli.js.map +1 -1
- package/lib/deployment-readiness.d.ts +38 -0
- package/lib/deployment-readiness.d.ts.map +1 -0
- package/lib/deployment-readiness.js +154 -0
- package/lib/deployment-readiness.js.map +1 -0
- package/lib/effect-blocked-replay.d.ts +81 -0
- package/lib/effect-blocked-replay.d.ts.map +1 -0
- package/lib/effect-blocked-replay.js +259 -0
- package/lib/effect-blocked-replay.js.map +1 -0
- package/lib/errors.d.ts +6 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +9 -0
- package/lib/errors.js.map +1 -0
- package/lib/foreground-deployment-runtime.d.ts +20 -0
- package/lib/foreground-deployment-runtime.d.ts.map +1 -0
- package/lib/foreground-deployment-runtime.js +79 -0
- package/lib/foreground-deployment-runtime.js.map +1 -0
- package/lib/foreground-deployment.d.ts +17 -0
- package/lib/foreground-deployment.d.ts.map +1 -0
- package/lib/foreground-deployment.js +43 -0
- package/lib/foreground-deployment.js.map +1 -0
- package/lib/host-attestor.d.ts +1 -1
- package/lib/host-attestor.d.ts.map +1 -1
- package/lib/host-attestor.js +51 -57
- package/lib/host-attestor.js.map +1 -1
- package/lib/index.d.ts +25 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -2
- package/lib/index.js.map +1 -1
- package/lib/npm-publish.d.ts +25 -0
- package/lib/npm-publish.d.ts.map +1 -0
- package/lib/npm-publish.js +280 -0
- package/lib/npm-publish.js.map +1 -0
- package/lib/owner-task-gap-types.d.ts +21 -0
- package/lib/owner-task-gap-types.d.ts.map +1 -0
- package/lib/owner-task-gap-types.js +2 -0
- package/lib/owner-task-gap-types.js.map +1 -0
- package/lib/owner-task-gaps.d.ts +24 -0
- package/lib/owner-task-gaps.d.ts.map +1 -0
- package/lib/owner-task-gaps.js +74 -0
- package/lib/owner-task-gaps.js.map +1 -0
- package/lib/post-activation.d.ts +33 -0
- package/lib/post-activation.d.ts.map +1 -0
- package/lib/post-activation.js +219 -0
- package/lib/post-activation.js.map +1 -0
- package/lib/registry-fetch.d.ts +50 -0
- package/lib/registry-fetch.d.ts.map +1 -0
- package/lib/registry-fetch.js +267 -0
- package/lib/registry-fetch.js.map +1 -0
- package/lib/release.d.ts +4 -4
- package/lib/release.d.ts.map +1 -1
- package/lib/release.js +142 -56
- package/lib/release.js.map +1 -1
- package/lib/replay-endpoint-protocol.d.ts +65 -0
- package/lib/replay-endpoint-protocol.d.ts.map +1 -0
- package/lib/replay-endpoint-protocol.js +183 -0
- package/lib/replay-endpoint-protocol.js.map +1 -0
- package/lib/replay-endpoint.d.ts +7 -0
- package/lib/replay-endpoint.d.ts.map +1 -0
- package/lib/replay-endpoint.js +193 -0
- package/lib/replay-endpoint.js.map +1 -0
- package/lib/replay-grant.d.ts +62 -0
- package/lib/replay-grant.d.ts.map +1 -0
- package/lib/replay-grant.js +208 -0
- package/lib/replay-grant.js.map +1 -0
- package/lib/replay-journal.d.ts +25 -0
- package/lib/replay-journal.d.ts.map +1 -0
- package/lib/replay-journal.js +275 -0
- package/lib/replay-journal.js.map +1 -0
- package/lib/runtime-observer-protocol.d.ts +63 -0
- package/lib/runtime-observer-protocol.d.ts.map +1 -0
- package/lib/runtime-observer-protocol.js +280 -0
- package/lib/runtime-observer-protocol.js.map +1 -0
- package/lib/runtime-observer.d.ts +8 -0
- package/lib/runtime-observer.d.ts.map +1 -0
- package/lib/runtime-observer.js +182 -0
- package/lib/runtime-observer.js.map +1 -0
- package/lib/service.d.ts +145 -1
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +734 -6
- package/lib/service.js.map +1 -1
- package/lib/source-adoption-authority.d.ts +65 -0
- package/lib/source-adoption-authority.d.ts.map +1 -0
- package/lib/source-adoption-authority.js +271 -0
- package/lib/source-adoption-authority.js.map +1 -0
- package/lib/source-adoption-runner.d.ts +28 -0
- package/lib/source-adoption-runner.d.ts.map +1 -0
- package/lib/source-adoption-runner.js +197 -0
- package/lib/source-adoption-runner.js.map +1 -0
- package/lib/source-approval-authority.d.ts +50 -0
- package/lib/source-approval-authority.d.ts.map +1 -0
- package/lib/source-approval-authority.js +412 -0
- package/lib/source-approval-authority.js.map +1 -0
- package/lib/source-approval-client.d.ts +32 -0
- package/lib/source-approval-client.d.ts.map +1 -0
- package/lib/source-approval-client.js +175 -0
- package/lib/source-approval-client.js.map +1 -0
- package/lib/source-build.d.ts +60 -0
- package/lib/source-build.d.ts.map +1 -0
- package/lib/source-build.js +311 -0
- package/lib/source-build.js.map +1 -0
- package/lib/source-context.d.ts +24 -0
- package/lib/source-context.d.ts.map +1 -0
- package/lib/source-context.js +99 -0
- package/lib/source-context.js.map +1 -0
- package/lib/source-job-types.d.ts +87 -0
- package/lib/source-job-types.d.ts.map +1 -0
- package/lib/source-job-types.js +2 -0
- package/lib/source-job-types.js.map +1 -0
- package/lib/source-jobs.d.ts +113 -0
- package/lib/source-jobs.d.ts.map +1 -0
- package/lib/source-jobs.js +535 -0
- package/lib/source-jobs.js.map +1 -0
- package/lib/source-release-authority.d.ts +35 -0
- package/lib/source-release-authority.d.ts.map +1 -0
- package/lib/source-release-authority.js +271 -0
- package/lib/source-release-authority.js.map +1 -0
- package/lib/source-release-client.d.ts +10 -0
- package/lib/source-release-client.d.ts.map +1 -0
- package/lib/source-release-client.js +24 -0
- package/lib/source-release-client.js.map +1 -0
- package/lib/source-release-runner.d.ts +31 -0
- package/lib/source-release-runner.d.ts.map +1 -0
- package/lib/source-release-runner.js +125 -0
- package/lib/source-release-runner.js.map +1 -0
- package/lib/source-versioning.d.ts +24 -0
- package/lib/source-versioning.d.ts.map +1 -0
- package/lib/source-versioning.js +213 -0
- package/lib/source-versioning.js.map +1 -0
- package/lib/source-workspace.d.ts +117 -0
- package/lib/source-workspace.d.ts.map +1 -0
- package/lib/source-workspace.js +458 -0
- package/lib/source-workspace.js.map +1 -0
- package/lib/sqlite.d.ts +1 -1
- package/lib/sqlite.d.ts.map +1 -1
- package/lib/sqlite.js +509 -7
- package/lib/sqlite.js.map +1 -1
- package/lib/store.d.ts +229 -6
- package/lib/store.d.ts.map +1 -1
- package/lib/store.js +2431 -383
- package/lib/store.js.map +1 -1
- package/lib/task-observation-authority.d.ts +29 -0
- package/lib/task-observation-authority.d.ts.map +1 -0
- package/lib/task-observation-authority.js +370 -0
- package/lib/task-observation-authority.js.map +1 -0
- package/lib/task-observation-client.d.ts +4 -0
- package/lib/task-observation-client.d.ts.map +1 -0
- package/lib/task-observation-client.js +20 -0
- package/lib/task-observation-client.js.map +1 -0
- package/lib/task-observation-runtime.d.ts +59 -0
- package/lib/task-observation-runtime.d.ts.map +1 -0
- package/lib/task-observation-runtime.js +331 -0
- package/lib/task-observation-runtime.js.map +1 -0
- package/lib/task-observation-store.d.ts +17 -0
- package/lib/task-observation-store.d.ts.map +1 -0
- package/lib/task-observation-store.js +115 -0
- package/lib/task-observation-store.js.map +1 -0
- package/lib/task-observation-types.d.ts +67 -0
- package/lib/task-observation-types.d.ts.map +1 -0
- package/lib/task-observation-types.js +2 -0
- package/lib/task-observation-types.js.map +1 -0
- package/lib/trust.d.ts +3 -0
- package/lib/trust.d.ts.map +1 -1
- package/lib/trust.js +0 -0
- package/lib/trust.js.map +1 -1
- package/lib/types.d.ts +275 -8
- package/lib/types.d.ts.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +40 -5
package/lib/host-attestor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
1
|
import { realpath } from 'node:fs/promises';
|
|
2
|
+
import { ControlledProcessError, executeControlledProcess } from './adapter-process.js';
|
|
3
3
|
import { parseHostAttestationReceipt } from './attestation.js';
|
|
4
4
|
import { ControlPlaneStore, ControlPlaneStoreError } from './store.js';
|
|
5
5
|
import { inheritedHostAttestorEnvironment, openTrustedExecutable, verifyOpenTrustedExecutable } from './trust.js';
|
|
@@ -29,20 +29,26 @@ export function hostRequirements(policy, phase, previousHostGeneration) {
|
|
|
29
29
|
if (phase === 'soak')
|
|
30
30
|
return { kind: phase, minimumWindowMs: policy.soakMinimumWindowMs,
|
|
31
31
|
minimumSamples: policy.soakMinimumSamples, maximumFailureRate: policy.soakMaximumFailureRate };
|
|
32
|
-
|
|
32
|
+
if (phase === 'health')
|
|
33
|
+
return { kind: phase, minimumChecks: policy.healthMinimumChecks, maximumFailures: policy.healthMaximumFailures };
|
|
34
|
+
throw new HostAttestorError('FAILED', 'rollback requirements must be bound to the durable recovery marker');
|
|
33
35
|
}
|
|
34
36
|
function expectedPhase(plan) {
|
|
35
37
|
const status = plan.status.startsWith('awaiting-') ? plan.status.slice('awaiting-'.length) : '';
|
|
36
|
-
if (!['reload', 'readiness', 'effect-blocked-replay', 'shadow', 'canary', 'soak', 'health'].includes(status)) {
|
|
38
|
+
if (!['reload', 'readiness', 'effect-blocked-replay', 'shadow', 'canary', 'soak', 'health', 'rollback'].includes(status)) {
|
|
37
39
|
throw new HostAttestorError('FAILED', 'plan is not awaiting a Host phase');
|
|
38
40
|
}
|
|
39
41
|
return status;
|
|
40
42
|
}
|
|
41
43
|
function prepare(store, plan, trust, issuer) {
|
|
42
|
-
const phase = expectedPhase(plan);
|
|
44
|
+
const phase = plan.status === 'rollback-pending' && plan.activation?.hostRecoveryRequired ? 'rollback' : expectedPhase(plan);
|
|
45
|
+
const requirements = phase === 'rollback'
|
|
46
|
+
? { kind: 'rollback', previousHostGeneration: store.latestHostGeneration(plan.installationId), action: plan.activation?.targetOriginallyExisted ? 'restore' : 'stop',
|
|
47
|
+
baselineFiles: plan.activation?.targetBaselineFiles ?? [], minimumChecks: trust.hostPolicy.healthMinimumChecks }
|
|
48
|
+
: hostRequirements(trust.hostPolicy, phase, store.latestHostGeneration(plan.installationId));
|
|
43
49
|
return store.prepareHostAttestationOperation({ planId: plan.id, expectedRevision: plan.revision,
|
|
44
50
|
expectedFence: plan.activation.fence, issuer,
|
|
45
|
-
requirements
|
|
51
|
+
requirements,
|
|
46
52
|
receiptTtlMs: trust.hostPolicy.receiptTtlMs });
|
|
47
53
|
}
|
|
48
54
|
export function prepareManualHostAttestation(store, plan, trust) {
|
|
@@ -56,7 +62,9 @@ export function prepareConfiguredHostAttestation(store, plan, trust) {
|
|
|
56
62
|
path: attestor.path, sha256: attestor.sha256, interpreter: attestor.interpreter,
|
|
57
63
|
authority: attestor.authority, keyId: attestor.keyId });
|
|
58
64
|
}
|
|
59
|
-
async function execute(executable, interpreter, args, environment, timeoutMs, input, maximumOutput) {
|
|
65
|
+
async function execute(executable, interpreter, args, environment, timeoutMs, input, maximumOutput, signal) {
|
|
66
|
+
if (signal?.aborted)
|
|
67
|
+
throw new HostAttestorError('FAILED', 'registered Host attestor was cancelled');
|
|
60
68
|
if (process.platform !== 'linux')
|
|
61
69
|
throw new HostAttestorError('FAILED', 'descriptor-pinned Host attestors require Linux');
|
|
62
70
|
try {
|
|
@@ -65,55 +73,27 @@ async function execute(executable, interpreter, args, environment, timeoutMs, in
|
|
|
65
73
|
catch {
|
|
66
74
|
throw new HostAttestorError('FAILED', 'descriptor-pinned Host attestors require /proc/self/fd');
|
|
67
75
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
outputLimit = true;
|
|
88
|
-
child.kill('SIGKILL');
|
|
89
|
-
}
|
|
90
|
-
else
|
|
91
|
-
chunks.push(chunk);
|
|
92
|
-
});
|
|
93
|
-
child.once('error', () => fail(new HostAttestorError('FAILED', 'registered Host attestor could not start')));
|
|
94
|
-
child.once('close', code => {
|
|
95
|
-
if (settled)
|
|
96
|
-
return;
|
|
97
|
-
settled = true;
|
|
98
|
-
if (timedOut)
|
|
99
|
-
reject(new HostAttestorError('TIMEOUT', 'registered Host attestor exceeded its deadline'));
|
|
100
|
-
else if (outputLimit)
|
|
101
|
-
reject(new HostAttestorError('OUTPUT_LIMIT', 'registered Host attestor exceeded its output bound'));
|
|
102
|
-
else if (code !== 0)
|
|
103
|
-
reject(new HostAttestorError('FAILED', 'registered Host attestor returned a non-zero status'));
|
|
104
|
-
else
|
|
105
|
-
resolve(Buffer.concat(chunks).toString('utf8'));
|
|
106
|
-
});
|
|
107
|
-
const timer = setTimeout(() => { timedOut = true; child.kill('SIGKILL'); }, timeoutMs);
|
|
108
|
-
child.once('close', () => clearTimeout(timer));
|
|
109
|
-
child.stdin.on('error', () => { });
|
|
110
|
-
if (input === undefined)
|
|
111
|
-
child.stdin.end();
|
|
112
|
-
else
|
|
113
|
-
child.stdin.end(input, 'utf8');
|
|
114
|
-
});
|
|
76
|
+
const command = interpreter === undefined ? '/proc/self/fd/3' : '/proc/self/fd/4';
|
|
77
|
+
const commandArguments = interpreter === undefined ? [...args] : ['/proc/self/fd/3', ...args];
|
|
78
|
+
const stdio = ['pipe', 'pipe', 'ignore', executable.handle.fd];
|
|
79
|
+
if (interpreter !== undefined)
|
|
80
|
+
stdio.push(interpreter.handle.fd);
|
|
81
|
+
try {
|
|
82
|
+
return await executeControlledProcess({ command, args: commandArguments, env: environment, stdio,
|
|
83
|
+
stdin: input, timeoutMs, maximumOutput, ...(signal === undefined ? {} : { signal }) });
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (!(error instanceof ControlledProcessError))
|
|
87
|
+
throw error;
|
|
88
|
+
if (error.code === 'TIMEOUT')
|
|
89
|
+
throw new HostAttestorError('TIMEOUT', 'registered Host attestor exceeded its deadline');
|
|
90
|
+
if (error.code === 'OUTPUT_LIMIT')
|
|
91
|
+
throw new HostAttestorError('OUTPUT_LIMIT', 'registered Host attestor exceeded its output bound');
|
|
92
|
+
throw new HostAttestorError('FAILED', error.code === 'NON_ZERO'
|
|
93
|
+
? 'registered Host attestor returned a non-zero status' : 'registered Host attestor could not be safely reclaimed');
|
|
94
|
+
}
|
|
115
95
|
}
|
|
116
|
-
export async function invokeConfiguredHostAttestor(trust, request) {
|
|
96
|
+
export async function invokeConfiguredHostAttestor(trust, request, signal) {
|
|
117
97
|
const attestor = trust.hostAttestor;
|
|
118
98
|
if (attestor === undefined)
|
|
119
99
|
throw new HostAttestorError('NOT_CONFIGURED', 'no owner-configured Host attestor is registered');
|
|
@@ -125,18 +105,27 @@ export async function invokeConfiguredHostAttestor(trust, request) {
|
|
|
125
105
|
throw new HostAttestorError('FAILED', 'durable request is not bound to the configured Host attestor');
|
|
126
106
|
let executable;
|
|
127
107
|
let interpreter;
|
|
108
|
+
let receipt;
|
|
128
109
|
try {
|
|
110
|
+
if (signal?.aborted)
|
|
111
|
+
throw new HostAttestorError('FAILED', 'registered Host attestor was cancelled');
|
|
129
112
|
executable = await openTrustedExecutable(attestor.path, attestor.sha256);
|
|
113
|
+
if (signal?.aborted)
|
|
114
|
+
throw new HostAttestorError('FAILED', 'registered Host attestor was cancelled');
|
|
130
115
|
interpreter = attestor.interpreter === null ? undefined
|
|
131
116
|
: await openTrustedExecutable(attestor.interpreter.path, attestor.interpreter.sha256);
|
|
117
|
+
if (signal?.aborted)
|
|
118
|
+
throw new HostAttestorError('FAILED', 'registered Host attestor was cancelled');
|
|
132
119
|
const environment = inheritedHostAttestorEnvironment(trust);
|
|
133
|
-
const version = (await execute(executable, interpreter, ['--version'], environment, attestor.timeoutMs, undefined, 1_024)).trim();
|
|
120
|
+
const version = (await execute(executable, interpreter, ['--version'], environment, attestor.timeoutMs, undefined, 1_024, signal)).trim();
|
|
134
121
|
if (version !== attestor.version)
|
|
135
122
|
throw new HostAttestorError('VERSION_MISMATCH', 'registered Host attestor reported a different version');
|
|
136
|
-
const receiptSource = await execute(executable, interpreter, ['attest'], environment, attestor.timeoutMs, `${JSON.stringify(request)}\n`, 65_536);
|
|
123
|
+
const receiptSource = await execute(executable, interpreter, ['attest'], environment, attestor.timeoutMs, `${JSON.stringify(request)}\n`, 65_536, signal);
|
|
137
124
|
await verifyOpenTrustedExecutable(executable);
|
|
138
125
|
if (interpreter !== undefined)
|
|
139
126
|
await verifyOpenTrustedExecutable(interpreter);
|
|
127
|
+
if (signal?.aborted)
|
|
128
|
+
throw new HostAttestorError('FAILED', 'registered Host attestor was cancelled');
|
|
140
129
|
let parsed;
|
|
141
130
|
try {
|
|
142
131
|
parsed = JSON.parse(receiptSource);
|
|
@@ -144,7 +133,7 @@ export async function invokeConfiguredHostAttestor(trust, request) {
|
|
|
144
133
|
catch {
|
|
145
134
|
throw new HostAttestorError('FAILED', 'registered Host attestor did not return one JSON receipt');
|
|
146
135
|
}
|
|
147
|
-
|
|
136
|
+
receipt = parseHostAttestationReceipt(parsed);
|
|
148
137
|
}
|
|
149
138
|
catch (error) {
|
|
150
139
|
if (error instanceof HostAttestorError || error instanceof ControlPlaneStoreError)
|
|
@@ -159,5 +148,10 @@ export async function invokeConfiguredHostAttestor(trust, request) {
|
|
|
159
148
|
await executable?.handle.close();
|
|
160
149
|
}
|
|
161
150
|
}
|
|
151
|
+
if (signal?.aborted)
|
|
152
|
+
throw new HostAttestorError('FAILED', 'registered Host attestor was cancelled');
|
|
153
|
+
if (receipt === undefined)
|
|
154
|
+
throw new HostAttestorError('FAILED', 'registered Host attestor did not return a receipt');
|
|
155
|
+
return receipt;
|
|
162
156
|
}
|
|
163
157
|
//# sourceMappingURL=host-attestor.js.map
|
package/lib/host-attestor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-attestor.js","sourceRoot":"","sources":["../src/host-attestor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"host-attestor.js","sourceRoot":"","sources":["../src/host-attestor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACvF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACtE,OAAO,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,2BAA2B,EAChC,MAAM,YAAY,CAAA;AAa/E,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACrB;IAArB,YAAqB,IAA2B,EAAE,OAAe;QAC/D,KAAK,CAAC,sCAAsC,IAAI,MAAM,OAAO,EAAE,CAAC,CAAA;QAD7C,SAAI,GAAJ,IAAI,CAAuB;QAE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
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
-
import { PluginControlPlaneService, type Config } from './service.js';
|
|
2
|
+
import { PluginControlPlaneService, normalizeControlPlaneConfig, type Config } from './service.js';
|
|
3
3
|
import { version } from './version.js';
|
|
4
4
|
export declare const name = "dsh-enhanced-plugin-control-plane";
|
|
5
|
-
export { PluginControlPlaneService, version };
|
|
5
|
+
export { PluginControlPlaneService, normalizeControlPlaneConfig, version };
|
|
6
6
|
export { Config } from './service.js';
|
|
7
|
+
export type { NormalizedControlPlaneConfig } from './service.js';
|
|
7
8
|
export * from './catalog.js';
|
|
9
|
+
export * from './errors.js';
|
|
10
|
+
export * from './source-workspace.js';
|
|
8
11
|
export * from './approval.js';
|
|
12
|
+
export type { SourceApprovalClientConfig } from './source-approval-client.js';
|
|
13
|
+
export { validateSourceApprovalAuthorityConfig } from './source-approval-authority.js';
|
|
14
|
+
export type { SourceApprovalAuthorityConfig, SourceApprovalRequest } from './source-approval-authority.js';
|
|
15
|
+
export type { SourceAdoptionConfig } from './source-adoption-runner.js';
|
|
16
|
+
export { validateSourceAdoptionAuthorityConfig } from './source-adoption-authority.js';
|
|
17
|
+
export type { SourceAdoptionAuthorityConfig } from './source-adoption-authority.js';
|
|
9
18
|
export * from './attestation.js';
|
|
10
19
|
export * from './host-attestor.js';
|
|
20
|
+
export * from './runtime-observer.js';
|
|
21
|
+
export type { ForegroundDeploymentConfig } from './foreground-deployment-runtime.js';
|
|
22
|
+
export type * from './task-observation-types.js';
|
|
23
|
+
export { validateTaskObservationAuthorityConfig } from './task-observation-authority.js';
|
|
24
|
+
export type { TaskObservationAuthorityConfig } from './task-observation-authority.js';
|
|
25
|
+
export type { ForegroundDeploymentRecord } from './foreground-deployment.js';
|
|
26
|
+
export * from './effect-blocked-replay.js';
|
|
27
|
+
export * from './replay-endpoint.js';
|
|
11
28
|
export * from './lockfile.js';
|
|
12
29
|
export * from './release.js';
|
|
30
|
+
export { validateSourceReleaseAuthorityConfig } from './source-release-authority.js';
|
|
31
|
+
export type { SourceReleaseAuthorityConfig } from './source-release-authority.js';
|
|
13
32
|
export * from './service.js';
|
|
14
33
|
export * from './sqlite.js';
|
|
15
34
|
export * from './store.js';
|
|
16
35
|
export * from './types.js';
|
|
17
36
|
export * from './trust.js';
|
|
37
|
+
export type * from './source-job-types.js';
|
|
38
|
+
export type { EnqueueSourceJobInput, SourceJobCaller } from './source-jobs.js';
|
|
18
39
|
export declare function apply(ctx: Context, config: Config): void;
|
|
19
40
|
export default PluginControlPlaneService;
|
|
41
|
+
export type { AdoptionHandoffTerms, AdoptionHandoffRecord } from './adoption-handoff.js';
|
|
42
|
+
export type { AdoptionCoordinatorConfig } from './adoption-coordinator.js';
|
|
20
43
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,yBAAyB,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;AAClG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,eAAO,MAAM,IAAI,sCAAsC,CAAA;AACvD,OAAO,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,OAAO,EAAE,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,YAAY,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAChE,cAAc,cAAc,CAAA;AAC5B,cAAc,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I,CAExD;AAED,eAAe,yBAAyB,CAAA;AAExC,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AACxF,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import { PluginControlPlaneService } from './service.js';
|
|
1
|
+
import { PluginControlPlaneService, normalizeControlPlaneConfig } from './service.js';
|
|
2
2
|
import { version } from './version.js';
|
|
3
3
|
export const name = 'dsh-enhanced-plugin-control-plane';
|
|
4
|
-
export { PluginControlPlaneService, version };
|
|
4
|
+
export { PluginControlPlaneService, normalizeControlPlaneConfig, version };
|
|
5
5
|
export { Config } from './service.js';
|
|
6
6
|
export * from './catalog.js';
|
|
7
|
+
export * from './errors.js';
|
|
8
|
+
export * from './source-workspace.js';
|
|
7
9
|
export * from './approval.js';
|
|
10
|
+
export { validateSourceApprovalAuthorityConfig } from './source-approval-authority.js';
|
|
11
|
+
export { validateSourceAdoptionAuthorityConfig } from './source-adoption-authority.js';
|
|
8
12
|
export * from './attestation.js';
|
|
9
13
|
export * from './host-attestor.js';
|
|
14
|
+
export * from './runtime-observer.js';
|
|
15
|
+
export { validateTaskObservationAuthorityConfig } from './task-observation-authority.js';
|
|
16
|
+
export * from './effect-blocked-replay.js';
|
|
17
|
+
export * from './replay-endpoint.js';
|
|
10
18
|
export * from './lockfile.js';
|
|
11
19
|
export * from './release.js';
|
|
20
|
+
export { validateSourceReleaseAuthorityConfig } from './source-release-authority.js';
|
|
12
21
|
export * from './service.js';
|
|
13
22
|
export * from './sqlite.js';
|
|
14
23
|
export * from './store.js';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAe,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,2BAA2B,EAAe,MAAM,cAAc,CAAA;AAClG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,mCAAmC,CAAA;AACvD,OAAO,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,OAAO,EAAE,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAE7B,OAAO,EAAE,qCAAqC,EAAE,MAAM,gCAAgC,CAAA;AAGtF,OAAO,EAAE,qCAAqC,EAAE,MAAM,gCAAgC,CAAA;AAEtF,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AAGrC,OAAO,EAAE,sCAAsC,EAAE,MAAM,iCAAiC,CAAA;AAGxF,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAA;AAEpF,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAI1B,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,MAAc;IAChD,IAAI,yBAAyB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AAC5C,CAAC;AAED,eAAe,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface NpmPublishInput {
|
|
2
|
+
locator: string;
|
|
3
|
+
packageName: string;
|
|
4
|
+
version: string;
|
|
5
|
+
tarball: Buffer;
|
|
6
|
+
tag: string;
|
|
7
|
+
expectedRegistryReference: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PreparedNpmPublish {
|
|
10
|
+
url: string;
|
|
11
|
+
body: Buffer;
|
|
12
|
+
}
|
|
13
|
+
export interface NpmPublishSendInput {
|
|
14
|
+
url: string;
|
|
15
|
+
body: Buffer;
|
|
16
|
+
token: string;
|
|
17
|
+
caPins: readonly string[];
|
|
18
|
+
timeoutMs: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function prepareNpmPublish(input: NpmPublishInput): PreparedNpmPublish;
|
|
21
|
+
export declare function sendNpmPublish(input: NpmPublishSendInput): Promise<{
|
|
22
|
+
outcome: 'accepted' | 'ambiguous';
|
|
23
|
+
detailDigest: string;
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=npm-publish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-publish.d.ts","sourceRoot":"","sources":["../src/npm-publish.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,yBAAyB,EAAE,MAAM,CAAA;CAClC;AAED,MAAM,WAAW,kBAAkB;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACjE,MAAM,WAAW,mBAAmB;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AAsH/H,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB,CAmB5E;AAGD,wBAAsB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,UAAU,GAAG,WAAW,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CAgCrI"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { request as httpsRequest } from 'node:https';
|
|
3
|
+
import { isIP } from 'node:net';
|
|
4
|
+
import { gunzipSync } from 'node:zlib';
|
|
5
|
+
const MAX_TGZ = 256 * 1024 * 1024;
|
|
6
|
+
const MAX_INFLATED = 256 * 1024 * 1024;
|
|
7
|
+
const MAX_MANIFEST = 1024 * 1024;
|
|
8
|
+
const MAX_RESPONSE = 2 * 1024 * 1024;
|
|
9
|
+
const PACKAGE = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u;
|
|
10
|
+
const VERSION = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?$/u;
|
|
11
|
+
const TAG = /^[a-z][a-z0-9-]{0,63}$/u;
|
|
12
|
+
function fail(message) { throw new Error(`npm publish: ${message}`); }
|
|
13
|
+
function boundedText(value, label, maximum = 8_192) {
|
|
14
|
+
if (typeof value !== 'string' || value.length === 0 || Buffer.byteLength(value) > maximum
|
|
15
|
+
|| [...value].some(character => character.charCodeAt(0) <= 0x20 || character.charCodeAt(0) === 0x7f))
|
|
16
|
+
fail(`${label} is invalid`);
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function bareHttps(value, label, allowNpmEscapedSlash = false) {
|
|
20
|
+
boundedText(value, label);
|
|
21
|
+
if (/[\\?#]/u.test(value) || /%(?!2f)/u.test(value))
|
|
22
|
+
fail(`${label} is not a canonical HTTPS URL`);
|
|
23
|
+
let url;
|
|
24
|
+
try {
|
|
25
|
+
url = new URL(value);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
fail(`${label} is invalid`);
|
|
29
|
+
}
|
|
30
|
+
const rootWithoutSlash = url.pathname === '/' && url.href === `${value}/`;
|
|
31
|
+
if (url.protocol !== 'https:' || url.username || url.password || url.search || url.hash || url.pathname.includes('//')
|
|
32
|
+
|| (!allowNpmEscapedSlash && value.includes('%2f')) || (url.href !== value && !rootWithoutSlash))
|
|
33
|
+
fail(`${label} is not a canonical HTTPS URL`);
|
|
34
|
+
return url;
|
|
35
|
+
}
|
|
36
|
+
function basePath(base) { return base.pathname.endsWith('/') ? base.pathname : `${base.pathname}/`; }
|
|
37
|
+
function atBase(base, suffix) {
|
|
38
|
+
const target = new URL(base);
|
|
39
|
+
target.pathname = `${basePath(base)}${suffix}`;
|
|
40
|
+
return target;
|
|
41
|
+
}
|
|
42
|
+
function verifyReference(value, base) {
|
|
43
|
+
const reference = bareHttps(value, 'expected registry reference');
|
|
44
|
+
if (reference.origin !== base.origin || !reference.pathname.startsWith(basePath(base)))
|
|
45
|
+
fail('expected registry reference is outside the configured registry base');
|
|
46
|
+
return reference.href;
|
|
47
|
+
}
|
|
48
|
+
function readString(bytes, offset, length) {
|
|
49
|
+
const field = bytes.subarray(offset, offset + length);
|
|
50
|
+
const end = field.indexOf(0);
|
|
51
|
+
return field.subarray(0, end < 0 ? field.length : end).toString('utf8');
|
|
52
|
+
}
|
|
53
|
+
function octal(bytes, offset, length, label) {
|
|
54
|
+
const raw = readString(bytes, offset, length).trim();
|
|
55
|
+
if (raw === '')
|
|
56
|
+
return 0;
|
|
57
|
+
if (!/^[0-7]+$/u.test(raw))
|
|
58
|
+
fail(`tar ${label} is invalid`);
|
|
59
|
+
const value = Number.parseInt(raw, 8);
|
|
60
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
61
|
+
fail(`tar ${label} is invalid`);
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
function checksum(header) {
|
|
65
|
+
const stored = octal(header, 148, 8, 'checksum');
|
|
66
|
+
let sum = 0;
|
|
67
|
+
for (let index = 0; index < 512; index++)
|
|
68
|
+
sum += index >= 148 && index < 156 ? 32 : header[index];
|
|
69
|
+
if (sum !== stored)
|
|
70
|
+
fail('tar header checksum is invalid');
|
|
71
|
+
}
|
|
72
|
+
function safePath(value, permitTerminalSlash = false) {
|
|
73
|
+
const path = permitTerminalSlash && value.endsWith('/') ? value.slice(0, -1) : value;
|
|
74
|
+
if (!path || value.includes('\0') || value.includes('\\') || value.startsWith('/') || path.split('/').some(part => part === '' || part === '.' || part === '..'))
|
|
75
|
+
fail('tar path is unsafe');
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
function paxPath(payload) {
|
|
79
|
+
let offset = 0;
|
|
80
|
+
let path;
|
|
81
|
+
while (offset < payload.length) {
|
|
82
|
+
const space = payload.indexOf(0x20, offset);
|
|
83
|
+
if (space < 0)
|
|
84
|
+
fail('PAX record is invalid');
|
|
85
|
+
const lengthText = payload.subarray(offset, space).toString('ascii');
|
|
86
|
+
if (!/^[1-9]\d*$/u.test(lengthText))
|
|
87
|
+
fail('PAX record is invalid');
|
|
88
|
+
const length = Number(lengthText);
|
|
89
|
+
if (!Number.isSafeInteger(length) || length <= space - offset + 1 || offset + length > payload.length)
|
|
90
|
+
fail('PAX record is invalid');
|
|
91
|
+
const record = payload.subarray(space + 1, offset + length);
|
|
92
|
+
if (record[record.length - 1] !== 0x0a)
|
|
93
|
+
fail('PAX record is invalid');
|
|
94
|
+
const equal = record.indexOf(0x3d);
|
|
95
|
+
if (equal < 1)
|
|
96
|
+
fail('PAX record is invalid');
|
|
97
|
+
const key = record.subarray(0, equal).toString('utf8');
|
|
98
|
+
const value = record.subarray(equal + 1, -1).toString('utf8');
|
|
99
|
+
if (key === 'path')
|
|
100
|
+
path = safePath(value, true);
|
|
101
|
+
else if (key === 'size' || key === 'linkpath')
|
|
102
|
+
fail(`PAX ${key} is unsupported`);
|
|
103
|
+
else if (!['atime', 'ctime', 'gid', 'gname', 'mtime', 'uid', 'uname'].includes(key))
|
|
104
|
+
fail(`PAX ${key} is unsupported`);
|
|
105
|
+
offset += length;
|
|
106
|
+
}
|
|
107
|
+
return path;
|
|
108
|
+
}
|
|
109
|
+
function packageManifest(tgz) {
|
|
110
|
+
if (!Buffer.isBuffer(tgz) || tgz.length < 1 || tgz.length > MAX_TGZ)
|
|
111
|
+
fail('tarball exceeds the bounded size');
|
|
112
|
+
let tar;
|
|
113
|
+
try {
|
|
114
|
+
tar = Buffer.from(gunzipSync(tgz, { maxOutputLength: MAX_INFLATED }));
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
fail('tarball is not a bounded gzip stream');
|
|
118
|
+
}
|
|
119
|
+
let offset = 0;
|
|
120
|
+
let zeroBlocks = 0;
|
|
121
|
+
let pendingPath;
|
|
122
|
+
let pendingPax;
|
|
123
|
+
let manifest;
|
|
124
|
+
while (offset < tar.length) {
|
|
125
|
+
if (offset + 512 > tar.length)
|
|
126
|
+
fail('tarball is truncated');
|
|
127
|
+
const header = tar.subarray(offset, offset + 512);
|
|
128
|
+
offset += 512;
|
|
129
|
+
if (header.every(byte => byte === 0)) {
|
|
130
|
+
if (pendingPath !== undefined || pendingPax !== undefined)
|
|
131
|
+
fail('tarball has a dangling extension header');
|
|
132
|
+
zeroBlocks++;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (zeroBlocks)
|
|
136
|
+
fail('tarball contains data after its terminator');
|
|
137
|
+
checksum(header);
|
|
138
|
+
const size = octal(header, 124, 12, 'size');
|
|
139
|
+
const type = String.fromCharCode(header[156] || 0);
|
|
140
|
+
const padded = Math.ceil(size / 512) * 512;
|
|
141
|
+
if (offset + padded > tar.length)
|
|
142
|
+
fail('tarball is truncated');
|
|
143
|
+
const payload = tar.subarray(offset, offset + size);
|
|
144
|
+
offset += padded;
|
|
145
|
+
if (type === 'x') {
|
|
146
|
+
if (pendingPath !== undefined || pendingPax !== undefined)
|
|
147
|
+
fail('tarball has stacked extension headers');
|
|
148
|
+
pendingPax = { path: paxPath(payload) };
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (type === 'L') {
|
|
152
|
+
if (pendingPath !== undefined || pendingPax !== undefined)
|
|
153
|
+
fail('tarball has stacked extension headers');
|
|
154
|
+
pendingPath = safePath(payload.subarray(0, payload.length && payload[payload.length - 1] === 0 ? -1 : payload.length).toString('utf8').replace(/\n$/u, ''), true);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (type !== '\0' && type !== '0' && type !== '5')
|
|
158
|
+
fail('tarball contains an unsupported entry type');
|
|
159
|
+
const prefix = readString(header, 345, 155);
|
|
160
|
+
const path = pendingPax?.path ?? pendingPath ?? safePath(`${prefix}${prefix ? '/' : ''}${readString(header, 0, 100)}`, type === '5');
|
|
161
|
+
pendingPax = undefined;
|
|
162
|
+
pendingPath = undefined;
|
|
163
|
+
if (type === '5') {
|
|
164
|
+
if (size !== 0 || !path.endsWith('/'))
|
|
165
|
+
fail('tar directory entry is invalid');
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (path.endsWith('/'))
|
|
169
|
+
fail('tar file path is unsafe');
|
|
170
|
+
if (path === 'package/package.json') {
|
|
171
|
+
if (manifest !== undefined)
|
|
172
|
+
fail('tarball contains duplicate package manifests');
|
|
173
|
+
if (payload.length > MAX_MANIFEST)
|
|
174
|
+
fail('package manifest exceeds the bounded size');
|
|
175
|
+
try {
|
|
176
|
+
const parsed = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(payload));
|
|
177
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
|
|
178
|
+
fail('package manifest is invalid');
|
|
179
|
+
manifest = parsed;
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
if (error instanceof Error && error.message.startsWith('npm publish:'))
|
|
183
|
+
throw error;
|
|
184
|
+
fail('package manifest is invalid');
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (zeroBlocks < 2 || manifest === undefined)
|
|
189
|
+
fail('tarball has no unique package/package.json');
|
|
190
|
+
return manifest;
|
|
191
|
+
}
|
|
192
|
+
export function prepareNpmPublish(input) {
|
|
193
|
+
if (!PACKAGE.test(input.packageName))
|
|
194
|
+
fail('package name is invalid');
|
|
195
|
+
if (!VERSION.test(input.version))
|
|
196
|
+
fail('package version is invalid');
|
|
197
|
+
if (!TAG.test(input.tag))
|
|
198
|
+
fail('dist-tag is invalid');
|
|
199
|
+
const base = bareHttps(input.locator, 'registry locator');
|
|
200
|
+
const expected = verifyReference(input.expectedRegistryReference, base);
|
|
201
|
+
const manifest = packageManifest(input.tarball);
|
|
202
|
+
if (manifest.name !== input.packageName || manifest.version !== input.version || manifest.private)
|
|
203
|
+
fail('package manifest does not match the authorized public package');
|
|
204
|
+
if (Object.hasOwn(manifest, 'packageExtensions'))
|
|
205
|
+
fail('package manifest contains packageExtensions');
|
|
206
|
+
const tarballName = `${input.packageName}-${input.version}.tgz`;
|
|
207
|
+
const sha512 = createHash('sha512').update(input.tarball).digest('base64');
|
|
208
|
+
const sha1 = createHash('sha1').update(input.tarball).digest('hex');
|
|
209
|
+
const version = { ...manifest, _id: `${input.packageName}@${input.version}`, dist: { integrity: `sha512-${sha512}`, shasum: sha1, tarball: expected } };
|
|
210
|
+
delete version.patchedDependencies;
|
|
211
|
+
const body = Buffer.from(JSON.stringify({ _id: input.packageName, name: input.packageName,
|
|
212
|
+
description: typeof manifest.description === 'string' ? manifest.description : '', access: 'public', versions: { [input.version]: version },
|
|
213
|
+
'dist-tags': { [input.tag]: input.version }, _attachments: { [tarballName]: { content_type: 'application/octet-stream', data: input.tarball.toString('base64'), length: input.tarball.length } } }));
|
|
214
|
+
if (body.length > 402_653_184)
|
|
215
|
+
fail('publish body exceeds the bounded size');
|
|
216
|
+
return { url: atBase(base, input.packageName.replace('/', '%2f')).href, body };
|
|
217
|
+
}
|
|
218
|
+
function detail(code) { return createHash('sha256').update(code).digest('hex'); }
|
|
219
|
+
export async function sendNpmPublish(input) {
|
|
220
|
+
const url = bareHttps(input.url, 'publish URL', true);
|
|
221
|
+
if (!Buffer.isBuffer(input.body) || input.body.length < 1 || input.body.length > 402_653_184)
|
|
222
|
+
fail('publish body is invalid');
|
|
223
|
+
if (typeof input.token !== 'string' || input.token.length < 1 || /[^\x21-\x7e]/u.test(input.token))
|
|
224
|
+
fail('publish token is invalid');
|
|
225
|
+
if (!Number.isSafeInteger(input.timeoutMs) || input.timeoutMs < 1 || input.timeoutMs > 120_000)
|
|
226
|
+
fail('publish timeout is invalid');
|
|
227
|
+
if (!Array.isArray(input.caPins) || input.caPins.some(pin => typeof pin !== 'string' || pin.length < 1))
|
|
228
|
+
fail('owner CA pins are invalid');
|
|
229
|
+
const deadline = performance.now() + input.timeoutMs;
|
|
230
|
+
return await new Promise(resolve => {
|
|
231
|
+
let req;
|
|
232
|
+
let response;
|
|
233
|
+
let settled = false;
|
|
234
|
+
const finish = (outcome, code) => {
|
|
235
|
+
if (settled)
|
|
236
|
+
return;
|
|
237
|
+
settled = true;
|
|
238
|
+
clearTimeout(timer);
|
|
239
|
+
response?.destroy();
|
|
240
|
+
req?.destroy();
|
|
241
|
+
resolve({ outcome, detailDigest: detail(code) });
|
|
242
|
+
};
|
|
243
|
+
const timer = setTimeout(() => finish('ambiguous', 'timeout'), Math.max(1, deadline - performance.now()));
|
|
244
|
+
try {
|
|
245
|
+
req = httpsRequest(url, { method: 'PUT', agent: false, rejectUnauthorized: true, ...(input.caPins.length ? { ca: [...input.caPins] } : {}), ...(isIP(url.hostname) === 0 ? { servername: url.hostname } : {}), headers: { authorization: `Bearer ${input.token}`, 'content-type': 'application/json', 'content-length': String(input.body.length), accept: 'application/json', 'accept-encoding': 'identity' } }, incoming => {
|
|
246
|
+
response = incoming;
|
|
247
|
+
const status = incoming.statusCode ?? 0;
|
|
248
|
+
const encoding = incoming.headers['content-encoding'];
|
|
249
|
+
const length = incoming.headers['content-length'];
|
|
250
|
+
if (encoding !== undefined && encoding !== 'identity') {
|
|
251
|
+
finish('ambiguous', `encoding:${status}`);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (length !== undefined && (!/^\d{1,10}$/u.test(length) || Number(length) > MAX_RESPONSE)) {
|
|
255
|
+
finish('ambiguous', `length:${status}`);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
let size = 0;
|
|
259
|
+
incoming.on('data', (chunk) => { size += chunk.length; if (size > MAX_RESPONSE)
|
|
260
|
+
finish('ambiguous', `body:${status}`); });
|
|
261
|
+
incoming.on('aborted', () => finish('ambiguous', `aborted:${status}`));
|
|
262
|
+
incoming.on('error', () => finish('ambiguous', `response-error:${status}`));
|
|
263
|
+
incoming.on('end', () => {
|
|
264
|
+
if (performance.now() >= deadline)
|
|
265
|
+
finish('ambiguous', 'timeout');
|
|
266
|
+
else if (length !== undefined && size !== Number(length))
|
|
267
|
+
finish('ambiguous', `truncated:${status}`);
|
|
268
|
+
else
|
|
269
|
+
finish(status === 200 || status === 201 ? 'accepted' : 'ambiguous', `status:${status}`);
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
req.on('error', () => finish('ambiguous', 'request-error'));
|
|
273
|
+
req.end(input.body);
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
finish('ambiguous', 'request-start-error');
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=npm-publish.js.map
|