@indigoai-us/hq-cli 5.345.219 → 5.345.220
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 +52 -0
- package/dist/command-catalog.generated.d.ts +25 -1
- package/dist/command-catalog.generated.js +31 -1
- package/dist/commands/bot.d.ts +48 -0
- package/dist/commands/bot.js +108 -8
- package/dist/commands/cloud.d.ts +16 -0
- package/dist/commands/cloud.js +112 -102
- package/dist/commands/core-checkpoint-native.d.ts +13 -0
- package/dist/commands/core-checkpoint-native.js +167 -52
- package/dist/commands/core-hook-registration-plan.js +5 -4
- package/dist/commands/daemon.js +21 -2
- package/dist/commands/integrations.js +84 -3
- package/dist/commands/packs.js +23 -0
- package/dist/commands/pkg-update.d.ts +6 -0
- package/dist/commands/pkg-update.js +15 -7
- package/dist/commands/run.js +55 -45
- package/dist/commands/sources.js +3 -2
- package/dist/lib/bot/fleet-cron.js +5 -2
- package/dist/lib/bot/inflight.d.ts +9 -0
- package/dist/lib/bot/jobs/hot-signal-sync.d.ts +51 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +90 -9
- package/dist/lib/bot/run.d.ts +29 -5
- package/dist/lib/bot/run.js +203 -1
- package/dist/lib/bot/signals-try-now.d.ts +76 -0
- package/dist/lib/bot/signals-try-now.js +111 -0
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +22 -3
- package/dist/lib/capacity/collectors/claude-oauth.js +78 -22
- package/dist/lib/capacity/scheduler.d.ts +8 -0
- package/dist/lib/capacity/scheduler.js +5 -2
- package/dist/lib/daemon/run.js +5 -0
- package/dist/lib/daemon/runtime-notifications.d.ts +7 -0
- package/dist/lib/daemon/runtime-notifications.js +50 -0
- package/dist/lib/doctor/checks/fleet-hook-core.d.ts +9 -1
- package/dist/lib/doctor/checks/fleet-hook-core.js +39 -15
- package/dist/lib/hook-engine/fleet-registration.d.ts +17 -5
- package/dist/lib/hook-engine/fleet-registration.js +53 -17
- package/dist/lib/hot-channels/alert.d.ts +10 -1
- package/dist/lib/hot-channels/alert.js +34 -7
- package/dist/lib/hot-channels/signals-claude-login.d.ts +53 -0
- package/dist/lib/hot-channels/signals-claude-login.js +96 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +17 -0
- package/dist/lib/hot-channels/signals-pass.js +31 -3
- package/dist/lib/search-index/index.js +11 -1
- package/dist/lib/signals/engine.d.ts +1 -0
- package/dist/lib/signals/engine.js +7 -0
- package/dist/lib/signals/reply.d.ts +48 -0
- package/dist/lib/signals/reply.js +72 -11
- package/dist/lib/signals/steps/adapters.js +6 -0
- package/dist/lib/signals/steps/extract.d.ts +50 -3
- package/dist/lib/signals/steps/extract.js +100 -17
- package/dist/lib/signals/steps/types.d.ts +19 -0
- package/dist/lib/sync-core/engine-home.d.ts +6 -1
- package/dist/lib/sync-core/engine-home.js +13 -3
- package/dist/lib/sync-core/reconcile.js +1 -1
- package/dist/lib/sync-core/release-compare.d.ts +7 -0
- package/dist/lib/sync-core/release-compare.js +16 -0
- package/dist/lib/sync-core/release.d.ts +2 -1
- package/dist/lib/sync-core/release.js +2 -10
- package/dist/run/schema-env-overrides.d.ts +24 -0
- package/dist/run/schema-env-overrides.js +72 -0
- package/dist/utils/host-registration.d.ts +1 -1
- package/dist/utils/host-registration.js +4 -0
- package/package.json +13 -9
- package/scripts/check-function-manifest.mjs +5 -4
- package/dist/commands/__fixtures__/access-vault.d.ts +0 -95
- package/dist/commands/__fixtures__/access-vault.js +0 -166
- package/dist/commands/__fixtures__/make-tar.d.ts +0 -38
- package/dist/commands/__fixtures__/make-tar.js +0 -102
- package/dist/commands/secrets-public-types.test-d.d.ts +0 -2
- package/dist/commands/secrets-public-types.test-d.js +0 -18
- package/dist/lib/decisions/fixtures/us001.d.ts +0 -137
- package/dist/lib/decisions/fixtures/us001.js +0 -21
- package/dist/lib/doctor/__testing__/fake-hq-tree.d.ts +0 -226
- package/dist/lib/doctor/__testing__/fake-hq-tree.js +0 -408
- package/dist/lib/doctor/__testing__/run-doctor.d.ts +0 -8
- package/dist/lib/doctor/__testing__/run-doctor.js +0 -69
- package/dist/lib/fingerprint/fixtures.d.ts +0 -19
- package/dist/lib/fingerprint/fixtures.js +0 -61
- package/dist/lib/hot-channels/adapters/__fixtures__/dummy.d.ts +0 -33
- package/dist/lib/hot-channels/adapters/__fixtures__/dummy.js +0 -53
- package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.d.ts +0 -38
- package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.js +0 -64
- package/dist/lib/mesh/live/daemon/mqtt-events.test-d.d.ts +0 -2
- package/dist/lib/mesh/live/daemon/mqtt-events.test-d.js +0 -10
- package/dist/lib/test-utils/isolated-flag-company-context.d.ts +0 -3
- package/dist/lib/test-utils/isolated-flag-company-context.js +0 -18
- package/scripts/hook-engine-manifest.mjs +0 -22
- package/scripts/mesh-daemon-if-stale.mjs +0 -20
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory vault / ACL / DM harness for the `hq access` command.
|
|
3
|
-
* No network I/O — listings, GetObject, STS vend, and DMs stay in process
|
|
4
|
-
* (or under a tmp hqRoot the caller supplies).
|
|
5
|
-
*/
|
|
6
|
-
import { vi } from "vitest";
|
|
7
|
-
import type { CompanyBrowseClientFactory, FilesBrowseVaultClient } from "../files-browse.js";
|
|
8
|
-
export type AccessVaultState = "missing" | "present-local" | "present-not-local" | "present-denied";
|
|
9
|
-
export interface FakeDmMessage {
|
|
10
|
-
recipient: string;
|
|
11
|
-
message: string;
|
|
12
|
-
prompt?: string;
|
|
13
|
-
details?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface FakeDmTransport {
|
|
16
|
-
sent: FakeDmMessage[];
|
|
17
|
-
send(msg: FakeDmMessage): Promise<{
|
|
18
|
-
eventId: string;
|
|
19
|
-
}>;
|
|
20
|
-
}
|
|
21
|
-
export declare function makeFakeDmTransport(): FakeDmTransport;
|
|
22
|
-
export interface AclEntry {
|
|
23
|
-
granteeType: string;
|
|
24
|
-
granteeId: string;
|
|
25
|
-
permission: string;
|
|
26
|
-
grantedBy: string;
|
|
27
|
-
grantedAt: string;
|
|
28
|
-
}
|
|
29
|
-
export interface AccessAclTree {
|
|
30
|
-
prefix: string;
|
|
31
|
-
direct: AclEntry[];
|
|
32
|
-
inherited: Array<AclEntry & {
|
|
33
|
-
sourcePrefix: string;
|
|
34
|
-
}>;
|
|
35
|
-
children: Array<AclEntry & {
|
|
36
|
-
sourcePrefix: string;
|
|
37
|
-
}>;
|
|
38
|
-
directRow: {
|
|
39
|
-
creatorUid: string;
|
|
40
|
-
open: boolean;
|
|
41
|
-
createdAt: string;
|
|
42
|
-
updatedAt: string;
|
|
43
|
-
} | null;
|
|
44
|
-
effectivePermission: string | null;
|
|
45
|
-
}
|
|
46
|
-
export interface AccessMember {
|
|
47
|
-
personUid: string;
|
|
48
|
-
personEmail: string;
|
|
49
|
-
personName?: string;
|
|
50
|
-
role: "owner" | "admin" | "member" | "guest";
|
|
51
|
-
}
|
|
52
|
-
export interface AccessVaultFixture {
|
|
53
|
-
state: AccessVaultState;
|
|
54
|
-
hqRoot: string;
|
|
55
|
-
companySlug: string;
|
|
56
|
-
companyUid: string;
|
|
57
|
-
/** Company-anchored e.g. companies/acme/knowledge/report.md */
|
|
58
|
-
key: string;
|
|
59
|
-
/** Company-relative e.g. knowledge/report.md */
|
|
60
|
-
bucketKey: string;
|
|
61
|
-
vaultClient: FilesBrowseVaultClient;
|
|
62
|
-
companyClient: CompanyBrowseClientFactory;
|
|
63
|
-
vend: ReturnType<typeof vi.fn>;
|
|
64
|
-
acl: AccessAclTree | null;
|
|
65
|
-
members: AccessMember[];
|
|
66
|
-
dm: FakeDmTransport;
|
|
67
|
-
listedKeys: string[];
|
|
68
|
-
region: string;
|
|
69
|
-
}
|
|
70
|
-
export interface MakeAccessFixtureOptions {
|
|
71
|
-
state: AccessVaultState;
|
|
72
|
-
hqRoot: string;
|
|
73
|
-
companySlug?: string;
|
|
74
|
-
key?: string;
|
|
75
|
-
extraKeys?: string[];
|
|
76
|
-
acl?: AccessAclTree | null;
|
|
77
|
-
members?: AccessMember[];
|
|
78
|
-
content?: string;
|
|
79
|
-
/**
|
|
80
|
-
* `present-denied` only: make the LIST call itself fail with 403 (the
|
|
81
|
-
* `/v1/files/list` shape) instead of returning the key. Models a caller
|
|
82
|
-
* without read on the prefix — the server refuses to enumerate.
|
|
83
|
-
*/
|
|
84
|
-
listDenied?: boolean;
|
|
85
|
-
/** present-denied only: let a test isolate list denial from vend denial. */
|
|
86
|
-
vendDenied?: boolean;
|
|
87
|
-
/** Deny only the ROOT (prefix "") list — the caller can read the prefix but not enumerate the bucket. */
|
|
88
|
-
rootListDenied?: boolean;
|
|
89
|
-
}
|
|
90
|
-
export declare function vendStatusForState(state: AccessVaultState): {
|
|
91
|
-
status: number;
|
|
92
|
-
message?: string;
|
|
93
|
-
};
|
|
94
|
-
export declare function makeAccessFixture(opts: MakeAccessFixtureOptions): AccessVaultFixture;
|
|
95
|
-
//# sourceMappingURL=access-vault.d.ts.map
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory vault / ACL / DM harness for the `hq access` command.
|
|
3
|
-
* No network I/O — listings, GetObject, STS vend, and DMs stay in process
|
|
4
|
-
* (or under a tmp hqRoot the caller supplies).
|
|
5
|
-
*/
|
|
6
|
-
import * as fs from "node:fs";
|
|
7
|
-
import * as path from "node:path";
|
|
8
|
-
import { Readable } from "node:stream";
|
|
9
|
-
import { vi } from "vitest";
|
|
10
|
-
import { ListObjectsV2Command, GetObjectCommand, } from "@aws-sdk/client-s3";
|
|
11
|
-
export function makeFakeDmTransport() {
|
|
12
|
-
const sent = [];
|
|
13
|
-
let n = 0;
|
|
14
|
-
return {
|
|
15
|
-
sent,
|
|
16
|
-
async send(msg) {
|
|
17
|
-
sent.push(msg);
|
|
18
|
-
n += 1;
|
|
19
|
-
return { eventId: `evt_${n}` };
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
const FAKE_VEND = {
|
|
24
|
-
credentials: {
|
|
25
|
-
accessKeyId: "ASIA-test",
|
|
26
|
-
secretAccessKey: "secret-test",
|
|
27
|
-
sessionToken: "session-test",
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
const DEFAULT_MEMBERS = [
|
|
31
|
-
{
|
|
32
|
-
personUid: "prs_owner",
|
|
33
|
-
personEmail: "owner@example.com",
|
|
34
|
-
personName: "Olive Owner",
|
|
35
|
-
role: "owner",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
personUid: "prs_admin",
|
|
39
|
-
personEmail: "admin@example.com",
|
|
40
|
-
personName: "Adam Admin",
|
|
41
|
-
role: "admin",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
personUid: "prs_me",
|
|
45
|
-
personEmail: "me@example.com",
|
|
46
|
-
personName: "Mia Member",
|
|
47
|
-
role: "member",
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
export function vendStatusForState(state) {
|
|
51
|
-
if (state === "missing")
|
|
52
|
-
return { status: 404 };
|
|
53
|
-
if (state === "present-denied") {
|
|
54
|
-
return { status: 403, message: "caller lacks read on this prefix" };
|
|
55
|
-
}
|
|
56
|
-
return { status: 200 };
|
|
57
|
-
}
|
|
58
|
-
function attachStatus(err, status) {
|
|
59
|
-
const tagged = err;
|
|
60
|
-
tagged.status = status;
|
|
61
|
-
return tagged;
|
|
62
|
-
}
|
|
63
|
-
function attachHttpStatus(err, httpStatusCode) {
|
|
64
|
-
const tagged = err;
|
|
65
|
-
tagged.$metadata = { httpStatusCode };
|
|
66
|
-
return tagged;
|
|
67
|
-
}
|
|
68
|
-
function toBucketKey(key, slug) {
|
|
69
|
-
const prefix = `companies/${slug}/`;
|
|
70
|
-
const trimmed = key.replace(/^\/+/, "");
|
|
71
|
-
if (trimmed.startsWith(prefix))
|
|
72
|
-
return trimmed.slice(prefix.length);
|
|
73
|
-
return trimmed;
|
|
74
|
-
}
|
|
75
|
-
export function makeAccessFixture(opts) {
|
|
76
|
-
const companySlug = opts.companySlug ?? "acme";
|
|
77
|
-
const key = opts.key ?? `companies/${companySlug}/knowledge/report.md`;
|
|
78
|
-
const bucketKey = toBucketKey(key, companySlug);
|
|
79
|
-
const companyUid = `cmp_${companySlug}`;
|
|
80
|
-
const content = opts.content ?? "hello";
|
|
81
|
-
const extraKeys = opts.extraKeys ?? [];
|
|
82
|
-
const listedKeys = opts.state === "missing" ? [...extraKeys] : [...extraKeys, bucketKey];
|
|
83
|
-
const members = opts.members ?? DEFAULT_MEMBERS;
|
|
84
|
-
const acl = opts.acl === undefined ? null : opts.acl;
|
|
85
|
-
const region = "us-east-1";
|
|
86
|
-
const dm = makeFakeDmTransport();
|
|
87
|
-
if (opts.state === "present-local") {
|
|
88
|
-
const dest = path.join(opts.hqRoot, key);
|
|
89
|
-
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
90
|
-
fs.writeFileSync(dest, content, "utf-8");
|
|
91
|
-
}
|
|
92
|
-
const vend = vi.fn(async () => {
|
|
93
|
-
if (opts.state === "missing") {
|
|
94
|
-
throw attachStatus(new Error("not found (404)"), 404);
|
|
95
|
-
}
|
|
96
|
-
if (opts.state === "present-denied" && opts.vendDenied !== false) {
|
|
97
|
-
throw attachStatus(new Error("caller lacks read on this prefix (403)"), 403);
|
|
98
|
-
}
|
|
99
|
-
return FAKE_VEND;
|
|
100
|
-
});
|
|
101
|
-
const vendSelf = vi.fn(async () => FAKE_VEND);
|
|
102
|
-
const listMyExplicitGrants = vi.fn(async () => []);
|
|
103
|
-
const entityShape = {
|
|
104
|
-
uid: companyUid,
|
|
105
|
-
slug: companySlug,
|
|
106
|
-
name: companySlug,
|
|
107
|
-
bucketName: `hq-vault-cmp-${companySlug}`,
|
|
108
|
-
};
|
|
109
|
-
const findInMyNamespace = vi.fn(async () => entityShape);
|
|
110
|
-
const get = vi.fn(async () => entityShape);
|
|
111
|
-
const vaultClient = {
|
|
112
|
-
sts: { vend, vendSelf },
|
|
113
|
-
listMyExplicitGrants,
|
|
114
|
-
entity: { get, findInMyNamespace },
|
|
115
|
-
};
|
|
116
|
-
const listDenied = opts.state === "present-denied" && opts.listDenied === true;
|
|
117
|
-
const send = vi.fn(async (cmd) => {
|
|
118
|
-
if (cmd instanceof ListObjectsV2Command) {
|
|
119
|
-
const prefix = cmd.input.Prefix ?? "";
|
|
120
|
-
if (listDenied || (opts.rootListDenied === true && prefix === "")) {
|
|
121
|
-
throw Object.assign(new Error("files list failed (403)"), {
|
|
122
|
-
status: 403,
|
|
123
|
-
key: prefix,
|
|
124
|
-
company: companySlug,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
const Contents = listedKeys
|
|
128
|
-
.filter((k) => (prefix === "" ? true : k.startsWith(prefix)))
|
|
129
|
-
.map((Key) => ({
|
|
130
|
-
Key,
|
|
131
|
-
Size: content.length,
|
|
132
|
-
LastModified: new Date(),
|
|
133
|
-
}));
|
|
134
|
-
return { Contents };
|
|
135
|
-
}
|
|
136
|
-
if (cmd instanceof GetObjectCommand) {
|
|
137
|
-
const requested = cmd.input.Key ?? "";
|
|
138
|
-
if (opts.state === "missing" || requested !== bucketKey) {
|
|
139
|
-
throw attachHttpStatus(new Error("Not found (404)"), 404);
|
|
140
|
-
}
|
|
141
|
-
if (opts.state === "present-denied") {
|
|
142
|
-
throw attachHttpStatus(new Error("caller lacks read on this prefix"), 403);
|
|
143
|
-
}
|
|
144
|
-
return { Body: Readable.from([content]) };
|
|
145
|
-
}
|
|
146
|
-
throw new Error(`unexpected command: ${cmd}`);
|
|
147
|
-
});
|
|
148
|
-
const companyClient = vi.fn(() => ({ send }));
|
|
149
|
-
return {
|
|
150
|
-
state: opts.state,
|
|
151
|
-
hqRoot: opts.hqRoot,
|
|
152
|
-
companySlug,
|
|
153
|
-
companyUid,
|
|
154
|
-
key,
|
|
155
|
-
bucketKey,
|
|
156
|
-
vaultClient,
|
|
157
|
-
companyClient,
|
|
158
|
-
vend,
|
|
159
|
-
acl,
|
|
160
|
-
members,
|
|
161
|
-
dm,
|
|
162
|
-
listedKeys,
|
|
163
|
-
region,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=access-vault.js.map
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic, platform-independent malicious-tar fixture builder.
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS EXISTS (cross-platform zip-slip coverage). The adversarial
|
|
5
|
-
* safe-extract / marketplace-security suites need archives that GENUINELY carry
|
|
6
|
-
* hostile entries — a `../` traversal name, an absolute path, an escaping
|
|
7
|
-
* symlink/hardlink. The obvious approach (shell out to the system `tar` to
|
|
8
|
-
* CREATE the archive) is NOT portable: GNU tar (Linux / CI / prod Lambdas)
|
|
9
|
-
* STRIPS the leading `../` and absolute `/` when it WRITES an archive, so the
|
|
10
|
-
* resulting "malicious" fixture contains a benign `evil-escape` entry and the
|
|
11
|
-
* guard has nothing to reject — the test passes on macOS bsdtar (which
|
|
12
|
-
* preserves them) but fails on Linux. The guard itself is correct; only the
|
|
13
|
-
* fixture construction was platform-dependent.
|
|
14
|
-
*
|
|
15
|
-
* Fix: WRITE THE TAR BYTES DIRECTLY here. A tar archive is just a sequence of
|
|
16
|
-
* 512-byte ustar headers, each optionally followed by the file's content padded
|
|
17
|
-
* to a 512-byte boundary, terminated by two zero blocks. By emitting the bytes
|
|
18
|
-
* ourselves we control the recorded entry names verbatim — `../evil-escape`,
|
|
19
|
-
* `/tmp/evil`, a symlink with linkname `../../etc/passwd` — identically on every
|
|
20
|
-
* platform, with no create-time stripping. The reading side (`tar -tvf`, which
|
|
21
|
-
* safeExtractTarball's pre-flight uses) does NOT strip anything; it faithfully
|
|
22
|
-
* lists whatever bytes we wrote, so the guard sees the real attack everywhere.
|
|
23
|
-
*/
|
|
24
|
-
/** ustar typeflag values we use. */
|
|
25
|
-
type TarType = 'file' | 'symlink' | 'hardlink';
|
|
26
|
-
export interface TarEntrySpec {
|
|
27
|
-
/** Recorded entry name — written VERBATIM (may contain `..`, be absolute…). */
|
|
28
|
-
name: string;
|
|
29
|
-
type?: TarType;
|
|
30
|
-
/** For sym/hardlinks: the recorded link target (also written verbatim). */
|
|
31
|
-
linkname?: string;
|
|
32
|
-
/** File content (regular files only). */
|
|
33
|
-
content?: string | Buffer;
|
|
34
|
-
}
|
|
35
|
-
/** Build the tar, gzip it, and write it to `outPath`. Returns `outPath`. */
|
|
36
|
-
export declare function writeMaliciousTarGz(outPath: string, entries: TarEntrySpec[]): string;
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=make-tar.d.ts.map
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic, platform-independent malicious-tar fixture builder.
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS EXISTS (cross-platform zip-slip coverage). The adversarial
|
|
5
|
-
* safe-extract / marketplace-security suites need archives that GENUINELY carry
|
|
6
|
-
* hostile entries — a `../` traversal name, an absolute path, an escaping
|
|
7
|
-
* symlink/hardlink. The obvious approach (shell out to the system `tar` to
|
|
8
|
-
* CREATE the archive) is NOT portable: GNU tar (Linux / CI / prod Lambdas)
|
|
9
|
-
* STRIPS the leading `../` and absolute `/` when it WRITES an archive, so the
|
|
10
|
-
* resulting "malicious" fixture contains a benign `evil-escape` entry and the
|
|
11
|
-
* guard has nothing to reject — the test passes on macOS bsdtar (which
|
|
12
|
-
* preserves them) but fails on Linux. The guard itself is correct; only the
|
|
13
|
-
* fixture construction was platform-dependent.
|
|
14
|
-
*
|
|
15
|
-
* Fix: WRITE THE TAR BYTES DIRECTLY here. A tar archive is just a sequence of
|
|
16
|
-
* 512-byte ustar headers, each optionally followed by the file's content padded
|
|
17
|
-
* to a 512-byte boundary, terminated by two zero blocks. By emitting the bytes
|
|
18
|
-
* ourselves we control the recorded entry names verbatim — `../evil-escape`,
|
|
19
|
-
* `/tmp/evil`, a symlink with linkname `../../etc/passwd` — identically on every
|
|
20
|
-
* platform, with no create-time stripping. The reading side (`tar -tvf`, which
|
|
21
|
-
* safeExtractTarball's pre-flight uses) does NOT strip anything; it faithfully
|
|
22
|
-
* lists whatever bytes we wrote, so the guard sees the real attack everywhere.
|
|
23
|
-
*/
|
|
24
|
-
import { gzipSync } from 'node:zlib';
|
|
25
|
-
import * as fs from 'node:fs';
|
|
26
|
-
const BLOCK = 512;
|
|
27
|
-
const TYPEFLAG = {
|
|
28
|
-
file: '0', // regular file
|
|
29
|
-
symlink: '2', // symbolic link
|
|
30
|
-
hardlink: '1', // hard link
|
|
31
|
-
};
|
|
32
|
-
/** Write an ASCII string into a fixed-width field at `offset`, NUL-padded. */
|
|
33
|
-
function writeField(buf, offset, width, value) {
|
|
34
|
-
// Truncate defensively; ustar fields are fixed-width.
|
|
35
|
-
const s = value.slice(0, width);
|
|
36
|
-
buf.write(s, offset, 'ascii');
|
|
37
|
-
// Remaining bytes are already 0 from Buffer.alloc.
|
|
38
|
-
}
|
|
39
|
-
/** Write an octal numeric field: `width-1` octal digits, space-or-NUL terminated. */
|
|
40
|
-
function writeOctal(buf, offset, width, value) {
|
|
41
|
-
// Classic ustar numeric field: zero-padded octal in (width-1) chars + NUL.
|
|
42
|
-
const digits = width - 1;
|
|
43
|
-
const oct = value.toString(8).padStart(digits, '0').slice(-digits);
|
|
44
|
-
buf.write(oct, offset, 'ascii');
|
|
45
|
-
buf[offset + digits] = 0; // NUL terminator
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Build one 512-byte ustar header (plus content blocks for regular files) for a
|
|
49
|
-
* single entry. The header checksum is computed exactly per spec: sum every
|
|
50
|
-
* header byte treating the 8 checksum bytes themselves as ASCII spaces, then
|
|
51
|
-
* write that sum as 6 octal digits + NUL + space.
|
|
52
|
-
*/
|
|
53
|
-
function makeTarEntry(spec) {
|
|
54
|
-
const type = spec.type ?? 'file';
|
|
55
|
-
const content = type === 'file'
|
|
56
|
-
? Buffer.isBuffer(spec.content)
|
|
57
|
-
? spec.content
|
|
58
|
-
: Buffer.from(spec.content ?? '', 'utf-8')
|
|
59
|
-
: Buffer.alloc(0); // links carry no content payload
|
|
60
|
-
const header = Buffer.alloc(BLOCK); // zero-filled
|
|
61
|
-
writeField(header, 0, 100, spec.name); // name
|
|
62
|
-
writeOctal(header, 100, 8, 0o644); // mode
|
|
63
|
-
writeOctal(header, 108, 8, 0); // uid
|
|
64
|
-
writeOctal(header, 116, 8, 0); // gid
|
|
65
|
-
writeOctal(header, 124, 12, content.length); // size (0 for links)
|
|
66
|
-
writeOctal(header, 136, 12, 0); // mtime (deterministic: epoch)
|
|
67
|
-
// checksum field (148, 8) — filled below; start as spaces for the sum.
|
|
68
|
-
header.fill(' '.charCodeAt(0), 148, 156);
|
|
69
|
-
writeField(header, 156, 1, TYPEFLAG[type]); // typeflag
|
|
70
|
-
if (spec.linkname !== undefined) {
|
|
71
|
-
writeField(header, 157, 100, spec.linkname); // linkname (verbatim)
|
|
72
|
-
}
|
|
73
|
-
writeField(header, 257, 6, 'ustar'); // magic "ustar\0"
|
|
74
|
-
writeField(header, 263, 2, '00'); // version "00"
|
|
75
|
-
// uname/gname left empty; devmajor/devminor zero (already NUL).
|
|
76
|
-
// Header checksum: unsigned sum of all 512 bytes (with the checksum field as
|
|
77
|
-
// spaces, which we set above). Written as 6 octal digits, NUL, space.
|
|
78
|
-
let sum = 0;
|
|
79
|
-
for (let i = 0; i < BLOCK; i++)
|
|
80
|
-
sum += header[i];
|
|
81
|
-
const cksum = sum.toString(8).padStart(6, '0').slice(-6);
|
|
82
|
-
header.write(cksum, 148, 'ascii');
|
|
83
|
-
header[154] = 0; // NUL
|
|
84
|
-
header[155] = ' '.charCodeAt(0); // space
|
|
85
|
-
if (type !== 'file' || content.length === 0)
|
|
86
|
-
return header;
|
|
87
|
-
// Content padded up to a 512-byte boundary.
|
|
88
|
-
const pad = (BLOCK - (content.length % BLOCK)) % BLOCK;
|
|
89
|
-
return Buffer.concat([header, content, Buffer.alloc(pad)]);
|
|
90
|
-
}
|
|
91
|
-
/** Concatenate entries and append the two zero blocks that end every tar. */
|
|
92
|
-
function makeTar(entries) {
|
|
93
|
-
const blocks = entries.map(makeTarEntry);
|
|
94
|
-
blocks.push(Buffer.alloc(BLOCK * 2)); // end-of-archive marker
|
|
95
|
-
return Buffer.concat(blocks);
|
|
96
|
-
}
|
|
97
|
-
/** Build the tar, gzip it, and write it to `outPath`. Returns `outPath`. */
|
|
98
|
-
export function writeMaliciousTarGz(outPath, entries) {
|
|
99
|
-
fs.writeFileSync(outPath, gzipSync(makeTar(entries)));
|
|
100
|
-
return outPath;
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=make-tar.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const scriptUsage = {
|
|
2
|
-
scriptId: "fixture-script",
|
|
3
|
-
path: "scripts/example.sh",
|
|
4
|
-
sha256: "0".repeat(64),
|
|
5
|
-
attestationLevel: "verified",
|
|
6
|
-
};
|
|
7
|
-
const metadata = {
|
|
8
|
-
tier: "standard",
|
|
9
|
-
cacheTtlMs: 1_000,
|
|
10
|
-
};
|
|
11
|
-
const loadedSecret = {
|
|
12
|
-
...metadata,
|
|
13
|
-
name: "FIXTURE_NAME",
|
|
14
|
-
value: "fixture-only",
|
|
15
|
-
};
|
|
16
|
-
void [scriptUsage, metadata, loadedSecret];
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=secrets-public-types.test-d.js.map
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/** Producer-service fixtures verified against hq-pro PR #5060 at 7c234efa (in-memory service output; handler wrappers). */
|
|
2
|
-
import type { Decision } from "../client.js";
|
|
3
|
-
export declare const openDecision: Decision;
|
|
4
|
-
export declare const decisionFixtures: {
|
|
5
|
-
create: {
|
|
6
|
-
decision: Decision;
|
|
7
|
-
};
|
|
8
|
-
list: {
|
|
9
|
-
decisions: Decision[];
|
|
10
|
-
};
|
|
11
|
-
answer: {
|
|
12
|
-
decision: {
|
|
13
|
-
state: string;
|
|
14
|
-
updatedAt: string;
|
|
15
|
-
answer: {
|
|
16
|
-
choiceId: string;
|
|
17
|
-
by: string;
|
|
18
|
-
at: string;
|
|
19
|
-
source: string;
|
|
20
|
-
};
|
|
21
|
-
id: string;
|
|
22
|
-
askerPrincipal: string;
|
|
23
|
-
companyUid: string;
|
|
24
|
-
audience: {
|
|
25
|
-
kind: "person";
|
|
26
|
-
personUid: string;
|
|
27
|
-
} | {
|
|
28
|
-
kind: "company_admins";
|
|
29
|
-
};
|
|
30
|
-
statement: string;
|
|
31
|
-
options: import("../client.js").DecisionOption[];
|
|
32
|
-
context: {
|
|
33
|
-
links: string[];
|
|
34
|
-
brief: string;
|
|
35
|
-
commitmentId: string | null;
|
|
36
|
-
};
|
|
37
|
-
talkThreadId: string | null;
|
|
38
|
-
createdAt: string;
|
|
39
|
-
expiresAt: string;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
talk: {
|
|
43
|
-
decision: {
|
|
44
|
-
state: string;
|
|
45
|
-
updatedAt: string;
|
|
46
|
-
talkThreadId: null;
|
|
47
|
-
id: string;
|
|
48
|
-
askerPrincipal: string;
|
|
49
|
-
companyUid: string;
|
|
50
|
-
audience: {
|
|
51
|
-
kind: "person";
|
|
52
|
-
personUid: string;
|
|
53
|
-
} | {
|
|
54
|
-
kind: "company_admins";
|
|
55
|
-
};
|
|
56
|
-
statement: string;
|
|
57
|
-
options: import("../client.js").DecisionOption[];
|
|
58
|
-
context: {
|
|
59
|
-
links: string[];
|
|
60
|
-
brief: string;
|
|
61
|
-
commitmentId: string | null;
|
|
62
|
-
};
|
|
63
|
-
answer: {
|
|
64
|
-
choiceId: string;
|
|
65
|
-
by: string;
|
|
66
|
-
at: string;
|
|
67
|
-
source: "tap" | "thread" | "desktop";
|
|
68
|
-
} | null;
|
|
69
|
-
createdAt: string;
|
|
70
|
-
expiresAt: string;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
withdraw: {
|
|
74
|
-
decision: {
|
|
75
|
-
state: string;
|
|
76
|
-
updatedAt: string;
|
|
77
|
-
id: string;
|
|
78
|
-
askerPrincipal: string;
|
|
79
|
-
companyUid: string;
|
|
80
|
-
audience: {
|
|
81
|
-
kind: "person";
|
|
82
|
-
personUid: string;
|
|
83
|
-
} | {
|
|
84
|
-
kind: "company_admins";
|
|
85
|
-
};
|
|
86
|
-
statement: string;
|
|
87
|
-
options: import("../client.js").DecisionOption[];
|
|
88
|
-
context: {
|
|
89
|
-
links: string[];
|
|
90
|
-
brief: string;
|
|
91
|
-
commitmentId: string | null;
|
|
92
|
-
};
|
|
93
|
-
answer: {
|
|
94
|
-
choiceId: string;
|
|
95
|
-
by: string;
|
|
96
|
-
at: string;
|
|
97
|
-
source: "tap" | "thread" | "desktop";
|
|
98
|
-
} | null;
|
|
99
|
-
talkThreadId: string | null;
|
|
100
|
-
createdAt: string;
|
|
101
|
-
expiresAt: string;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
expired: {
|
|
105
|
-
decision: {
|
|
106
|
-
state: string;
|
|
107
|
-
updatedAt: string;
|
|
108
|
-
id: string;
|
|
109
|
-
askerPrincipal: string;
|
|
110
|
-
companyUid: string;
|
|
111
|
-
audience: {
|
|
112
|
-
kind: "person";
|
|
113
|
-
personUid: string;
|
|
114
|
-
} | {
|
|
115
|
-
kind: "company_admins";
|
|
116
|
-
};
|
|
117
|
-
statement: string;
|
|
118
|
-
options: import("../client.js").DecisionOption[];
|
|
119
|
-
context: {
|
|
120
|
-
links: string[];
|
|
121
|
-
brief: string;
|
|
122
|
-
commitmentId: string | null;
|
|
123
|
-
};
|
|
124
|
-
answer: {
|
|
125
|
-
choiceId: string;
|
|
126
|
-
by: string;
|
|
127
|
-
at: string;
|
|
128
|
-
source: "tap" | "thread" | "desktop";
|
|
129
|
-
} | null;
|
|
130
|
-
talkThreadId: string | null;
|
|
131
|
-
createdAt: string;
|
|
132
|
-
expiresAt: string;
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
export declare const decisionRoutes: string[][];
|
|
137
|
-
//# sourceMappingURL=us001.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const openDecision = {
|
|
2
|
-
id: "f3ccdf93-9b7e-4564-a3ad-566067900aee", companyUid: "cmp_indigo", askerPrincipal: "agt_personal", audience: { kind: "person", personUid: "prs_owner" },
|
|
3
|
-
statement: "Release the update?",
|
|
4
|
-
options: [{ id: "A", label: "Release", recommended: true }, { id: "B", label: "Wait", recommended: false }],
|
|
5
|
-
context: { links: ["https://example.com/review"], brief: "Checks passed", commitmentId: "cm_1" },
|
|
6
|
-
state: "open", answer: null, talkThreadId: null,
|
|
7
|
-
createdAt: "2026-10-18T02:00:00.000Z", expiresAt: "2026-10-19T02:00:00.000Z", updatedAt: "2026-10-18T02:00:00.000Z",
|
|
8
|
-
};
|
|
9
|
-
export const decisionFixtures = {
|
|
10
|
-
create: { decision: openDecision },
|
|
11
|
-
list: { decisions: [openDecision] },
|
|
12
|
-
answer: { decision: { ...openDecision, state: "answered", updatedAt: "2026-10-18T03:00:00.000Z", answer: { choiceId: "A", by: "prs_owner", at: "2026-10-18T03:00:00.000Z", source: "desktop" } } },
|
|
13
|
-
talk: { decision: { ...openDecision, state: "talking", updatedAt: "2026-10-18T03:00:00.000Z", talkThreadId: null } },
|
|
14
|
-
withdraw: { decision: { ...openDecision, state: "withdrawn", updatedAt: "2026-10-18T03:00:00.000Z" } },
|
|
15
|
-
expired: { decision: { ...openDecision, state: "expired", updatedAt: "2026-10-19T03:00:00.000Z" } },
|
|
16
|
-
};
|
|
17
|
-
export const decisionRoutes = [
|
|
18
|
-
["POST", "/v1/decisions"], ["GET", "/v1/decisions"],
|
|
19
|
-
["POST", "/v1/decisions/{id}/answer"], ["POST", "/v1/decisions/{id}/talk"], ["POST", "/v1/decisions/{id}/withdraw"],
|
|
20
|
-
];
|
|
21
|
-
//# sourceMappingURL=us001.js.map
|