@shield-agent/kya 0.24.2 → 0.26.0
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/.cursor-plugin/plugin.json +1 -1
- package/.mcp.json +1 -1
- package/LIMITATIONS.md +3 -3
- package/README.md +27 -5
- package/amp/README.md +2 -2
- package/amp/settings.example.json +1 -1
- package/claude/claude_desktop_config.example.json +1 -1
- package/claude/run-stdio.mjs +1 -1
- package/cline/README.md +1 -1
- package/cline/cline_mcp_settings.example.json +1 -1
- package/copilot/README.md +1 -1
- package/copilot/mcp-config.example.json +1 -1
- package/dist/cli.d.ts +3 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +109 -9
- package/dist/cli.js.map +1 -1
- package/dist/commands/connect.d.ts +3 -0
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +16 -1
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/discover.d.ts +21 -0
- package/dist/commands/discover.d.ts.map +1 -0
- package/dist/commands/discover.js +140 -0
- package/dist/commands/discover.js.map +1 -0
- package/dist/commands/hook.d.ts +17 -0
- package/dist/commands/hook.d.ts.map +1 -1
- package/dist/commands/hook.js +199 -6
- package/dist/commands/hook.js.map +1 -1
- package/dist/commands/hosted-hook.d.ts +164 -0
- package/dist/commands/hosted-hook.d.ts.map +1 -0
- package/dist/commands/hosted-hook.js +610 -0
- package/dist/commands/hosted-hook.js.map +1 -0
- package/dist/commands/import-traces.js +2 -2
- package/dist/commands/import-traces.js.map +1 -1
- package/dist/commands/team.d.ts +35 -0
- package/dist/commands/team.d.ts.map +1 -0
- package/dist/commands/team.js +174 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/commands/wire-hooks.d.ts +9 -1
- package/dist/commands/wire-hooks.d.ts.map +1 -1
- package/dist/commands/wire-hooks.js +38 -9
- package/dist/commands/wire-hooks.js.map +1 -1
- package/dist/discover/catalog.d.ts +30 -0
- package/dist/discover/catalog.d.ts.map +1 -0
- package/dist/discover/catalog.js +166 -0
- package/dist/discover/catalog.js.map +1 -0
- package/dist/discover/push.d.ts +21 -0
- package/dist/discover/push.d.ts.map +1 -0
- package/dist/discover/push.js +40 -0
- package/dist/discover/push.js.map +1 -0
- package/dist/discover/scan.d.ts +74 -0
- package/dist/discover/scan.d.ts.map +1 -0
- package/dist/discover/scan.js +448 -0
- package/dist/discover/scan.js.map +1 -0
- package/dist/discover/snapshot.d.ts +32 -0
- package/dist/discover/snapshot.d.ts.map +1 -0
- package/dist/discover/snapshot.js +92 -0
- package/dist/discover/snapshot.js.map +1 -0
- package/dist/fs-atomic.d.ts +8 -3
- package/dist/fs-atomic.d.ts.map +1 -1
- package/dist/fs-atomic.js +42 -17
- package/dist/fs-atomic.js.map +1 -1
- package/dist/importers/adr-sensor.d.ts +12 -0
- package/dist/importers/adr-sensor.d.ts.map +1 -0
- package/dist/importers/adr-sensor.js +272 -0
- package/dist/importers/adr-sensor.js.map +1 -0
- package/dist/importers/formats.d.ts.map +1 -1
- package/dist/importers/formats.js +4 -0
- package/dist/importers/formats.js.map +1 -1
- package/dist/importers/index.d.ts.map +1 -1
- package/dist/importers/index.js +3 -0
- package/dist/importers/index.js.map +1 -1
- package/dist/parse-args.d.ts.map +1 -1
- package/dist/parse-args.js +3 -1
- package/dist/parse-args.js.map +1 -1
- package/dist/receipt/enrich.d.ts +12 -0
- package/dist/receipt/enrich.d.ts.map +1 -1
- package/dist/receipt/enrich.js +30 -0
- package/dist/receipt/enrich.js.map +1 -1
- package/dist/receipt/live-server.d.ts +2 -0
- package/dist/receipt/live-server.d.ts.map +1 -1
- package/dist/receipt/live-server.js +28 -2
- package/dist/receipt/live-server.js.map +1 -1
- package/dist/receipt/render-receipt.d.ts +3 -1
- package/dist/receipt/render-receipt.d.ts.map +1 -1
- package/dist/receipt/render-receipt.js +48 -7
- package/dist/receipt/render-receipt.js.map +1 -1
- package/dist/trail.d.ts +5 -1
- package/dist/trail.d.ts.map +1 -1
- package/dist/trail.js +3 -1
- package/dist/trail.js.map +1 -1
- package/droid/README.md +3 -3
- package/droid/mcp.example.json +1 -1
- package/gemini/settings.example.json +1 -1
- package/grok/README.md +1 -1
- package/kilo/README.md +1 -1
- package/kilo/kilo.example.json +1 -1
- package/kimi/README.md +1 -1
- package/kimi/mcp.example.json +1 -1
- package/kiro/README.md +1 -1
- package/kiro/mcp.example.json +1 -1
- package/manifest.json +1 -1
- package/mastracode/README.md +1 -1
- package/mastracode/mcp.example.json +1 -1
- package/mcp.json +1 -1
- package/openai/codex.config.example.toml +2 -2
- package/openai/responses-mcp.example.json +1 -1
- package/opencode/README.md +1 -1
- package/opencode/opencode.example.json +1 -1
- package/package.json +2 -2
- package/qwen/README.md +1 -1
- package/qwen/settings.example.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosted-plane mode for `kya hook` (beta): `--plane-config <absolute path>`.
|
|
3
|
+
*
|
|
4
|
+
* The API key, base URL and agent id come ONLY from that one user-owned file.
|
|
5
|
+
* Env (KYA_OFFLINE, KYA_BASE_URL, KYA_API_KEY, SHIELD_API_KEY, KYA_AGENT_ID,
|
|
6
|
+
* KYA_HOME) and the repo's .kya/config.json are never read on this path, so
|
|
7
|
+
* neither can downgrade it. Every plane failure is a reason code, never an
|
|
8
|
+
* exception message (which could echo config bytes or the key).
|
|
9
|
+
*/
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, realpathSync, writeSync } from "node:fs";
|
|
12
|
+
import { request as httpRequest } from "node:http";
|
|
13
|
+
import { Agent as HttpsAgent, request as httpsRequest } from "node:https";
|
|
14
|
+
import { isIP } from "node:net";
|
|
15
|
+
import { dirname, isAbsolute, join, sep } from "node:path";
|
|
16
|
+
import { applyPlaneAuth } from "../client.js";
|
|
17
|
+
import { computeArgsHash } from "../hash.js";
|
|
18
|
+
import { deriveWireChangeFields } from "../diff-preview.js";
|
|
19
|
+
import { findSampleTool } from "../sample-tools.js";
|
|
20
|
+
import { CLI_VERSION } from "../version.js";
|
|
21
|
+
/** A plane failure. `message` is fixed text chosen here: never upstream or parser output. */
|
|
22
|
+
export class PlaneError extends Error {
|
|
23
|
+
code;
|
|
24
|
+
constructor(code, message) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.code = code;
|
|
27
|
+
this.name = "PlaneError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Keys loaded in this process; the hosted output guard redacts them from stdout and stderr. */
|
|
31
|
+
export const loadedSecrets = new Set();
|
|
32
|
+
/** Every form of a loaded key the guard redacts: exact, URL-encoded and base64. */
|
|
33
|
+
function secretForms() {
|
|
34
|
+
const out = new Set();
|
|
35
|
+
for (const k of loadedSecrets) {
|
|
36
|
+
out.add(k);
|
|
37
|
+
out.add(encodeURIComponent(k));
|
|
38
|
+
out.add(Buffer.from(k, "utf8").toString("base64"));
|
|
39
|
+
}
|
|
40
|
+
return [...out].filter((f) => f.length >= 8);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Best-effort output guard for hosted mode: the exact key (and its URL-encoded
|
|
44
|
+
* and base64 forms) is replaced by [redacted] in anything written to the
|
|
45
|
+
* stream, including a key split across two writes (a trailing partial match
|
|
46
|
+
* is held back until the next write or process exit). kya itself never
|
|
47
|
+
* prints the key; this covers anything else that might.
|
|
48
|
+
*/
|
|
49
|
+
export function guardStream(stream) {
|
|
50
|
+
const orig = stream.write.bind(stream);
|
|
51
|
+
let pending = "";
|
|
52
|
+
stream.write = (chunk, ...rest) => {
|
|
53
|
+
const forms = secretForms();
|
|
54
|
+
if (forms.length === 0 || (typeof chunk !== "string" && !Buffer.isBuffer(chunk))) {
|
|
55
|
+
return orig(chunk, ...rest);
|
|
56
|
+
}
|
|
57
|
+
let text = pending + (typeof chunk === "string" ? chunk : chunk.toString("utf8"));
|
|
58
|
+
for (const f of forms)
|
|
59
|
+
text = text.split(f).join("[redacted]");
|
|
60
|
+
// Hold back a tail that could be the start of a key completed by the next write.
|
|
61
|
+
let hold = 0;
|
|
62
|
+
for (const f of forms) {
|
|
63
|
+
for (let n = Math.min(f.length - 1, text.length); n > hold; n--) {
|
|
64
|
+
if (text.endsWith(f.slice(0, n))) {
|
|
65
|
+
hold = n;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
pending = hold ? text.slice(-hold) : "";
|
|
71
|
+
return orig(hold ? text.slice(0, -hold) : text, ...rest);
|
|
72
|
+
};
|
|
73
|
+
process.once("exit", () => {
|
|
74
|
+
// A held tail that never became a key is ordinary output: release it.
|
|
75
|
+
if (pending) {
|
|
76
|
+
try {
|
|
77
|
+
writeSync(stream.fd, pending);
|
|
78
|
+
}
|
|
79
|
+
catch { /* exiting */ }
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** What the hook knows before any plane code runs; the crash path never lowers it. */
|
|
84
|
+
export const hostedDecision = { neverList: "unknown" };
|
|
85
|
+
/**
|
|
86
|
+
* Crash decision. The local never-list (evaluated before any plane code) wins
|
|
87
|
+
* everywhere, shadow included; an unparsed payload is not provably harmless,
|
|
88
|
+
* so it also denies in shadow. Only a payload known to be off the never-list
|
|
89
|
+
* may exit 0, and only in shadow.
|
|
90
|
+
*/
|
|
91
|
+
export function crashDecision(shadow) {
|
|
92
|
+
if (hostedDecision.neverList === "deny") {
|
|
93
|
+
return { code: 2, reason: "KYA denied: NEVER_EVENT (internal error after the local never-list matched)" };
|
|
94
|
+
}
|
|
95
|
+
if (shadow && hostedDecision.neverList === "clear") {
|
|
96
|
+
return { code: 0, reason: "KYA shadow: internal error; allowed because --plane-shadow is set" };
|
|
97
|
+
}
|
|
98
|
+
return { code: 2, reason: "KYA hosted: internal error (FAIL_CLOSED); tool call denied (fails closed)" };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Hosted mode crash path: an uncaught exception or rejection must not become
|
|
102
|
+
* exit 1 (which a host without onFailure "block" treats as allow). Uses
|
|
103
|
+
* crashDecision (never the error text): stderr first, then the deny JSON.
|
|
104
|
+
*/
|
|
105
|
+
export function hostedCrashHandler(opts) {
|
|
106
|
+
return () => {
|
|
107
|
+
const d = crashDecision(opts.shadow);
|
|
108
|
+
try {
|
|
109
|
+
opts.err(`${d.reason}\n`);
|
|
110
|
+
if (d.code === 2) {
|
|
111
|
+
opts.out(`${JSON.stringify({ hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: d.reason } })}\n`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch { /* still exit below */ }
|
|
115
|
+
finally {
|
|
116
|
+
opts.exit(d.code);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export const DEFAULT_PLANE_BUDGET_MS = 3000;
|
|
121
|
+
/** Node start (~0.2 s) plus trail work must stay under the host's 5 s hook timeout. */
|
|
122
|
+
export const MAX_PLANE_BUDGET_MS = 4000;
|
|
123
|
+
const MIN_PLANE_BUDGET_MS = 100;
|
|
124
|
+
const MAX_CONFIG_BYTES = 64 * 1024;
|
|
125
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
126
|
+
/** Flag-only test mode admits exactly these literal hosts. */
|
|
127
|
+
const LOOPBACK = new Set(["127.0.0.1", "[::1]"]);
|
|
128
|
+
/** Clamp a --plane-budget-ms value; anything unparseable is the default. */
|
|
129
|
+
export function planeBudgetMs(raw) {
|
|
130
|
+
const n = typeof raw === "string" ? Number.parseInt(raw, 10) : Number.NaN;
|
|
131
|
+
if (!Number.isFinite(n))
|
|
132
|
+
return DEFAULT_PLANE_BUDGET_MS;
|
|
133
|
+
return Math.min(MAX_PLANE_BUDGET_MS, Math.max(MIN_PLANE_BUDGET_MS, n));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* NODE_OPTIONS tokens hosted mode accepts; anything else is refused (allowlist).
|
|
137
|
+
* Matched after unquoting and with underscores in the flag name read as dashes,
|
|
138
|
+
* the way node does.
|
|
139
|
+
*/
|
|
140
|
+
const SAFE_NODE_OPTION = /^--(max-old-space-size|max-semi-space-size|stack-trace-limit)=\d+$|^--(no-warnings|no-deprecation|enable-source-maps)$|^--disable-warning=[A-Za-z0-9-]+$/;
|
|
141
|
+
/**
|
|
142
|
+
* Split NODE_OPTIONS for the allowlist check. Close to node's own rules
|
|
143
|
+
* (whitespace separates tokens, double quotes group, a backslash escapes the
|
|
144
|
+
* next character inside quotes) but stricter: undefined for anything it does
|
|
145
|
+
* not understand (an unterminated quote or a trailing escape), which refuses.
|
|
146
|
+
*/
|
|
147
|
+
export function parseNodeOptions(raw) {
|
|
148
|
+
const out = [];
|
|
149
|
+
let cur = "";
|
|
150
|
+
let has = false;
|
|
151
|
+
let quoted = false;
|
|
152
|
+
for (let i = 0; i < raw.length; i++) {
|
|
153
|
+
const c = raw[i];
|
|
154
|
+
if (quoted && c === "\\") {
|
|
155
|
+
if (i + 1 >= raw.length)
|
|
156
|
+
return undefined;
|
|
157
|
+
cur += raw[++i];
|
|
158
|
+
}
|
|
159
|
+
else if (c === '"') {
|
|
160
|
+
quoted = !quoted;
|
|
161
|
+
has = true;
|
|
162
|
+
}
|
|
163
|
+
else if (!quoted && /\s/.test(c)) {
|
|
164
|
+
if (has || cur)
|
|
165
|
+
out.push(cur);
|
|
166
|
+
cur = "";
|
|
167
|
+
has = false;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
cur += c;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (quoted)
|
|
174
|
+
return undefined;
|
|
175
|
+
if (has || cur)
|
|
176
|
+
out.push(cur);
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
function safeNodeOption(token) {
|
|
180
|
+
const eq = token.indexOf("=");
|
|
181
|
+
const name = (eq === -1 ? token : token.slice(0, eq)).replace(/_/g, "-");
|
|
182
|
+
return SAFE_NODE_OPTION.test(eq === -1 ? name : name + token.slice(eq));
|
|
183
|
+
}
|
|
184
|
+
/** Read by node or OpenSSL at process start, so they cannot be undone at runtime: refuse. */
|
|
185
|
+
const REFUSED_TLS_ENV = ["NODE_EXTRA_CA_CERTS", "SSL_CERT_FILE", "SSL_CERT_DIR", "NODE_TLS_REJECT_UNAUTHORIZED", "NODE_USE_ENV_PROXY", "NODE_PATH", "OPENSSL_CONF"];
|
|
186
|
+
/** Proxy and TLS-override variables: deleted in hosted mode (the transport never uses a proxy anyway). */
|
|
187
|
+
export const PROXY_ENV = ["HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY", "http_proxy", "https_proxy", "all_proxy", "no_proxy", "NODE_USE_ENV_PROXY", "NODE_TLS_REJECT_UNAUTHORIZED"];
|
|
188
|
+
/** Namespaces that steer node, libuv or OpenSSL; only the names below are allowed in hosted mode. */
|
|
189
|
+
const CONTROLLED_ENV = /^(NODE_|SSL_|OPENSSL_|UV_|DYLD_|LD_)/i;
|
|
190
|
+
const ALLOWED_CONTROLLED_ENV = new Set(["NODE_ENV", "NODE_OPTIONS", "NODE_NO_WARNINGS", "NODE_DISABLE_COLORS", "NODE_VERSION"]);
|
|
191
|
+
/**
|
|
192
|
+
* Env that can load code into node, weaken TLS, add trust anchors, print
|
|
193
|
+
* request headers (NODE_DEBUG) or route the plane call through a proxy (N15
|
|
194
|
+
* lessons, reviews of #388). Positive allowlist: any NODE_*, SSL_*, OPENSSL_*
|
|
195
|
+
* or UV_* variable outside ALLOWED_CONTROLLED_ENV is refused, and NODE_OPTIONS
|
|
196
|
+
* must pass the token allowlist above. Returns the variable NAME only, never
|
|
197
|
+
* its value.
|
|
198
|
+
*/
|
|
199
|
+
export function hostedEnvProblem(env) {
|
|
200
|
+
for (const k of REFUSED_TLS_ENV) {
|
|
201
|
+
if (env[k] !== undefined && env[k] !== "")
|
|
202
|
+
return `${k} is set`;
|
|
203
|
+
}
|
|
204
|
+
for (const k of Object.keys(env).sort()) {
|
|
205
|
+
if (CONTROLLED_ENV.test(k) && !ALLOWED_CONTROLLED_ENV.has(k) && env[k] !== undefined && env[k] !== "") {
|
|
206
|
+
return `${k} is set`;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const tokens = parseNodeOptions(env.NODE_OPTIONS ?? "");
|
|
210
|
+
if (!tokens || !tokens.every(safeNodeOption)) {
|
|
211
|
+
return "NODE_OPTIONS has a flag outside the hosted-mode allowlist";
|
|
212
|
+
}
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
/** Hosted mode start: strip proxy and TLS-override variables before any network code. */
|
|
216
|
+
export function scrubNetworkEnv(...envs) {
|
|
217
|
+
for (const e of envs)
|
|
218
|
+
for (const k of PROXY_ENV)
|
|
219
|
+
delete e[k];
|
|
220
|
+
}
|
|
221
|
+
function insideDir(child, dir) {
|
|
222
|
+
return child === dir || child.startsWith(dir.endsWith(sep) ? dir : dir + sep);
|
|
223
|
+
}
|
|
224
|
+
/** Nearest ancestor holding a .git entry (dir or worktree file); no git process spawned. */
|
|
225
|
+
export function gitRoot(dir) {
|
|
226
|
+
for (let d = dir;; d = dirname(d)) {
|
|
227
|
+
try {
|
|
228
|
+
lstatSync(join(d, ".git"));
|
|
229
|
+
return d;
|
|
230
|
+
}
|
|
231
|
+
catch { /* keep walking */ }
|
|
232
|
+
if (dirname(d) === d)
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function real(p) {
|
|
237
|
+
try {
|
|
238
|
+
return realpathSync(p);
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Load and validate the plane config file. Refuses: relative paths, symlinks
|
|
246
|
+
* (O_NOFOLLOW + fstat on the opened fd, no check-then-read race), non-regular
|
|
247
|
+
* files, another owner, group/world bits, files inside the agent's working
|
|
248
|
+
* directory (unless that directory is the home dir itself), bad JSON, a
|
|
249
|
+
* non-https base URL (loopback http only with the explicit argv flag), URL
|
|
250
|
+
* credentials, and a non-UUID agent id. Throws PlaneError("PLANE_CONFIG").
|
|
251
|
+
*/
|
|
252
|
+
export function loadPlaneConfig(path, opts) {
|
|
253
|
+
const bad = (why) => {
|
|
254
|
+
throw new PlaneError("PLANE_CONFIG", `plane config ${why}`);
|
|
255
|
+
};
|
|
256
|
+
if (process.platform === "win32")
|
|
257
|
+
bad("is not supported on Windows in this beta (no POSIX owner and mode check)");
|
|
258
|
+
if (!path || !isAbsolute(path))
|
|
259
|
+
bad("path must be absolute");
|
|
260
|
+
// lstat first: a FIFO or device would block or misbehave on open.
|
|
261
|
+
let pre;
|
|
262
|
+
try {
|
|
263
|
+
pre = lstatSync(path);
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
return bad("cannot be opened");
|
|
267
|
+
}
|
|
268
|
+
if (pre.isSymbolicLink())
|
|
269
|
+
bad("must not be a symlink");
|
|
270
|
+
if (!pre.isFile())
|
|
271
|
+
bad("must be a regular file");
|
|
272
|
+
if (pre.size > MAX_CONFIG_BYTES)
|
|
273
|
+
bad("is too large");
|
|
274
|
+
let fd;
|
|
275
|
+
let text = "";
|
|
276
|
+
try {
|
|
277
|
+
try {
|
|
278
|
+
fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | (constants.O_NONBLOCK ?? 0));
|
|
279
|
+
}
|
|
280
|
+
catch (e) {
|
|
281
|
+
const code = e.code;
|
|
282
|
+
bad(code === "ELOOP" ? "must not be a symlink" : "cannot be opened");
|
|
283
|
+
}
|
|
284
|
+
const st = fstatSync(fd);
|
|
285
|
+
if (!st.isFile() || st.ino !== pre.ino || st.dev !== pre.dev)
|
|
286
|
+
bad("must be a regular file");
|
|
287
|
+
// A hard link elsewhere (for example inside a repo) would dodge the location check.
|
|
288
|
+
if (st.nlink > 1)
|
|
289
|
+
bad("must not have other hard links");
|
|
290
|
+
if (process.getuid && st.uid !== process.getuid())
|
|
291
|
+
bad("must be owned by the current user");
|
|
292
|
+
if ((st.mode & 0o077) !== 0)
|
|
293
|
+
bad("must not be group or world accessible (chmod 600)");
|
|
294
|
+
if (st.size > MAX_CONFIG_BYTES)
|
|
295
|
+
bad("is too large");
|
|
296
|
+
const buf = Buffer.alloc(Math.min(st.size, MAX_CONFIG_BYTES));
|
|
297
|
+
const n = readSync(fd, buf, 0, buf.length, 0);
|
|
298
|
+
text = buf.subarray(0, n).toString("utf8");
|
|
299
|
+
}
|
|
300
|
+
finally {
|
|
301
|
+
if (fd !== undefined)
|
|
302
|
+
closeSync(fd);
|
|
303
|
+
}
|
|
304
|
+
const file = real(path) ?? path;
|
|
305
|
+
const home = real(opts.home) ?? opts.home;
|
|
306
|
+
for (const cwd of opts.cwds) {
|
|
307
|
+
const dir = cwd && real(cwd);
|
|
308
|
+
if (!dir)
|
|
309
|
+
continue;
|
|
310
|
+
for (const d of [dir, gitRoot(dir)]) {
|
|
311
|
+
if (d && d !== home && insideDir(file, d))
|
|
312
|
+
bad("must not live inside the project directory or its git work tree");
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
let raw;
|
|
316
|
+
try {
|
|
317
|
+
raw = JSON.parse(text);
|
|
318
|
+
}
|
|
319
|
+
catch {
|
|
320
|
+
// Never echo the parser message: newer V8 quotes the input, which holds the key.
|
|
321
|
+
bad("is not valid JSON");
|
|
322
|
+
}
|
|
323
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
324
|
+
bad("must be a JSON object");
|
|
325
|
+
const o = raw;
|
|
326
|
+
const apiKey = typeof o.apiKey === "string" ? o.apiKey.trim() : "";
|
|
327
|
+
// Printable ASCII only: anything else cannot be a header value (node throws) and is not a real key.
|
|
328
|
+
if (!/^[\x21-\x7e]{8,512}$/.test(apiKey))
|
|
329
|
+
bad("needs an apiKey of 8 to 512 printable ASCII characters");
|
|
330
|
+
const agentId = typeof o.agentId === "string" ? o.agentId.trim() : "";
|
|
331
|
+
if (!UUID_RE.test(agentId))
|
|
332
|
+
bad("needs agentId (the registered agent's UUID)");
|
|
333
|
+
const url = validatePlaneUrl(typeof o.baseUrl === "string" ? o.baseUrl.trim() : "", opts.allowHttpLoopback === true);
|
|
334
|
+
loadedSecrets.add(apiKey);
|
|
335
|
+
return { baseUrl: url.origin + url.pathname.replace(/\/+$/, ""), url, apiKey, agentId };
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Strict base-URL check, one parse. https only; no userinfo, query or
|
|
339
|
+
* fragment; ASCII only (no punycode); the host as written must equal the
|
|
340
|
+
* parsed host (refuses 0x7f.1, 2130706433 and other non-canonical forms); no
|
|
341
|
+
* IP literal and no `localhost`. The argv-only loopback test mode admits
|
|
342
|
+
* exactly 127.0.0.1 and [::1], over http or https.
|
|
343
|
+
*/
|
|
344
|
+
export function validatePlaneUrl(raw, allowLoopback) {
|
|
345
|
+
const bad = (why) => {
|
|
346
|
+
throw new PlaneError("PLANE_CONFIG", `plane config baseUrl ${why}`);
|
|
347
|
+
};
|
|
348
|
+
if (!raw || /[^\x21-\x7e]/.test(raw))
|
|
349
|
+
bad("must be a non-empty ASCII URL");
|
|
350
|
+
let url;
|
|
351
|
+
try {
|
|
352
|
+
url = new URL(raw);
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
return bad("is not a valid URL");
|
|
356
|
+
}
|
|
357
|
+
if (url.username || url.password || /^[a-z]+:\/\/[^/?#]*@/i.test(raw))
|
|
358
|
+
bad("must not carry credentials");
|
|
359
|
+
if (url.search || url.hash || /[?#]/.test(raw))
|
|
360
|
+
bad("must not carry a query or fragment");
|
|
361
|
+
if (/^[a-z]+:\/\/(\[[^\]]*\]|[^/:]+):0*(\/|$)/i.test(raw))
|
|
362
|
+
bad("must not use port 0");
|
|
363
|
+
const rawHost = /^[a-z]+:\/\/(\[[^\]]*\]|[^/:]+)/i.exec(raw)?.[1]?.toLowerCase().replace(/\.+$/, "");
|
|
364
|
+
if (url.hostname.endsWith("."))
|
|
365
|
+
url.hostname = url.hostname.replace(/\.+$/, "");
|
|
366
|
+
if (!rawHost || rawHost !== url.hostname)
|
|
367
|
+
bad("host must be written in canonical form");
|
|
368
|
+
if (url.hostname.split(".").some((l) => l.startsWith("xn--")))
|
|
369
|
+
bad("host must not be punycode");
|
|
370
|
+
const loopback = allowLoopback && LOOPBACK.has(url.hostname);
|
|
371
|
+
if (!loopback) {
|
|
372
|
+
if (url.protocol !== "https:")
|
|
373
|
+
bad("must be https");
|
|
374
|
+
if (/(^|\.)localhost$|^localhost\./.test(url.hostname))
|
|
375
|
+
bad("must not be localhost");
|
|
376
|
+
if (isIP(url.hostname.replace(/^\[|\]$/g, "")))
|
|
377
|
+
bad("must not be an IP address");
|
|
378
|
+
}
|
|
379
|
+
else if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
380
|
+
bad("must be https or loopback http");
|
|
381
|
+
}
|
|
382
|
+
return url;
|
|
383
|
+
}
|
|
384
|
+
/** Cap on the plane's answer: a verdict is a few hundred bytes. */
|
|
385
|
+
export const MAX_RESPONSE_BYTES = 64 * 1024;
|
|
386
|
+
/** Printable ASCII, at most 128 chars: plane text reaches the model and the trail. */
|
|
387
|
+
export function cleanPlaneText(v) {
|
|
388
|
+
return typeof v === "string" ? v.replace(/[^\x20-\x7e]/g, "").slice(0, 128) : "";
|
|
389
|
+
}
|
|
390
|
+
/** Reason codes are short upper-case identifiers; anything else becomes PLANE_BAD_RESPONSE. */
|
|
391
|
+
export function planeReasonCode(v) {
|
|
392
|
+
if (v === undefined || v === null || v === "")
|
|
393
|
+
return "";
|
|
394
|
+
return typeof v === "string" && /^[A-Z0-9_]{1,64}$/.test(v) ? v : "PLANE_BAD_RESPONSE";
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* The hosted-mode transport: node:https with its own agent (verify certs, no
|
|
398
|
+
* keep-alive, no proxy), SNI from the validated host, no redirect following.
|
|
399
|
+
* The global fetch is never used, so env proxy switches and undici defaults
|
|
400
|
+
* cannot reach this call. Plain http only for the argv-only loopback mode.
|
|
401
|
+
*/
|
|
402
|
+
export const httpsTransport = (url, init) => new Promise((resolve, reject) => {
|
|
403
|
+
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
404
|
+
const common = {
|
|
405
|
+
method: "POST",
|
|
406
|
+
host,
|
|
407
|
+
port: url.port ? Number(url.port) : undefined,
|
|
408
|
+
path: url.pathname,
|
|
409
|
+
headers: { ...init.headers, "Content-Length": String(Buffer.byteLength(init.body)) },
|
|
410
|
+
signal: init.signal,
|
|
411
|
+
};
|
|
412
|
+
const agent = new HttpsAgent({ rejectUnauthorized: true, keepAlive: false });
|
|
413
|
+
const done = () => agent.destroy();
|
|
414
|
+
let req;
|
|
415
|
+
try {
|
|
416
|
+
req = url.protocol === "https:"
|
|
417
|
+
? httpsRequest({
|
|
418
|
+
...common,
|
|
419
|
+
agent,
|
|
420
|
+
rejectUnauthorized: true,
|
|
421
|
+
...(isIP(host) ? {} : { servername: host }),
|
|
422
|
+
})
|
|
423
|
+
: httpRequest({ ...common, agent: false });
|
|
424
|
+
}
|
|
425
|
+
catch (e) {
|
|
426
|
+
// A request that cannot even be built (bad header value, ...) is a plane failure, not a crash.
|
|
427
|
+
done();
|
|
428
|
+
reject(e);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
// Registered only once req exists: no temporal-dead-zone window.
|
|
432
|
+
init.signal.addEventListener("abort", () => { req.destroy(); done(); reject(init.signal.reason); }, { once: true });
|
|
433
|
+
req.on("response", (res) => {
|
|
434
|
+
const chunks = [];
|
|
435
|
+
let size = 0;
|
|
436
|
+
res.on("data", (c) => {
|
|
437
|
+
size += c.length;
|
|
438
|
+
if (size > MAX_RESPONSE_BYTES) {
|
|
439
|
+
// Stop reading at once; an endless or huge body is a plane failure, not a crash.
|
|
440
|
+
req.destroy();
|
|
441
|
+
done();
|
|
442
|
+
reject(new PlaneError("PLANE_UNREACHABLE", "hosted plane response is too large"));
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
chunks.push(c);
|
|
446
|
+
});
|
|
447
|
+
res.on("error", (e) => { done(); reject(e); });
|
|
448
|
+
res.on("end", () => {
|
|
449
|
+
done();
|
|
450
|
+
const text = Buffer.concat(chunks).toString("utf8");
|
|
451
|
+
resolve({
|
|
452
|
+
status: res.statusCode ?? 0,
|
|
453
|
+
headers: { get: (n) => { const v = res.headers[n.toLowerCase()]; return Array.isArray(v) ? v[0] ?? null : v ?? null; } },
|
|
454
|
+
text: async () => text,
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
req.on("error", (e) => { done(); reject(e); });
|
|
459
|
+
req.end(init.body);
|
|
460
|
+
});
|
|
461
|
+
export const BACKOFF_BASE_MS = 200;
|
|
462
|
+
export const BACKOFF_CAP_MS = 1600;
|
|
463
|
+
/** Exponential backoff with equal jitter: attempt n waits in [d/2, d], d = min(cap, base * 2^n). */
|
|
464
|
+
export function backoffMs(attempt, random) {
|
|
465
|
+
const d = Math.min(BACKOFF_CAP_MS, BACKOFF_BASE_MS * 2 ** attempt);
|
|
466
|
+
return Math.round(d / 2 + random() * (d / 2));
|
|
467
|
+
}
|
|
468
|
+
/** Retry-After as delta seconds or an HTTP date; undefined when absent or garbage. */
|
|
469
|
+
export function retryAfterMs(header, now) {
|
|
470
|
+
if (!header)
|
|
471
|
+
return undefined;
|
|
472
|
+
const v = header.trim();
|
|
473
|
+
if (/^\d+$/.test(v))
|
|
474
|
+
return Number(v) * 1000;
|
|
475
|
+
const at = Date.parse(v);
|
|
476
|
+
return Number.isFinite(at) ? Math.max(0, at - now) : undefined;
|
|
477
|
+
}
|
|
478
|
+
/** sha256 over the same key shape as the hook's tool_use_id marker. */
|
|
479
|
+
export function correlationId(sessionId, toolUseId) {
|
|
480
|
+
if (!toolUseId)
|
|
481
|
+
return undefined;
|
|
482
|
+
const key = sessionId ? JSON.stringify([sessionId, toolUseId]) : toolUseId;
|
|
483
|
+
return createHash("sha256").update(key).digest("hex");
|
|
484
|
+
}
|
|
485
|
+
const VERDICTS = new Set(["ALLOW", "DENY", "REQUIRE_APPROVE"]);
|
|
486
|
+
/**
|
|
487
|
+
* The evaluate body: what connected mode sends (toolId, argsHash, sample risk
|
|
488
|
+
* fields, redacted change fields unless KYA_SEND_PREVIEWS=0), plus the hook
|
|
489
|
+
* fields the design adds: env.correlationId, mode, product, and
|
|
490
|
+
* requireRegisteredAgent so the hosted kill switch applies. Raw args never leave.
|
|
491
|
+
*/
|
|
492
|
+
export function hostedEvaluateBody(input) {
|
|
493
|
+
const sample = findSampleTool(input.toolName);
|
|
494
|
+
const change = deriveWireChangeFields(input.toolName, input.args, input.env);
|
|
495
|
+
return {
|
|
496
|
+
toolId: input.toolName,
|
|
497
|
+
action: input.toolName,
|
|
498
|
+
argsHash: computeArgsHash(input.args),
|
|
499
|
+
irreversible: sample?.irreversible ?? false,
|
|
500
|
+
actionClass: sample?.actionClass,
|
|
501
|
+
dataClass: sample?.dataClass,
|
|
502
|
+
sessionRisk: "LOW",
|
|
503
|
+
approvalStatus: "NONE",
|
|
504
|
+
packId: "generic",
|
|
505
|
+
...(change ?? {}),
|
|
506
|
+
env: {
|
|
507
|
+
host: "ide",
|
|
508
|
+
agentId: input.config.agentId,
|
|
509
|
+
// No env.sessionId: kya_tool_event.session_id references kya_session, so an
|
|
510
|
+
// un-ingested host session id makes the plane drop the trail row (fail soft).
|
|
511
|
+
correlationId: correlationId(input.sessionId, input.toolUseId),
|
|
512
|
+
},
|
|
513
|
+
mode: input.strict ? "hold" : "observe",
|
|
514
|
+
product: input.product,
|
|
515
|
+
requireRegisteredAgent: true,
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* One deadline for the whole call. Retries 429, 5xx and network errors with
|
|
520
|
+
* exponential backoff plus jitter, honours Retry-After, and never sleeps past
|
|
521
|
+
* the deadline: if the next wait does not fit, it fails now with the code of
|
|
522
|
+
* the last failure. 401/403 and other 4xx are not retried. Each attempt is
|
|
523
|
+
* capped at half the budget, so a single stalled attempt is retried once.
|
|
524
|
+
*/
|
|
525
|
+
export async function evaluateHosted(input) {
|
|
526
|
+
const now = input.now ?? Date.now;
|
|
527
|
+
const sleep = input.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
528
|
+
const random = input.random ?? Math.random;
|
|
529
|
+
const fetchImpl = input.fetch ?? httpsTransport;
|
|
530
|
+
const deadline = now() + input.budgetMs;
|
|
531
|
+
const body = JSON.stringify(hostedEvaluateBody(input));
|
|
532
|
+
const headers = {
|
|
533
|
+
Accept: "application/json",
|
|
534
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
535
|
+
"User-Agent": `shield-agent-kya-cli/${CLI_VERSION}`,
|
|
536
|
+
};
|
|
537
|
+
applyPlaneAuth(headers, input.config.apiKey);
|
|
538
|
+
// Built from the same validated URL object, never from a second string.
|
|
539
|
+
const url = new URL(input.config.url);
|
|
540
|
+
url.pathname = `${input.config.url.pathname.replace(/\/+$/, "")}/api/v1/kya/policy/evaluate`;
|
|
541
|
+
let last = new PlaneError("PLANE_TIMEOUT", "hosted plane did not answer within the budget");
|
|
542
|
+
for (let attempt = 0;; attempt++) {
|
|
543
|
+
const remaining = deadline - now();
|
|
544
|
+
if (remaining <= 0)
|
|
545
|
+
return Promise.reject(last);
|
|
546
|
+
let wait;
|
|
547
|
+
try {
|
|
548
|
+
const res = await fetchImpl(url, {
|
|
549
|
+
headers,
|
|
550
|
+
body,
|
|
551
|
+
// Per-attempt cap: one stalled attempt must leave room for a retry (timeouts are transient too).
|
|
552
|
+
signal: AbortSignal.timeout(Math.min(remaining, Math.ceil(input.budgetMs / 2))),
|
|
553
|
+
});
|
|
554
|
+
if (res.status === 401 || res.status === 403) {
|
|
555
|
+
throw new PlaneError("PLANE_AUTH_REJECTED", `hosted plane rejected the API key (HTTP ${res.status})`);
|
|
556
|
+
}
|
|
557
|
+
if (res.status >= 300 && res.status < 400) {
|
|
558
|
+
// Never follow: the key header must not reach a second URL.
|
|
559
|
+
throw new PlaneError("PLANE_UNREACHABLE", `hosted plane answered with a redirect (HTTP ${res.status}); not followed`);
|
|
560
|
+
}
|
|
561
|
+
if (res.status >= 200 && res.status < 300) {
|
|
562
|
+
let parsed;
|
|
563
|
+
try {
|
|
564
|
+
parsed = JSON.parse(await res.text());
|
|
565
|
+
}
|
|
566
|
+
catch { /* no verdict below */ }
|
|
567
|
+
const verdict = typeof parsed?.verdict === "string" ? parsed.verdict.toUpperCase() : "";
|
|
568
|
+
if (!parsed || !VERDICTS.has(verdict)) {
|
|
569
|
+
throw new PlaneError("PLANE_UNREACHABLE", "hosted plane returned no verdict");
|
|
570
|
+
}
|
|
571
|
+
return {
|
|
572
|
+
verdict,
|
|
573
|
+
reasonCode: planeReasonCode(parsed.reasonCode),
|
|
574
|
+
...(typeof parsed.toolId === "string" ? { toolId: cleanPlaneText(parsed.toolId) } : {}),
|
|
575
|
+
...(typeof parsed.argsHash === "string" && /^[0-9a-f]{64}$/.test(parsed.argsHash) ? { argsHash: parsed.argsHash } : {}),
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
// Do not await: a stuck body must not eat the budget.
|
|
579
|
+
if (res.status === 429) {
|
|
580
|
+
last = new PlaneError("PLANE_RATE_LIMITED", "hosted plane rate limit reached (HTTP 429)");
|
|
581
|
+
const ra = retryAfterMs(res.headers.get("retry-after"), now());
|
|
582
|
+
// Floor: Retry-After 0 or a past date must not turn into a zero-wait retry loop.
|
|
583
|
+
wait = Math.max(ra ?? 0, backoffMs(attempt, random));
|
|
584
|
+
// Retry-After that does not fit the budget: fail now instead of sleeping.
|
|
585
|
+
if (ra !== undefined && ra >= deadline - now())
|
|
586
|
+
return Promise.reject(last);
|
|
587
|
+
}
|
|
588
|
+
else if (res.status >= 500) {
|
|
589
|
+
last = new PlaneError("PLANE_UNREACHABLE", `hosted plane error (HTTP ${res.status})`);
|
|
590
|
+
wait = backoffMs(attempt, random);
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
throw new PlaneError("PLANE_UNREACHABLE", `hosted plane refused the request (HTTP ${res.status})`);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
catch (e) {
|
|
597
|
+
if (e instanceof PlaneError)
|
|
598
|
+
throw e;
|
|
599
|
+
last = e?.name === "TimeoutError" || e?.name === "AbortError" || deadline - now() <= 0
|
|
600
|
+
? new PlaneError("PLANE_TIMEOUT", "hosted plane did not answer within the budget")
|
|
601
|
+
: new PlaneError("PLANE_UNREACHABLE", "hosted plane unreachable");
|
|
602
|
+
wait = backoffMs(attempt, random);
|
|
603
|
+
}
|
|
604
|
+
const left = deadline - now();
|
|
605
|
+
if (wait >= left)
|
|
606
|
+
return Promise.reject(last);
|
|
607
|
+
await sleep(wait);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
//# sourceMappingURL=hosted-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-hook.js","sourceRoot":"","sources":["../../src/commands/hosted-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,cAAc,EAA+B,MAAM,cAAc,CAAC;AA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AC,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { flagString } from "../parse-args.js";
|
|
2
2
|
import { defaultAgtAuditPath, importTraces, renderImportSummary, } from "../importers/index.js";
|
|
3
|
-
const SOURCES = ["langsmith", "langfuse", "phoenix", "otel", "agt"];
|
|
3
|
+
const SOURCES = ["langsmith", "langfuse", "phoenix", "otel", "agt", "adr-sensor"];
|
|
4
4
|
export function importOptionsFromArgs(parsed) {
|
|
5
5
|
const rawFrom = flagString(parsed.flags, "from")?.toLowerCase();
|
|
6
6
|
const from = SOURCES.find((s) => s === rawFrom);
|
|
@@ -10,7 +10,7 @@ export async function runImport(opts, io, cwd, env) {
|
|
|
10
10
|
// agt reads AGT's own audit log, so --file is optional there.
|
|
11
11
|
const file = opts.file ?? (opts.from === "agt" ? defaultAgtAuditPath(env) : undefined);
|
|
12
12
|
if (!opts.from || !file) {
|
|
13
|
-
io.error("Usage: kya import --from <langsmith|langfuse|phoenix|otel|agt> <file> | --file <path>");
|
|
13
|
+
io.error("Usage: kya import --from <langsmith|langfuse|phoenix|otel|agt|adr-sensor> <file> | --file <path>");
|
|
14
14
|
return 2;
|
|
15
15
|
}
|
|
16
16
|
const result = await importTraces({ from: opts.from, file, cwd, env });
|