@skrr-ai/cli 0.1.146 → 0.1.148
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/dist/base-command.js +38 -21
- package/dist/commands/agent/message/send.d.ts +11 -0
- package/dist/commands/agent/message/send.js +34 -8
- package/dist/commands/agent-worker.js +2 -1
- package/dist/commands/agents/activity.js +2 -1
- package/dist/commands/agents/badge.js +10 -5
- package/dist/commands/agents/categories/index.js +2 -1
- package/dist/commands/agents/chat.d.ts +1 -0
- package/dist/commands/agents/chat.js +29 -1
- package/dist/commands/agents/create.js +4 -1
- package/dist/commands/agents/overview.js +2 -1
- package/dist/commands/agents/releases/create.js +2 -1
- package/dist/commands/agents/schedule-overview.js +3 -1
- package/dist/commands/agents/schedule.js +2 -1
- package/dist/commands/agents/spawn.js +9 -6
- package/dist/commands/agents/tools/auth.js +2 -1
- package/dist/commands/agents/tools/calls.js +2 -1
- package/dist/commands/agents/triggers/policy.js +11 -1
- package/dist/commands/agents/visibility.js +2 -1
- package/dist/commands/balance/show.js +28 -5
- package/dist/commands/balance/statement.js +2 -1
- package/dist/commands/commands.js +2 -1
- package/dist/commands/commitments/create.js +2 -1
- package/dist/commands/commitments/delivery.js +2 -1
- package/dist/commands/commitments/doctor.js +2 -1
- package/dist/commands/commitments/observations.js +2 -2
- package/dist/commands/commitments/operating-review.js +2 -1
- package/dist/commands/commitments/pack/preflight.js +2 -1
- package/dist/commands/commitments/preflight.js +5 -1
- package/dist/commands/commitments/trigger-status.js +2 -1
- package/dist/commands/commitments/wake-capabilities.d.ts +2 -0
- package/dist/commands/commitments/wake-capabilities.js +16 -0
- package/dist/commands/convos/messages.js +2 -1
- package/dist/commands/daemon/logs.js +18 -9
- package/dist/commands/daemon/usage.js +2 -1
- package/dist/commands/dm/messages.js +2 -1
- package/dist/commands/dm/thread/messages.js +2 -1
- package/dist/commands/dm/threads.js +2 -1
- package/dist/commands/doctor.js +2 -1
- package/dist/commands/goals/key-results/assess.js +2 -1
- package/dist/commands/goals/key-results/history.js +2 -1
- package/dist/commands/harnesses/forget.js +2 -1
- package/dist/commands/harnesses/show.js +12 -6
- package/dist/commands/inbox/index.js +4 -3
- package/dist/commands/initiatives/decide.js +2 -1
- package/dist/commands/instructions/diff.js +2 -1
- package/dist/commands/instructions/show.js +2 -1
- package/dist/commands/login.js +4 -2
- package/dist/commands/machines/dedicated/cp.js +2 -1
- package/dist/commands/machines/dedicated/power/set.js +2 -1
- package/dist/commands/machines/show.js +2 -1
- package/dist/commands/memory/maintain.js +2 -1
- package/dist/commands/memory/read.js +2 -1
- package/dist/commands/memory/rebuild-index.js +2 -1
- package/dist/commands/memory/rebuild.js +2 -1
- package/dist/commands/memory/search.js +2 -1
- package/dist/commands/messages/list.js +2 -1
- package/dist/commands/revoke-daemon.js +2 -1
- package/dist/commands/revoke-token.js +2 -1
- package/dist/commands/search/all.js +14 -7
- package/dist/commands/search/workspace.js +2 -1
- package/dist/commands/set-capabilities.js +2 -1
- package/dist/commands/skills/browse.js +8 -2
- package/dist/commands/spaces/auto-executor/preview.js +3 -2
- package/dist/commands/spaces/auto-executor/runs.js +4 -1
- package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
- package/dist/commands/spaces/workflow-templates/extract.js +9 -1
- package/dist/commands/spaces/workflows/events.js +6 -3
- package/dist/commands/spaces/workflows/run.js +5 -3
- package/dist/commands/spaces/workflows/update.js +2 -1
- package/dist/commands/store/gallery-admissions/preview.js +2 -1
- package/dist/commands/store/publishers/profile/handle.js +2 -1
- package/dist/commands/tasks/comments/anchor.js +23 -9
- package/dist/commands/tasks/complete.js +4 -2
- package/dist/commands/tasks/create-tree.js +7 -3
- package/dist/commands/tasks/create.js +2 -1
- package/dist/commands/tasks/deliverable/add.js +2 -1
- package/dist/commands/tasks/deliverable/archive.js +2 -1
- package/dist/commands/tasks/deliverable/list.js +2 -1
- package/dist/commands/tasks/expectations/assess.js +2 -1
- package/dist/commands/tasks/labels/create.js +2 -1
- package/dist/commands/tasks/preflight.js +4 -2
- package/dist/commands/tasks/ready.js +2 -1
- package/dist/commands/tasks/result/submit.js +2 -1
- package/dist/commands/tasks/updates/add.js +2 -1
- package/dist/commands/tasks/wait.js +2 -1
- package/dist/commands/token/list.js +2 -1
- package/dist/commands/token/mint.js +2 -1
- package/dist/commands/wiki/write.js +14 -7
- package/dist/hooks/command-not-found.js +2 -1
- package/dist/lib/agent-chat-start.d.ts +77 -0
- package/dist/lib/agent-chat-start.js +169 -0
- package/dist/lib/agent-config.js +2 -1
- package/dist/lib/agent-endpoints.js +4 -2
- package/dist/lib/agent-evals.js +2 -1
- package/dist/lib/agent-guide-reference-gate.js +22 -11
- package/dist/lib/agent-guides.js +4 -1
- package/dist/lib/agent-instructions.js +5 -1
- package/dist/lib/agent-ref.js +8 -4
- package/dist/lib/agent-trigger-listing.js +2 -1
- package/dist/lib/agentic-stream.js +8 -5
- package/dist/lib/api-error-reason.js +2 -1
- package/dist/lib/api-fetch.js +5 -3
- package/dist/lib/appData.js +6 -6
- package/dist/lib/appInstallations.js +10 -5
- package/dist/lib/appsCheck.js +2 -1
- package/dist/lib/auth-failure.js +2 -1
- package/dist/lib/auth-storage.js +2 -1
- package/dist/lib/balance.d.ts +33 -3
- package/dist/lib/balance.js +39 -7
- package/dist/lib/capability-matrix.js +4 -2
- package/dist/lib/cli-runtime.js +2 -1
- package/dist/lib/code-handover.js +8 -3
- package/dist/lib/command-hygiene.js +28 -12
- package/dist/lib/command-manifest.js +6 -3
- package/dist/lib/commitment-attention-copy.js +2 -1
- package/dist/lib/commitment-event-wakes.js +9 -0
- package/dist/lib/commitment-product.js +5 -3
- package/dist/lib/commitment-terms.js +2 -1
- package/dist/lib/commitments.d.ts +13 -0
- package/dist/lib/commitments.js +24 -9
- package/dist/lib/compasses.js +2 -1
- package/dist/lib/completion-index.js +2 -1
- package/dist/lib/computer-files.js +8 -6
- package/dist/lib/config.js +11 -5
- package/dist/lib/conversation-search.js +4 -2
- package/dist/lib/daemon-installer.js +6 -2
- package/dist/lib/daemon-maintenance.js +2 -1
- package/dist/lib/daemon-ref.js +2 -1
- package/dist/lib/daemonBroker.js +6 -3
- package/dist/lib/daemonBrokerRefusal.js +4 -2
- package/dist/lib/daemonHandoff.js +14 -7
- package/dist/lib/daemonIslandProfile.js +2 -1
- package/dist/lib/dedicated-copy.js +9 -3
- package/dist/lib/dedicated-exec.js +2 -1
- package/dist/lib/dedicated-keep-awake.js +2 -1
- package/dist/lib/dedicated-machines.js +9 -5
- package/dist/lib/dedicated-service.js +2 -1
- package/dist/lib/dedicated-ssh.js +5 -3
- package/dist/lib/deployed-build.js +2 -1
- package/dist/lib/device-code.js +4 -3
- package/dist/lib/dpop-auth.js +2 -1
- package/dist/lib/earnings.js +2 -1
- package/dist/lib/exec-runtime-binary.js +5 -3
- package/dist/lib/first-party-harness-broker.js +4 -3
- package/dist/lib/first-party-harness-managed.js +2 -1
- package/dist/lib/first-party-harness-startup-update.js +8 -4
- package/dist/lib/first-party-harness-update.js +2 -1
- package/dist/lib/first-party-harness.js +2 -1
- package/dist/lib/format.js +8 -4
- package/dist/lib/git-task.js +10 -5
- package/dist/lib/github-tools.js +6 -3
- package/dist/lib/harnesses.js +4 -2
- package/dist/lib/hosted-machines.js +2 -1
- package/dist/lib/html-text.js +33 -16
- package/dist/lib/ingress.js +2 -1
- package/dist/lib/instruction-blocks.js +2 -1
- package/dist/lib/iso-instant.js +5 -3
- package/dist/lib/keychain.js +15 -5
- package/dist/lib/label-scope.js +2 -1
- package/dist/lib/live-runtime-binary.js +10 -7
- package/dist/lib/local-skills.js +10 -6
- package/dist/lib/login.js +3 -2
- package/dist/lib/machine-audit.js +2 -1
- package/dist/lib/machine-daemon-log.js +2 -1
- package/dist/lib/machine-services.js +2 -1
- package/dist/lib/memory-history-session.js +2 -1
- package/dist/lib/memory-sync.js +6 -2
- package/dist/lib/message-intent.d.ts +10 -0
- package/dist/lib/node-adapter.js +4 -2
- package/dist/lib/northstars.js +4 -2
- package/dist/lib/oauthLogin.js +16 -7
- package/dist/lib/open-target.js +8 -4
- package/dist/lib/option-hint.js +2 -4
- package/dist/lib/outbox.js +2 -1
- package/dist/lib/planOutcome.d.ts +5 -3
- package/dist/lib/planOutcome.js +7 -4
- package/dist/lib/platform-update-local.js +2 -3
- package/dist/lib/preflight-copy.js +31 -0
- package/dist/lib/rate-limit-retry.js +2 -1
- package/dist/lib/reflection.js +2 -1
- package/dist/lib/request-field-flags.js +2 -1
- package/dist/lib/runtime-start-verification.js +2 -1
- package/dist/lib/schedule.js +2 -1
- package/dist/lib/scoped-memory-command.js +7 -3
- package/dist/lib/search-display.js +11 -4
- package/dist/lib/skill-store-pagination.js +2 -1
- package/dist/lib/space-notebook.js +5 -3
- package/dist/lib/store-listing.js +2 -1
- package/dist/lib/task-agent-context-capabilities.js +2 -1
- package/dist/lib/task-asset-upload.js +7 -3
- package/dist/lib/task-closure.js +2 -1
- package/dist/lib/task-economics.js +2 -1
- package/dist/lib/task-execution.js +16 -8
- package/dist/lib/task-extras.js +4 -2
- package/dist/lib/task-operation-watch.js +2 -1
- package/dist/lib/task-preflight.js +3 -2
- package/dist/lib/task-recurrence-summary.js +4 -2
- package/dist/lib/task-runtime-headers.js +10 -5
- package/dist/lib/task-transcript.js +3 -2
- package/dist/lib/task-transfer.js +9 -5
- package/dist/lib/tasks.js +2 -1
- package/dist/lib/triggers.d.ts +21 -0
- package/dist/lib/triggers.js +41 -3
- package/dist/lib/update-check.js +12 -7
- package/dist/lib/usage-discovery.js +2 -1
- package/dist/lib/usd-micros.js +2 -1
- package/dist/lib/web-url.js +2 -1
- package/dist/lib/widgetCheck.js +15 -9
- package/dist/lib/widgetStaticScan.js +26 -14
- package/dist/lib/workflow-run-view.js +5 -3
- package/dist/lib/workflow-templates.d.ts +10 -0
- package/dist/lib/workflow-templates.js +47 -0
- package/dist/lib/write-target.js +4 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +20519 -20130
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
- package/oclif.manifest.json +17 -2
- package/package.json +1 -1
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import * as crypto from 'node:crypto';
|
|
26
26
|
import { jwkThumbprint, normalizeHtu, tokenHash, verifyEd25519Proof, } from './deviceKey.js';
|
|
27
|
+
const B64U_RE = /=+$/;
|
|
28
|
+
const B64U_RE_2 = /\+/g;
|
|
29
|
+
const B64U_RE_3 = /\//g;
|
|
30
|
+
const BUILD_DPOP_PROOF_WITH_KEY_RE = /^[A-Za-z]{3,10}$/;
|
|
31
|
+
const IS_ATH_RE = /^[A-Za-z0-9_-]{43}$/;
|
|
27
32
|
/** RFC 9449 §4.2 — the proof's JOSE header `typ`. */
|
|
28
33
|
export const DPOP_PROOF_TYP = 'dpop+jwt';
|
|
29
34
|
/** RFC 9449 §4.1 — the request header carrying the proof. */
|
|
@@ -51,7 +56,11 @@ export function createDpopKey() {
|
|
|
51
56
|
});
|
|
52
57
|
}
|
|
53
58
|
function b64u(buf) {
|
|
54
|
-
return buf
|
|
59
|
+
return buf
|
|
60
|
+
.toString('base64')
|
|
61
|
+
.replace(B64U_RE, '')
|
|
62
|
+
.replace(B64U_RE_2, '-')
|
|
63
|
+
.replace(B64U_RE_3, '_');
|
|
55
64
|
}
|
|
56
65
|
/**
|
|
57
66
|
* Sign one proof. `ath` comes from the token when the signer holds it, or is
|
|
@@ -59,7 +68,7 @@ function b64u(buf) {
|
|
|
59
68
|
* token, which is the point of the oracle.
|
|
60
69
|
*/
|
|
61
70
|
function buildDpopProofWithKey(privateKey, publicJwk, req) {
|
|
62
|
-
if (typeof req.htm !== 'string' ||
|
|
71
|
+
if (typeof req.htm !== 'string' || !BUILD_DPOP_PROOF_WITH_KEY_RE.test(req.htm)) {
|
|
63
72
|
throw new Error('dpop: htm must be an HTTP method');
|
|
64
73
|
}
|
|
65
74
|
if (typeof req.htu !== 'string' || req.htu.length === 0) {
|
|
@@ -91,7 +100,7 @@ export function accessTokenHash(accessToken) {
|
|
|
91
100
|
}
|
|
92
101
|
/** True for a value shaped like an `ath` / `jkt` (43-char base64url SHA-256). */
|
|
93
102
|
export function isAth(value) {
|
|
94
|
-
return typeof value === 'string' &&
|
|
103
|
+
return typeof value === 'string' && IS_ATH_RE.test(value);
|
|
95
104
|
}
|
|
96
105
|
/** Same shape test, named for the `cnf.jkt` call sites. */
|
|
97
106
|
export const isJwkThumbprint = isAth;
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
* the React Native app can read it, and a Node-only import here would break
|
|
68
68
|
* both bundles at a distance.
|
|
69
69
|
*/
|
|
70
|
+
const ENGINE_ENV_NAME_RE = /-/g;
|
|
70
71
|
/** A slug usable as a directory name, a capability prefix and an event segment. */
|
|
71
72
|
const SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
72
73
|
function defineIdentity(identity) {
|
|
@@ -432,7 +433,7 @@ const ENGINE_ENV_SUFFIXES = Object.freeze({
|
|
|
432
433
|
sessionId: 'SESSION_ID',
|
|
433
434
|
});
|
|
434
435
|
function engineEnvName(appName, key) {
|
|
435
|
-
return `${appName.toUpperCase().replace(
|
|
436
|
+
return `${appName.toUpperCase().replace(ENGINE_ENV_NAME_RE, '_')}_${ENGINE_ENV_SUFFIXES[key]}`;
|
|
436
437
|
}
|
|
437
438
|
function engineEnvTable(appName) {
|
|
438
439
|
return Object.freeze(Object.fromEntries(Object.keys(ENGINE_ENV_SUFFIXES).map((key) => [
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* file spells the product.
|
|
27
27
|
*/
|
|
28
28
|
import { firstPartyHarnessArtifactSpellings, firstPartyHarnessDefaultFeedBase, firstPartyHarnessManifestFile, firstPartyHarnessSpellings, readFirstPartyHarnessEnv, } from './firstPartyHarness.js';
|
|
29
|
+
const RESOLVE_CHANNEL_MANIFEST_URL_RE = /\/+$/;
|
|
29
30
|
/** Channels in promotion order. Index order IS the promotion order. */
|
|
30
31
|
export const FIRST_PARTY_HARNESS_CHANNELS = ['internal', 'canary', 'beta', 'stable'];
|
|
31
32
|
/**
|
|
@@ -93,7 +94,7 @@ export function firstPartyHarnessChannelPrefix(channel) {
|
|
|
93
94
|
* spelling's prefix: the manifest's own path is not inside the signature.
|
|
94
95
|
*/
|
|
95
96
|
export function resolveChannelManifestUrl(input) {
|
|
96
|
-
const base = input.base.replace(
|
|
97
|
+
const base = input.base.replace(RESOLVE_CHANNEL_MANIFEST_URL_RE, '');
|
|
97
98
|
if (input.pinnedVersion) {
|
|
98
99
|
return `${base}/releases/${input.pinnedVersion}/${input.manifestFilename}`;
|
|
99
100
|
}
|
|
@@ -109,7 +110,7 @@ export function resolveChannelManifestUrl(input) {
|
|
|
109
110
|
*/
|
|
110
111
|
export function firstPartyHarnessFeedBase(env = process.env) {
|
|
111
112
|
const override = readFirstPartyHarnessEnv(env, 'updateFeedBase').value;
|
|
112
|
-
return (override || firstPartyHarnessDefaultFeedBase()).replace(
|
|
113
|
+
return (override || firstPartyHarnessDefaultFeedBase()).replace(RESOLVE_CHANNEL_MANIFEST_URL_RE, '');
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
116
|
* Every place a manifest may be published, in the order an installer should
|
|
@@ -138,7 +139,7 @@ export function firstPartyHarnessFeedBase(env = process.env) {
|
|
|
138
139
|
* since a dev feed staged by an older script names the file the old way.
|
|
139
140
|
*/
|
|
140
141
|
export function firstPartyHarnessFeedCandidates(env = process.env, options = {}) {
|
|
141
|
-
const override = readFirstPartyHarnessEnv(env, 'updateFeedBase').value?.replace(
|
|
142
|
+
const override = readFirstPartyHarnessEnv(env, 'updateFeedBase').value?.replace(RESOLVE_CHANNEL_MANIFEST_URL_RE, '');
|
|
142
143
|
const spellings = options.pinnedRelease
|
|
143
144
|
? firstPartyHarnessArtifactSpellings()
|
|
144
145
|
: firstPartyHarnessSpellings();
|
|
@@ -18,6 +18,7 @@ import { assessReleasePolicy, verifyReleasePolicy, } from './releasePolicy.js';
|
|
|
18
18
|
export { FIRST_PARTY_HARNESS_RELEASE_PUBLIC_KEYS } from './firstPartyHarnessReleaseKeys.js';
|
|
19
19
|
export { firstPartyHarnessFeedBase, firstPartyHarnessFeedCandidates, } from './firstPartyHarnessChannels.js';
|
|
20
20
|
export { firstPartyHarnessManifestFile } from './firstPartyHarness.js';
|
|
21
|
+
const VALIDATE_ARTIFACT_RE = /^[a-fA-F0-9]{64}$/;
|
|
21
22
|
export const PREVIOUS_SUFFIX = FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX;
|
|
22
23
|
export const PROVENANCE_SUFFIX = FIRST_PARTY_HARNESS_PROVENANCE_SUFFIX;
|
|
23
24
|
export const MAX_ARTIFACT_BYTES = 400 * 1024 * 1024;
|
|
@@ -479,7 +480,7 @@ function validateArtifact(options) {
|
|
|
479
480
|
typeof record.version !== 'string' ||
|
|
480
481
|
typeof record.platform !== 'string' ||
|
|
481
482
|
typeof record.sha256 !== 'string' ||
|
|
482
|
-
|
|
483
|
+
!VALIDATE_ARTIFACT_RE.test(record.sha256) ||
|
|
483
484
|
typeof record.url !== 'string' ||
|
|
484
485
|
typeof record.sig !== 'string' ||
|
|
485
486
|
!Buffer.isBuffer(options.binary))
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
const WORKFLOW_PATH_RE = /^\.github\/workflows\/[A-Za-z0-9_. /-]+$/;
|
|
2
|
+
const CLASSIFY_GIT_HUB_PUSH_REFUSAL_PATTERN = /refusing to allow (?:a|an) (GitHub App|OAuth App|Personal Access Token) to create or update workflow [`'"]([^`'"\r\n]+)[`'"] without [`'"]workflows?[`'"] (?:permission|scope)/gi;
|
|
1
3
|
/** GitHub push diagnostics must never escape this parser as raw stderr. */
|
|
2
4
|
export const GITHUB_WORKFLOW_PERMISSION_REQUIRED = 'github_workflow_permission_required';
|
|
3
5
|
function workflowPath(value) {
|
|
4
6
|
if (typeof value !== 'string' || value.length > 240)
|
|
5
7
|
return null;
|
|
6
8
|
const path = value.replaceAll('\\', '/');
|
|
7
|
-
if (
|
|
9
|
+
if (!WORKFLOW_PATH_RE.test(path))
|
|
8
10
|
return null;
|
|
9
11
|
const parts = path.split('/');
|
|
10
12
|
if (parts.some((part) => !part.trim() || part !== part.trim() || part === '.' || part === '..'))
|
|
@@ -20,10 +22,9 @@ export function classifyGitHubPushRefusal(text) {
|
|
|
20
22
|
// Bound parsing work. Git prints the rejection LAST, after any amount of
|
|
21
23
|
// progress output, so keep the tail; truncated diagnostics keep the generic refusal.
|
|
22
24
|
const input = text.slice(-64 * 1024);
|
|
23
|
-
const pattern = /refusing to allow (?:a|an) (GitHub App|OAuth App|Personal Access Token) to create or update workflow [`'"]([^`'"\r\n]+)[`'"] without [`'"]workflows?[`'"] (?:permission|scope)/gi;
|
|
24
25
|
const paths = [];
|
|
25
26
|
let tokenKind = 'unknown';
|
|
26
|
-
for (const match of input.matchAll(
|
|
27
|
+
for (const match of input.matchAll(CLASSIFY_GIT_HUB_PUSH_REFUSAL_PATTERN)) {
|
|
27
28
|
const path = workflowPath(match[2]);
|
|
28
29
|
if (!path)
|
|
29
30
|
continue;
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
* This package cannot import it (it sits below it), so `guidedUpdate.test.ts` reads
|
|
40
40
|
* that file and fails when a list mirrored here drifts from it.
|
|
41
41
|
*/
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// The slice of the owner API's view this module reads.
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
const SANITIZE_BLOCKER_TEXT_RE = /\s+/g;
|
|
42
46
|
/** The server sources that can only veto. `daemon_report` is the only one that grants. */
|
|
43
47
|
export const GUIDED_SERVER_SOURCES = [
|
|
44
48
|
'claims',
|
|
@@ -175,7 +179,7 @@ export function sanitizeBlockerText(value, max = BLOCKER_TEXT_MAX) {
|
|
|
175
179
|
return code < 0x20 || code === 0x7f ? ' ' : ch;
|
|
176
180
|
})
|
|
177
181
|
.join('')
|
|
178
|
-
.replace(
|
|
182
|
+
.replace(SANITIZE_BLOCKER_TEXT_RE, ' ')
|
|
179
183
|
.trim();
|
|
180
184
|
if (!cleaned || PATHLIKE.test(cleaned))
|
|
181
185
|
return undefined;
|
|
@@ -2,6 +2,11 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { assertMayMutateLiveState } from './liveState.js';
|
|
5
|
+
const VALID_SECRET_RE = /^[A-Za-z0-9_-]{43}$/;
|
|
6
|
+
const RESERVE_INDEPENDENT_MACHINE_PROFILE_RE = /^[a-fA-F0-9]{24}$/;
|
|
7
|
+
const READ_INDEPENDENT_MACHINE_RESERVATION_RE = /^[a-f0-9]{24}$/;
|
|
8
|
+
const READ_INDEPENDENT_MACHINE_RESERVATION_RE_2 = /^[a-f0-9]{64}$/;
|
|
9
|
+
const READ_INDEPENDENT_MACHINE_RESERVATION_RE_3 = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
5
10
|
/** The desktop reserves a new profile for every background authorization. */
|
|
6
11
|
export const INDEPENDENT_MACHINE_PROFILE_RE = /^desktop-bg-[a-f0-9]{32}$/;
|
|
7
12
|
export const INDEPENDENT_MACHINE_RESERVATION_FILE = 'independent-machine-attempt.json';
|
|
@@ -17,7 +22,7 @@ function canonicalOrigin(input) {
|
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
24
|
function validSecret(secret) {
|
|
20
|
-
return typeof secret === 'string' &&
|
|
25
|
+
return typeof secret === 'string' && VALID_SECRET_RE.test(secret) &&
|
|
21
26
|
Buffer.from(secret, 'base64url').length === 32 &&
|
|
22
27
|
Buffer.from(secret, 'base64url').toString('base64url') === secret;
|
|
23
28
|
}
|
|
@@ -34,7 +39,7 @@ function reservationPath(root, profile) {
|
|
|
34
39
|
/** Reserve a previously absent profile and persist the encrypted attempt secret.
|
|
35
40
|
* `encrypt` must use the platform secure store and throw if it is unavailable. */
|
|
36
41
|
export function reserveIndependentMachineProfile(options) {
|
|
37
|
-
if (!path.isAbsolute(options.root) ||
|
|
42
|
+
if (!path.isAbsolute(options.root) || !RESERVE_INDEPENDENT_MACHINE_PROFILE_RE.test(options.ownerId) ||
|
|
38
43
|
!canonicalOrigin(options.origin))
|
|
39
44
|
throw new Error('Invalid background authorization context');
|
|
40
45
|
const secret = crypto.randomBytes(32).toString('base64url');
|
|
@@ -113,10 +118,10 @@ export function readIndependentMachineReservation(root, profile) {
|
|
|
113
118
|
}
|
|
114
119
|
const value = JSON.parse(raw);
|
|
115
120
|
if (value.version !== 2 || value.profile !== profile ||
|
|
116
|
-
typeof value.ownerId !== 'string' ||
|
|
121
|
+
typeof value.ownerId !== 'string' || !READ_INDEPENDENT_MACHINE_RESERVATION_RE.test(value.ownerId) ||
|
|
117
122
|
typeof value.origin !== 'string' || !canonicalOrigin(value.origin) ||
|
|
118
|
-
typeof value.secretHash !== 'string' ||
|
|
119
|
-
typeof value.encryptedSecret !== 'string' ||
|
|
123
|
+
typeof value.secretHash !== 'string' || !READ_INDEPENDENT_MACHINE_RESERVATION_RE_2.test(value.secretHash) ||
|
|
124
|
+
typeof value.encryptedSecret !== 'string' || !READ_INDEPENDENT_MACHINE_RESERVATION_RE_3.test(value.encryptedSecret) ||
|
|
120
125
|
typeof value.createdAt !== 'string' || !Number.isFinite(Date.parse(value.createdAt)))
|
|
121
126
|
return null;
|
|
122
127
|
return value;
|
|
@@ -59,6 +59,8 @@ import { KekUnavailableError } from './types.js';
|
|
|
59
59
|
import { registerZeroizeHook } from './zeroize-registry.js';
|
|
60
60
|
import { MASTER_KEK_KEYCHAIN_ACCOUNT, MASTER_KEK_KEYCHAIN_SERVICE } from './masterKekService.js';
|
|
61
61
|
import { assertMayMutateLiveKeychain, rethrowIfLiveStateRefusal } from '../liveState.js';
|
|
62
|
+
const RESOLVE_LOGIN_KEYCHAIN_RE = /"([^"]+)"/;
|
|
63
|
+
const READ_KEK_FROM_KEYCHAIN_RE = /\n$/;
|
|
62
64
|
/**
|
|
63
65
|
* Stable telemetry kind string — fleet dashboards size the macOS cohort
|
|
64
66
|
* by this value. Only one backend ships in this module today.
|
|
@@ -174,7 +176,7 @@ async function resolveLoginKeychain() {
|
|
|
174
176
|
const { stdout } = await exec('security', ['default-keychain', '-d', 'user']);
|
|
175
177
|
// Output shape: ` "/Users/foo/Library/Keychains/login.keychain-db"`
|
|
176
178
|
// (leading whitespace, then the path quoted)
|
|
177
|
-
const match = stdout.match(
|
|
179
|
+
const match = stdout.match(RESOLVE_LOGIN_KEYCHAIN_RE);
|
|
178
180
|
if (match && match[1] && fs.existsSync(match[1])) {
|
|
179
181
|
_resolvedKeychainCache = match[1];
|
|
180
182
|
return _resolvedKeychainCache;
|
|
@@ -240,7 +242,7 @@ async function readKekFromKeychain(service, account) {
|
|
|
240
242
|
'-w',
|
|
241
243
|
keychainPath,
|
|
242
244
|
]);
|
|
243
|
-
const trimmed = stdout.replace(
|
|
245
|
+
const trimmed = stdout.replace(READ_KEK_FROM_KEYCHAIN_RE, '').trim();
|
|
244
246
|
if (trimmed.length === 0)
|
|
245
247
|
return null;
|
|
246
248
|
let raw;
|
|
@@ -40,6 +40,8 @@ import os from 'node:os';
|
|
|
40
40
|
import path from 'node:path';
|
|
41
41
|
import { MASTER_KEK_KEYCHAIN_SERVICE } from './kek/masterKekService.js';
|
|
42
42
|
import { CONFIG_DIR_NAME, LEGACY_NATIVE_ID_PREFIXES, NATIVE_ID_PREFIX } from './localIdentity.js';
|
|
43
|
+
const USER_DATABASE_HOME_RE = /^NFSHomeDirectory:\s*/;
|
|
44
|
+
const KEYCHAIN_SUFFIX_FOR_DIR_RE = /\/+$/;
|
|
43
45
|
/** Directory name of the state root inside a home directory. */
|
|
44
46
|
export { CONFIG_DIR_NAME };
|
|
45
47
|
/** Opt-in for a deliberate check against the machine's real state. */
|
|
@@ -113,7 +115,7 @@ function userDatabaseHome() {
|
|
|
113
115
|
`/Users/${os.userInfo().username}`,
|
|
114
116
|
'NFSHomeDirectory',
|
|
115
117
|
]);
|
|
116
|
-
const home = out.replace(
|
|
118
|
+
const home = out.replace(USER_DATABASE_HOME_RE, '').trim();
|
|
117
119
|
return home || null;
|
|
118
120
|
}
|
|
119
121
|
if (process.platform === 'linux' && typeof process.getuid === 'function') {
|
|
@@ -314,7 +316,7 @@ export const LIVE_DEFAULT_PROFILE = 'default';
|
|
|
314
316
|
* their own `~/.skrr/` get distinct names and cannot read each other's tokens.
|
|
315
317
|
*/
|
|
316
318
|
export function keychainSuffixForDir(dir) {
|
|
317
|
-
const resolved = path.resolve(dir.replace(
|
|
319
|
+
const resolved = path.resolve(dir.replace(KEYCHAIN_SUFFIX_FOR_DIR_RE, ''));
|
|
318
320
|
return `-${createHash('sha256').update(resolved).digest('hex').toLowerCase().slice(0, 8)}`;
|
|
319
321
|
}
|
|
320
322
|
/** A per-profile default-profile service whose hash we cannot verify without the real home. */
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
import { generateState, generateVerifier, challenge as pkceChallenge } from './pkce.js';
|
|
74
74
|
import { startLocalCallback } from './loginLocalhost.js';
|
|
75
75
|
import { getAuthLogger } from './runtime.js';
|
|
76
|
+
const LOGIN_WITH_LOCALHOST_RE = /\/+$/;
|
|
76
77
|
/** Default scope for new daemon installs. */
|
|
77
78
|
const DEFAULT_SCOPE = 'daemon';
|
|
78
79
|
// ---------------------------------------------------------------------
|
|
@@ -124,7 +125,7 @@ export async function loginWithLocalhost(opts) {
|
|
|
124
125
|
throw new TypeError('loginWithLocalhost: globalThis.fetch is missing — pass fetchImpl or run under Node ≥ 20');
|
|
125
126
|
}
|
|
126
127
|
const scope = opts.scope ?? DEFAULT_SCOPE;
|
|
127
|
-
const serverUrl = opts.serverUrl.replace(
|
|
128
|
+
const serverUrl = opts.serverUrl.replace(LOGIN_WITH_LOCALHOST_RE, '');
|
|
128
129
|
// Step 1+2: PKCE primitives. The verifier never leaves this
|
|
129
130
|
// function's local scope until step 9.
|
|
130
131
|
const codeVerifier = generateVerifier();
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
import dns from 'node:dns';
|
|
42
42
|
import http from 'node:http';
|
|
43
43
|
import net from 'node:net';
|
|
44
|
+
const IS_LOOPBACK_ADDRESS_RE = /^([0-9a-f]{1,4}):[0-9a-f]{1,4}$/;
|
|
44
45
|
/** Loopback host names this client will connect to, besides 127/8 and ::1 literals. */
|
|
45
46
|
const LOOPBACK_NAMES = new Set(['localhost']);
|
|
46
47
|
/** Upper bound on a buffered response body. Loopback control-plane bodies are small. */
|
|
@@ -71,7 +72,7 @@ export function isLoopbackAddress(address) {
|
|
|
71
72
|
const rest = value.slice('::ffff:'.length);
|
|
72
73
|
if (net.isIPv4(rest))
|
|
73
74
|
return isLoopbackAddress(rest);
|
|
74
|
-
const high =
|
|
75
|
+
const high = IS_LOOPBACK_ADDRESS_RE.exec(rest);
|
|
75
76
|
return high ? parseInt(high[1], 16) >> 8 === 127 : false;
|
|
76
77
|
}
|
|
77
78
|
return false;
|
|
@@ -31,6 +31,8 @@ import { execFileSync } from 'node:child_process';
|
|
|
31
31
|
import { resolveConfigRoot } from './configRoot.js';
|
|
32
32
|
import { rethrowIfLiveStateRefusal } from './liveState.js';
|
|
33
33
|
import { ensureStateDir, renameStateFile, writeStateFile } from './stateFiles.js';
|
|
34
|
+
const READ_MACHINE_UUID_DARWIN_RE = /IOPlatformUUID"?\s*=\s*"?([0-9A-F-]{36})/i;
|
|
35
|
+
const READ_MACHINE_UUID_WINDOWS_RE = /MachineGuid\s+REG_SZ\s+([0-9A-Fa-f-]{36})/;
|
|
34
36
|
/**
|
|
35
37
|
* Daemon sources whose identity is ISSUED by the control plane rather than
|
|
36
38
|
* derived from the host: the provisioner mints the daemon id and machine uuid
|
|
@@ -71,7 +73,7 @@ function readMachineUuidDarwin() {
|
|
|
71
73
|
timeout: 2_000,
|
|
72
74
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
73
75
|
});
|
|
74
|
-
const match = out.match(
|
|
76
|
+
const match = out.match(READ_MACHINE_UUID_DARWIN_RE);
|
|
75
77
|
return match ? match[1].toLowerCase() : null;
|
|
76
78
|
}
|
|
77
79
|
catch {
|
|
@@ -94,7 +96,7 @@ function readMachineUuidLinux() {
|
|
|
94
96
|
function readMachineUuidWindows() {
|
|
95
97
|
try {
|
|
96
98
|
const out = execFileSync('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\Cryptography', '/v', 'MachineGuid'], { encoding: 'utf-8', timeout: 2_000, stdio: ['ignore', 'pipe', 'ignore'] });
|
|
97
|
-
const match = out.match(
|
|
99
|
+
const match = out.match(READ_MACHINE_UUID_WINDOWS_RE);
|
|
98
100
|
return match ? match[1].toLowerCase() : null;
|
|
99
101
|
}
|
|
100
102
|
catch {
|
|
@@ -74,6 +74,7 @@ import fs from 'node:fs';
|
|
|
74
74
|
import path from 'node:path';
|
|
75
75
|
import { getAuthConfigDir, getAuthMachineConfigDir } from './runtime.js';
|
|
76
76
|
import { atomicWrite0600, renameStateFile } from './stateFiles.js';
|
|
77
|
+
const MOVE_ASIDE_RE = /[:.]/g;
|
|
77
78
|
/** Directory segment that separates per-profile state from machine-scoped state. */
|
|
78
79
|
export const PROFILES_SEGMENT = 'profiles';
|
|
79
80
|
/**
|
|
@@ -302,7 +303,7 @@ function adopt(fromDir, toDir, files, dryRun) {
|
|
|
302
303
|
return { written, supersededAside: [] };
|
|
303
304
|
}
|
|
304
305
|
function moveAside(dir, files, suffix = SUPERSEDED_COPY_SUFFIX) {
|
|
305
|
-
const stamp = new Date().toISOString().replace(
|
|
306
|
+
const stamp = new Date().toISOString().replace(MOVE_ASIDE_RE, '-');
|
|
306
307
|
const aside = [];
|
|
307
308
|
for (const name of files) {
|
|
308
309
|
const target = path.join(dir, name);
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* RFC 4648 base32 alphabet: A–Z, 2–7.
|
|
20
20
|
* No npm deps — Node.js built-ins only, same philosophy as pkce.ts.
|
|
21
21
|
*/
|
|
22
|
+
const NORMALIZE_RAW_RE = /[\s-]/g;
|
|
22
23
|
const BASE32_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
|
23
24
|
/** Number of base32 characters needed to encode 32 bytes.
|
|
24
25
|
* 256 bits / 5 bits-per-char = 51.2 → ceil = 52 significant chars.
|
|
@@ -99,7 +100,7 @@ function base32ToBytes(chars) {
|
|
|
99
100
|
* Throws with `code: 'INVALID_RECOVERY_CODE_ALPHABET'` on any illegal char.
|
|
100
101
|
*/
|
|
101
102
|
function normalizeRaw(input) {
|
|
102
|
-
const upper = input.toUpperCase().replace(
|
|
103
|
+
const upper = input.toUpperCase().replace(NORMALIZE_RAW_RE, '');
|
|
103
104
|
for (let i = 0; i < upper.length; i++) {
|
|
104
105
|
const ch = upper[i];
|
|
105
106
|
const code = ch.charCodeAt(0);
|
|
@@ -29,6 +29,7 @@ import { rethrowIfLiveStateRefusal } from './liveState.js';
|
|
|
29
29
|
import { permanentReasonForRefreshCode } from './refreshClassification.js';
|
|
30
30
|
import { ensureStateDir, removeStateFile, writeStateFile } from './stateFiles.js';
|
|
31
31
|
import { PermanentAuthFailure, TransientAuthFailure, } from './types.js';
|
|
32
|
+
const REVOKE_DAEMON_REFRESH_SESSION_REPORTED_RE = /\/+$/;
|
|
32
33
|
/**
|
|
33
34
|
* P1-6: Reduced from 30 s to 5 s.
|
|
34
35
|
*
|
|
@@ -563,7 +564,7 @@ export async function revokeDaemonRefreshSession(serverUrl, refreshToken) {
|
|
|
563
564
|
export async function revokeDaemonRefreshSessionReported(serverUrl, refreshToken) {
|
|
564
565
|
if (!refreshToken)
|
|
565
566
|
return { outcome: 'unreachable', detail: 'no refresh token to present' };
|
|
566
|
-
const url = `${serverUrl.replace(
|
|
567
|
+
const url = `${serverUrl.replace(REVOKE_DAEMON_REFRESH_SESSION_REPORTED_RE, '')}/api/daemons/token/revoke`;
|
|
567
568
|
const controller = new AbortController();
|
|
568
569
|
const timer = setTimeout(() => controller.abort(), 5_000);
|
|
569
570
|
// H1 — SHA-256 hex digest matches the server's `hashRefreshToken`
|
|
@@ -600,7 +601,7 @@ async function doRefresh(serverUrl, currentRefreshToken, daemonId, options = {})
|
|
|
600
601
|
success: true,
|
|
601
602
|
metadata: { event: 'refresh_start', daemonId },
|
|
602
603
|
});
|
|
603
|
-
const url = `${serverUrl.replace(
|
|
604
|
+
const url = `${serverUrl.replace(REVOKE_DAEMON_REFRESH_SESSION_REPORTED_RE, '')}/api/daemons/token/refresh`;
|
|
604
605
|
// Build body with machineUuid only when supplied — preserves backward
|
|
605
606
|
// compat with older servers that ignore unknown fields. The server's
|
|
606
607
|
// soft-binding check (H7) tolerates either side missing the field.
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { createHash, createPublicKey, verify as verifyEd25519 } from 'node:crypto';
|
|
11
11
|
import { OVERSKY_RELEASE_PUBLIC_KEYS } from './releaseKeys.js';
|
|
12
|
+
const POLICY_SHAPE_IS_VALID_RE = /^[0-9A-Za-z._:-]+$/;
|
|
12
13
|
const MAX_SIGS = 8;
|
|
13
14
|
function stableJson(value) {
|
|
14
15
|
if (value === null ||
|
|
@@ -58,7 +59,7 @@ function policyShapeIsValid(policy) {
|
|
|
58
59
|
if (!policy ||
|
|
59
60
|
typeof policy !== 'object' ||
|
|
60
61
|
policy.schemaVersion !== 1 ||
|
|
61
|
-
|
|
62
|
+
!POLICY_SHAPE_IS_VALID_RE.test(policy.releaseId) ||
|
|
62
63
|
!['stable', 'canary', 'beta', 'internal'].includes(policy.channel) ||
|
|
63
64
|
!Number.isInteger(policy.rolloutBasisPoints) ||
|
|
64
65
|
policy.rolloutBasisPoints < 0 ||
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
const PARSE_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
2
|
+
const PARSE_RE_2 = /^\d+$/;
|
|
1
3
|
/** SemVer precedence shared by every local release consumer. Invalid inputs are never ordered. */
|
|
2
4
|
export function compareReleaseVersions(a, b) {
|
|
3
5
|
const parse = (value) => {
|
|
4
6
|
if (typeof value !== 'string')
|
|
5
7
|
return null;
|
|
6
|
-
const match =
|
|
8
|
+
const match = PARSE_RE.exec(value.trim());
|
|
7
9
|
if (!match)
|
|
8
10
|
return null;
|
|
9
11
|
const prerelease = match[4]?.split('.') ?? [];
|
|
10
|
-
if (prerelease.some((part) =>
|
|
12
|
+
if (prerelease.some((part) => PARSE_RE_2.test(part) && part.length > 1 && part[0] === '0'))
|
|
11
13
|
return null;
|
|
12
14
|
return { core: match.slice(1, 4).map(BigInt), prerelease };
|
|
13
15
|
};
|
|
@@ -29,8 +31,8 @@ export function compareReleaseVersions(a, b) {
|
|
|
29
31
|
return l === r ? 0 : l === undefined ? -1 : 1;
|
|
30
32
|
if (l === r)
|
|
31
33
|
continue;
|
|
32
|
-
const ln =
|
|
33
|
-
const rn =
|
|
34
|
+
const ln = PARSE_RE_2.test(l);
|
|
35
|
+
const rn = PARSE_RE_2.test(r);
|
|
34
36
|
if (ln && rn)
|
|
35
37
|
return BigInt(l) < BigInt(r) ? -1 : 1;
|
|
36
38
|
if (ln !== rn)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { closeSync, constants, fstatSync, lstatSync, openSync, opendirSync, readSync, realpathSync, statSync } from 'node:fs';
|
|
3
3
|
import { dirname, extname, join, relative, resolve } from 'node:path';
|
|
4
|
+
const WALK_RE = /\.(?:test|spec)\.[cm]?js$/;
|
|
4
5
|
const CODE_EXTENSIONS = new Set(['.js', '.cjs', '.mjs', '.json', '.node', '.wasm']);
|
|
5
6
|
const OMIT_DIRECTORIES = new Set(['node_modules', '.git', '__tests__', '__fixtures__']);
|
|
6
7
|
const MAX_FILES = 25_000;
|
|
@@ -98,7 +99,7 @@ export function captureRestartArtifact(input) {
|
|
|
98
99
|
if (info.isDirectory()) {
|
|
99
100
|
walk(file, depth + 1);
|
|
100
101
|
}
|
|
101
|
-
else if (CODE_EXTENSIONS.has(extname(name)) &&
|
|
102
|
+
else if (CODE_EXTENSIONS.has(extname(name)) && !WALK_RE.test(name)) {
|
|
102
103
|
if (!info.isFile())
|
|
103
104
|
throw new Error('Restart build contains a linked or special code file');
|
|
104
105
|
addFile(file, relative(root, file).split('\\').join('/'));
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
* `cli/src/lib/first-party-harness.ts` (`engineSpawnEnv`). Do not soften the list here to
|
|
39
39
|
* serve that case: a deny-list with a hole is not a deny-list.
|
|
40
40
|
*/
|
|
41
|
+
const APPEND_NO_PROXY_HOSTS_RE = /[\s,]+$/;
|
|
41
42
|
/**
|
|
42
43
|
* Env vars that must NEVER reach a spawned subprocess.
|
|
43
44
|
*
|
|
@@ -250,7 +251,7 @@ function appendNoProxyHosts(list, hosts) {
|
|
|
250
251
|
const missing = hosts.filter((host) => !entries.includes(host));
|
|
251
252
|
if (missing.length === 0)
|
|
252
253
|
return list;
|
|
253
|
-
const kept = list.replace(
|
|
254
|
+
const kept = list.replace(APPEND_NO_PROXY_HOSTS_RE, '');
|
|
254
255
|
return kept ? `${kept},${missing.join(',')}` : missing.join(',');
|
|
255
256
|
}
|
|
256
257
|
/**
|
|
@@ -55,6 +55,9 @@
|
|
|
55
55
|
* with it. Whatever cannot be scrubbed is reported to the caller as such (`false`), and the caller drops the
|
|
56
56
|
* record, because a record with the token still in it is exactly what this exists to prevent.
|
|
57
57
|
*/
|
|
58
|
+
const ESCAPED_LITERAL_RE = /[.*+?^${}()|[\]\\]/g;
|
|
59
|
+
const IS_QR_SIGN_IN_SECRET_FIELD_RE = /[_-]/g;
|
|
60
|
+
const REDACT_QR_SIGN_IN_TEXT_RE = /(?:^|[?&])direction=(?:mobile_approves_web|web_approves_mobile)(?:&|$)/;
|
|
58
61
|
/** What replaces a token. Fixed, so a trace can say a preview was involved but not which one. */
|
|
59
62
|
export const PREVIEW_TOKEN_REDACTION = 'pvw_[redacted]';
|
|
60
63
|
/**
|
|
@@ -92,7 +95,7 @@ const LEGACY_OPERATOR_CODE = new RegExp(`(adm)${UNDERSCORE}(?=[A-Za-z0-9_-]{43}(
|
|
|
92
95
|
/** QR locators have no identifying prefix, so match only their protocol locations. */
|
|
93
96
|
export const QR_SIGN_IN_REDACTION = '[redacted]';
|
|
94
97
|
const escapedLiteral = (value) => [...value].map((char) => {
|
|
95
|
-
const literal = char.replace(
|
|
98
|
+
const literal = char.replace(ESCAPED_LITERAL_RE, '\\$&');
|
|
96
99
|
return `(?:${literal}|%(?:25)*${char.charCodeAt(0).toString(16)})`;
|
|
97
100
|
}).join('');
|
|
98
101
|
const QR_REQUEST_PATH = new RegExp(`(${escapedLiteral('/api/auth/qr/requests/')})${TOKEN_CHAR}+`, 'gi');
|
|
@@ -104,7 +107,7 @@ const QR_SECRET_FIELDS = new Set([
|
|
|
104
107
|
/** Fields are protocol-specific; preserve ordinary request ids, error codes and metrics. */
|
|
105
108
|
export function isQrSignInSecretField(key) {
|
|
106
109
|
const leaf = key.split('.').pop() || '';
|
|
107
|
-
return QR_SECRET_FIELDS.has(leaf.replace(
|
|
110
|
+
return QR_SECRET_FIELDS.has(leaf.replace(IS_QR_SIGN_IN_SECRET_FIELD_RE, '').toLowerCase());
|
|
108
111
|
}
|
|
109
112
|
const QR_SECRET_ASSIGNMENT = /((?:["']?)(?:statusToken|claimToken|codeVerifier|codeChallenge|comparisonCode|status_token|claim_token|code_verifier|code_challenge|comparison_code)(?:["']?)\s*[:=]\s*["']?)([A-Za-z0-9._~%+-]+)/gi;
|
|
110
113
|
// OAuth callback queries may be exported detached from their URL. Redact
|
|
@@ -115,7 +118,9 @@ export function isOAuthQuerySecretField(key) {
|
|
|
115
118
|
return ['code', 'state', 'error_description', 'handoff'].includes(key.toLowerCase());
|
|
116
119
|
}
|
|
117
120
|
export function isOAuthQueryContainerField(key) {
|
|
118
|
-
const leaf = (key.split('.').pop() || '')
|
|
121
|
+
const leaf = (key.split('.').pop() || '')
|
|
122
|
+
.replace(IS_QR_SIGN_IN_SECRET_FIELD_RE, '')
|
|
123
|
+
.toLowerCase();
|
|
119
124
|
return leaf === 'query' || leaf === 'querystring';
|
|
120
125
|
}
|
|
121
126
|
export function isGraphHandoffCookieField(key) {
|
|
@@ -126,8 +131,9 @@ function redactQrSignInText(value) {
|
|
|
126
131
|
// Undici/Sentry may split url.query/query_string from its path. The QR's
|
|
127
132
|
// direction vocabulary identifies that standalone query without treating an
|
|
128
133
|
// ordinary application's `request` query key as a secret globally.
|
|
129
|
-
const standaloneQuery =
|
|
130
|
-
? value.replace(QR_REQUEST_QUERY, `$1$2${QR_SIGN_IN_REDACTION}`)
|
|
134
|
+
const standaloneQuery = REDACT_QR_SIGN_IN_TEXT_RE.test(value)
|
|
135
|
+
? value.replace(QR_REQUEST_QUERY, `$1$2${QR_SIGN_IN_REDACTION}`)
|
|
136
|
+
: value;
|
|
131
137
|
return standaloneQuery
|
|
132
138
|
.replace(QR_REQUEST_PATH, `$1${QR_SIGN_IN_REDACTION}`)
|
|
133
139
|
.replace(QR_LINK_QUERY, (_match, prefix, query) => prefix + query.replace(QR_REQUEST_QUERY, `$1$2${QR_SIGN_IN_REDACTION}`))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPublicKey, sign as signEd25519, verify as verifyEd25519, } from 'node:crypto';
|
|
2
2
|
import { ATTESTED_TOOL_APPROVAL_TTL_MS, canonicalApprovalJson, canonicalToolInputDigest, verifyAttestedToolApproval, verifyAttestedToolApprovalClaims, } from './daemonToolApproval.js';
|
|
3
|
+
const IS_EXECUTOR_LEASE_TEXT_RE = /[\u0000-\u001f]/;
|
|
3
4
|
/**
|
|
4
5
|
* Platform-signed tool approvals (OSK-16614) — attestation v2.
|
|
5
6
|
*
|
|
@@ -102,7 +103,7 @@ function isExecutorLeaseId(value) {
|
|
|
102
103
|
return typeof value === 'string' && EXECUTOR_LEASE_ID_PATTERN.test(value);
|
|
103
104
|
}
|
|
104
105
|
function isExecutorLeaseText(value, max = 128) {
|
|
105
|
-
return typeof value === 'string' && value.length > 0 && value.length <= max &&
|
|
106
|
+
return typeof value === 'string' && value.length > 0 && value.length <= max && !IS_EXECUTOR_LEASE_TEXT_RE.test(value);
|
|
106
107
|
}
|
|
107
108
|
function canonicalExecutorCapabilities(value) {
|
|
108
109
|
if (!Array.isArray(value) || value.length === 0 || value.length > MAX_EXECUTOR_LEASE_CAPABILITIES) {
|