@akasecurity/ai-tc-claude-code 0.9.6 → 0.9.8
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/.claude-plugin/plugin.json +1 -1
- package/README.md +2 -2
- package/commands/setup.md +0 -23
- package/package.json +6 -5
- package/scripts/apply-suppressions.js +1649 -1040
- package/scripts/backfill.js +3440 -1462
- package/scripts/dashboard.js +131 -10
- package/scripts/filescan.js +3348 -1421
- package/scripts/firstrun.js +3064 -1140
- package/scripts/intro.js +1160 -930
- package/scripts/message-display.js +1647 -1071
- package/scripts/onboard.js +1618 -1028
- package/scripts/post-tool-use.js +3506 -1419
- package/scripts/pre-tool-use.js +3446 -1372
- package/scripts/query.js +3069 -1140
- package/scripts/reconcile.js +3373 -1435
- package/scripts/remediate.js +3391 -1413
- package/scripts/scan-worker.js +1114 -916
- package/scripts/session-start.js +4299 -2216
- package/scripts/start-light.js +1078 -849
- package/scripts/statusline.js +3070 -1144
- package/scripts/stop.js +1380 -902
- package/scripts/sync.js +19413 -0
- package/scripts/user-prompt-submit.js +3433 -1359
package/scripts/intro.js
CHANGED
|
@@ -492,7 +492,7 @@ var require_ignore = __commonJS({
|
|
|
492
492
|
});
|
|
493
493
|
|
|
494
494
|
// src/intro.ts
|
|
495
|
-
import { readFileSync as
|
|
495
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
496
496
|
|
|
497
497
|
// ../../packages/schema/src/exception-scope.ts
|
|
498
498
|
var MINUTE_MS = 6e4;
|
|
@@ -15067,6 +15067,47 @@ function date4(params) {
|
|
|
15067
15067
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
15068
15068
|
config(en_default());
|
|
15069
15069
|
|
|
15070
|
+
// ../../packages/schema/src/zod/harness-map.ts
|
|
15071
|
+
var HARNESS = {
|
|
15072
|
+
ClaudeCode: "claudecode",
|
|
15073
|
+
Cursor: "cursor",
|
|
15074
|
+
Copilot: "copilot",
|
|
15075
|
+
Codex: "codex",
|
|
15076
|
+
Antigravity: "antigravity",
|
|
15077
|
+
Windsurf: "windsurf",
|
|
15078
|
+
ClaudeDesktop: "claudedesktop",
|
|
15079
|
+
ChatGpt: "chatgpt",
|
|
15080
|
+
ClaudeAi: "claudeai",
|
|
15081
|
+
Api: "api"
|
|
15082
|
+
};
|
|
15083
|
+
var Harness = external_exports.enum(HARNESS).meta({ id: "Harness" });
|
|
15084
|
+
var SOURCE_TOOL = {
|
|
15085
|
+
ClaudeCode: "claude-code",
|
|
15086
|
+
ClaudeDesktop: "claude-desktop",
|
|
15087
|
+
Cursor: "cursor",
|
|
15088
|
+
ChatGpt: "chatgpt",
|
|
15089
|
+
ClaudeAi: "claude-ai",
|
|
15090
|
+
Copilot: "github-copilot",
|
|
15091
|
+
Codex: "codex",
|
|
15092
|
+
Antigravity: "antigravity",
|
|
15093
|
+
// No harness counterpart, deliberately: the CLI's own captures and a capture
|
|
15094
|
+
// whose tool could not be identified both render through the read side's
|
|
15095
|
+
// miss path rather than as a harness of their own.
|
|
15096
|
+
Cli: "cli",
|
|
15097
|
+
Unknown: "unknown"
|
|
15098
|
+
};
|
|
15099
|
+
var SourceTool = external_exports.enum(SOURCE_TOOL).meta({ id: "SourceTool" });
|
|
15100
|
+
var TOOL_TO_HARNESS = {
|
|
15101
|
+
[SOURCE_TOOL.ClaudeCode]: HARNESS.ClaudeCode,
|
|
15102
|
+
[SOURCE_TOOL.ClaudeDesktop]: HARNESS.ClaudeDesktop,
|
|
15103
|
+
[SOURCE_TOOL.Copilot]: HARNESS.Copilot,
|
|
15104
|
+
[SOURCE_TOOL.Cursor]: HARNESS.Cursor,
|
|
15105
|
+
[SOURCE_TOOL.ChatGpt]: HARNESS.ChatGpt,
|
|
15106
|
+
[SOURCE_TOOL.Codex]: HARNESS.Codex,
|
|
15107
|
+
[SOURCE_TOOL.Antigravity]: HARNESS.Antigravity,
|
|
15108
|
+
[SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi
|
|
15109
|
+
};
|
|
15110
|
+
|
|
15070
15111
|
// ../../packages/schema/src/zod/finding.ts
|
|
15071
15112
|
var DetectionCategory = external_exports.enum(["pii", "financial", "secret", "phi", "code_context", "code_flaw", "custom", "config"]).meta({ id: "DetectionCategory" });
|
|
15072
15113
|
var Severity = external_exports.enum(["critical", "high", "medium", "low"]).meta({ id: "Severity" });
|
|
@@ -15089,21 +15130,22 @@ var Finding = external_exports.object({
|
|
|
15089
15130
|
}).meta({ id: "Finding" });
|
|
15090
15131
|
var DetectedFinding = Finding.meta({ id: "DetectedFinding" });
|
|
15091
15132
|
var FindingAction = external_exports.enum(["blocked", "redacted", "warned", "allowed", "quarantined", "monitored"]).meta({ id: "FindingAction" });
|
|
15092
|
-
var FindingProvider =
|
|
15093
|
-
"
|
|
15094
|
-
"
|
|
15095
|
-
"
|
|
15096
|
-
"
|
|
15097
|
-
"
|
|
15098
|
-
"
|
|
15099
|
-
"
|
|
15100
|
-
"
|
|
15101
|
-
"
|
|
15133
|
+
var FindingProvider = Harness.extract([
|
|
15134
|
+
"ClaudeCode",
|
|
15135
|
+
"ClaudeDesktop",
|
|
15136
|
+
"Cursor",
|
|
15137
|
+
"Copilot",
|
|
15138
|
+
"ChatGpt",
|
|
15139
|
+
"ClaudeAi",
|
|
15140
|
+
"Codex",
|
|
15141
|
+
"Antigravity",
|
|
15142
|
+
"Api"
|
|
15102
15143
|
]).meta({ id: "FindingProvider" });
|
|
15103
15144
|
var FindingCategory = external_exports.enum([
|
|
15104
15145
|
"secret",
|
|
15105
15146
|
"pii",
|
|
15106
15147
|
"source_code",
|
|
15148
|
+
"code_flaw",
|
|
15107
15149
|
"external_share",
|
|
15108
15150
|
"mcp_server",
|
|
15109
15151
|
"customer_data",
|
|
@@ -15281,6 +15323,7 @@ var FindingInstanceDetail = FindingInstance.extend({
|
|
|
15281
15323
|
detection: FindingDetectionRef,
|
|
15282
15324
|
policy: FindingPolicyRef
|
|
15283
15325
|
}).meta({ id: "FindingInstanceDetail" });
|
|
15326
|
+
var MAX_FLAT_FINDINGS_LIMIT = 200;
|
|
15284
15327
|
var ListFindingInstancesQuery = external_exports.object({
|
|
15285
15328
|
severity: external_exports.array(Severity).optional(),
|
|
15286
15329
|
// Rule ids, the same vocabulary the grouped list's `subtype` carries.
|
|
@@ -15300,7 +15343,7 @@ var ListFindingInstancesQuery = external_exports.object({
|
|
|
15300
15343
|
q: external_exports.string().optional(),
|
|
15301
15344
|
sessionId: external_exports.string().optional(),
|
|
15302
15345
|
from: external_exports.iso.datetime().optional(),
|
|
15303
|
-
limit: external_exports.coerce.number().int().min(1).max(
|
|
15346
|
+
limit: external_exports.coerce.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
15304
15347
|
cursor: external_exports.string().optional()
|
|
15305
15348
|
});
|
|
15306
15349
|
var ListFindingInstancesResponse = external_exports.object({
|
|
@@ -15362,20 +15405,6 @@ var ListFindingLocationsResponse = external_exports.object({
|
|
|
15362
15405
|
hasMore: external_exports.boolean()
|
|
15363
15406
|
}).meta({ id: "ListFindingLocationsResponse" });
|
|
15364
15407
|
|
|
15365
|
-
// ../../packages/schema/src/zod/harness-map.ts
|
|
15366
|
-
var Harness = external_exports.enum([
|
|
15367
|
-
"claudecode",
|
|
15368
|
-
"cursor",
|
|
15369
|
-
"copilot",
|
|
15370
|
-
"codex",
|
|
15371
|
-
"antigravity",
|
|
15372
|
-
"windsurf",
|
|
15373
|
-
"claudedesktop",
|
|
15374
|
-
"chatgpt",
|
|
15375
|
-
"claudeai",
|
|
15376
|
-
"api"
|
|
15377
|
-
]).meta({ id: "Harness" });
|
|
15378
|
-
|
|
15379
15408
|
// ../../packages/schema/src/zod/meta.ts
|
|
15380
15409
|
var InventoryObjectType = external_exports.enum(["host", "harness", "user", "skill", "hook", "mcp_server", "config_file"]).meta({ id: "InventoryObjectType" });
|
|
15381
15410
|
var AuditEventType = external_exports.enum([
|
|
@@ -15825,759 +15854,393 @@ var ActivityOverviewResponse = external_exports.object({
|
|
|
15825
15854
|
sessions: ListActivitySessionsResponse
|
|
15826
15855
|
}).meta({ id: "ActivityOverviewResponse" });
|
|
15827
15856
|
|
|
15828
|
-
// ../../packages/schema/src/zod/
|
|
15829
|
-
var
|
|
15830
|
-
var
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
filePath: external_exports.string().optional(),
|
|
15847
|
-
// The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
|
|
15848
|
-
// set by the tool-scanning hooks. The tool NAME only — never the tool's
|
|
15849
|
-
// arguments or output, which can carry the very value a finding masked
|
|
15850
|
-
// (metadata is stored unredacted). Gives findings on non-file captures a
|
|
15851
|
-
// display location ("via Bash") when no filePath exists.
|
|
15852
|
-
toolName: external_exports.string().optional(),
|
|
15853
|
-
// Set (true) by the worktree scanner when the file is excluded by the
|
|
15854
|
-
// repo's .gitignore. Gitignored files ARE still scanned — local scratch and
|
|
15855
|
-
// generated code can leak real secrets — but the provenance is recorded so
|
|
15856
|
-
// policy/dashboards can treat those findings as informational rather than
|
|
15857
|
-
// blocking. Omitted (not false) for tracked files and non-scan events.
|
|
15858
|
-
gitignored: external_exports.boolean().optional(),
|
|
15859
|
-
// Set (true) ONLY when the event's `content` is the COMPLETE file at
|
|
15860
|
-
// capture time (a worktree scan reading from disk). Hook-captured edits
|
|
15861
|
-
// (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
|
|
15862
|
-
// this. The resolver-on-ingest keys its fixed-at-source dropout
|
|
15863
|
-
// diff on this marker: only a whole-file snapshot can prove a previously
|
|
15864
|
-
// open finding is gone; a fragment's absence proves nothing (the secret
|
|
15865
|
-
// may live outside the hunk). Omitted (not false) for fragments and
|
|
15866
|
-
// non-scan events, so pre-marker clients safely default to the
|
|
15867
|
-
// non-authoritative path.
|
|
15868
|
-
wholeFile: external_exports.boolean().optional(),
|
|
15869
|
-
model: external_exports.string().optional(),
|
|
15870
|
-
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
15871
|
-
// Distributed-tracing correlation. `correlationId` ties a recorded event back
|
|
15872
|
-
// to the request that captured/ingested it (a UUID, generated independently of
|
|
15873
|
-
// the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
|
|
15874
|
-
// originating span when telemetry is enabled. Both optional + backward
|
|
15875
|
-
// compatible — populated by the plugin (see @akasecurity/plugin-sdk).
|
|
15876
|
-
correlationId: external_exports.uuid().optional(),
|
|
15877
|
-
traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
|
|
15878
|
-
// Ids of the detection exceptions that downgraded findings in this capture
|
|
15879
|
-
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
15880
|
-
// authorized the bypass. Absent on captures where no exception applied.
|
|
15881
|
-
exceptionIds: external_exports.array(external_exports.guid()).optional()
|
|
15882
|
-
}).meta({ id: "EventMetadata" });
|
|
15883
|
-
var Event = external_exports.object({
|
|
15884
|
-
id: external_exports.guid(),
|
|
15885
|
-
sourceTool: SourceTool,
|
|
15886
|
-
kind: EventKind,
|
|
15887
|
-
occurredAt: external_exports.iso.datetime(),
|
|
15888
|
-
contentHash: external_exports.string(),
|
|
15889
|
-
content: external_exports.string(),
|
|
15890
|
-
metadata: EventMetadata.optional()
|
|
15891
|
-
}).meta({ id: "Event" });
|
|
15892
|
-
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
15893
|
-
var IngestBatch = external_exports.object({
|
|
15894
|
-
events: external_exports.array(IngestEvent).min(1).max(100),
|
|
15895
|
-
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
15896
|
-
// additionally rejects any event whose contentHash the store has already
|
|
15897
|
-
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
15898
|
-
// backfill), where a re-run mints fresh event ids for identical content and
|
|
15899
|
-
// would otherwise accumulate duplicates. Live hook traffic must NOT set it:
|
|
15900
|
-
// two genuinely separate prompts can be byte-identical and both belong on
|
|
15901
|
-
// the timeline.
|
|
15902
|
-
dedupe: external_exports.literal("content-hash").optional()
|
|
15903
|
-
}).meta({ id: "IngestBatch" });
|
|
15904
|
-
|
|
15905
|
-
// ../../packages/schema/src/zod/inventory.ts
|
|
15906
|
-
var AssetType = external_exports.enum(["project", "skill", "mcp", "hook", "config"]).meta({ id: "AssetType" });
|
|
15907
|
-
var AccessLevel = external_exports.enum(["open", "approved", "blocked"]).meta({ id: "AccessLevel" });
|
|
15908
|
-
var Origin = external_exports.enum(["source", "public-dep", "vendored", "config", "data", "docs", "generated"]).meta({ id: "Origin" });
|
|
15909
|
-
var TrustLevel = external_exports.enum(["known-good", "risky", "unapproved"]).meta({ id: "TrustLevel" });
|
|
15910
|
-
var Flag = external_exports.enum(["update", "stale", "conflict", "unknown", "change", "untracked", "risk", "findings"]).meta({ id: "Flag" });
|
|
15911
|
-
var Visibility = external_exports.enum(["public", "private"]).meta({ id: "Visibility" });
|
|
15912
|
-
var HarnessEventKind = external_exports.enum(["block", "redact", "warn"]).meta({ id: "HarnessEventKind" });
|
|
15913
|
-
var HarnessId = external_exports.enum(["claudecode", "cursor", "codex", "antigravity"]).meta({ id: "HarnessId" });
|
|
15914
|
-
var AccessCounts = external_exports.object({
|
|
15915
|
-
open: external_exports.number().int().nonnegative(),
|
|
15916
|
-
approved: external_exports.number().int().nonnegative(),
|
|
15917
|
-
blocked: external_exports.number().int().nonnegative(),
|
|
15918
|
-
total: external_exports.number().int().nonnegative()
|
|
15919
|
-
}).meta({ id: "AccessCounts" });
|
|
15920
|
-
var AssetSummary = external_exports.object({
|
|
15921
|
-
id: external_exports.string(),
|
|
15922
|
-
type: AssetType,
|
|
15923
|
-
name: external_exports.string(),
|
|
15924
|
-
sub: external_exports.string(),
|
|
15925
|
-
flags: external_exports.array(Flag),
|
|
15926
|
-
/** MCP servers only — omitted for all other types. */
|
|
15927
|
-
trust: TrustLevel.optional()
|
|
15928
|
-
}).meta({ id: "AssetSummary" });
|
|
15929
|
-
var ProjectSummary = external_exports.object({
|
|
15930
|
-
id: external_exports.string(),
|
|
15931
|
-
name: external_exports.string(),
|
|
15932
|
-
repo: external_exports.string(),
|
|
15933
|
-
visibility: Visibility,
|
|
15934
|
-
language: external_exports.string(),
|
|
15935
|
-
policyDefault: AccessLevel,
|
|
15936
|
-
updatedAt: external_exports.iso.datetime(),
|
|
15937
|
-
accessCounts: AccessCounts,
|
|
15938
|
-
findingsCount: external_exports.number().int().nonnegative()
|
|
15939
|
-
}).meta({ id: "ProjectSummary" });
|
|
15940
|
-
var HarnessCategory = external_exports.object({
|
|
15941
|
-
/** One of config/skill/mcp/hook — never project (enforced at service layer). */
|
|
15942
|
-
type: AssetType,
|
|
15943
|
-
assets: external_exports.array(AssetSummary)
|
|
15857
|
+
// ../../packages/schema/src/zod/config-inventory.ts
|
|
15858
|
+
var ConfigScope = external_exports.enum(["user", "project", "local", "plugin"]);
|
|
15859
|
+
var SkillScanEntry = external_exports.object({
|
|
15860
|
+
name: external_exports.string().min(1),
|
|
15861
|
+
// The identity source: a marketplace repo for plugin skills (e.g.
|
|
15862
|
+
// 'anthropics/skills'), 'local' for personal ~/.claude/skills, or
|
|
15863
|
+
// 'project:<repo-identity>' for checked-in project skills. The surrogate keeps
|
|
15864
|
+
// a personal skill named 'pdf' from colliding with the marketplace 'pdf'.
|
|
15865
|
+
source: external_exports.string().min(1),
|
|
15866
|
+
scope: ConfigScope,
|
|
15867
|
+
pluginName: external_exports.string().optional(),
|
|
15868
|
+
// Volatile — rides the attribute bag, never the identity hash.
|
|
15869
|
+
version: external_exports.string().optional(),
|
|
15870
|
+
description: external_exports.string().optional(),
|
|
15871
|
+
// Skill directory mtime (ISO) — the "updated Nd ago" freshness signal.
|
|
15872
|
+
updatedAt: external_exports.iso.datetime().optional(),
|
|
15873
|
+
// Filesystem path — the promoted inventory `location` column.
|
|
15874
|
+
location: external_exports.string().optional()
|
|
15944
15875
|
});
|
|
15945
|
-
var
|
|
15946
|
-
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15876
|
+
var HookScanEntry = external_exports.object({
|
|
15877
|
+
// Hook event name (PreToolUse, PostToolUse, …). Open string, not an enum: the
|
|
15878
|
+
// set is harness-defined and grows without a schema change.
|
|
15879
|
+
event: external_exports.string().min(1),
|
|
15880
|
+
// The tool matcher ('Bash', 'Edit|Write', …). Absent = matches all tools.
|
|
15881
|
+
matcher: external_exports.string().optional(),
|
|
15882
|
+
command: external_exports.string().min(1),
|
|
15883
|
+
timeout: external_exports.number().optional(),
|
|
15884
|
+
scope: ConfigScope,
|
|
15885
|
+
pluginName: external_exports.string().optional(),
|
|
15886
|
+
// The settings file / hooks.json the entry came from.
|
|
15887
|
+
location: external_exports.string().optional()
|
|
15888
|
+
});
|
|
15889
|
+
var McpServerScanEntry = external_exports.object({
|
|
15890
|
+
// The server's config key ("github", "filesystem", …) — identity, with the
|
|
15891
|
+
// qualified scope (see mcpServerIdentityKey).
|
|
15892
|
+
name: external_exports.string().min(1),
|
|
15893
|
+
scope: ConfigScope,
|
|
15894
|
+
pluginName: external_exports.string().optional(),
|
|
15895
|
+
// The owning plugin's marketplace — part of PLUGIN-scope identity: two
|
|
15896
|
+
// marketplaces can each ship a plugin named `guard`, and without this their
|
|
15897
|
+
// same-named servers would collapse to one row (the second silently dropped,
|
|
15898
|
+
// inheriting the first's trust).
|
|
15899
|
+
marketplace: external_exports.string().optional(),
|
|
15900
|
+
// The repo identity (remote url, or the cwd for un-remoted repos) — part of
|
|
15901
|
+
// PROJECT/LOCAL-scope identity: a server named `github` in repo A and one in
|
|
15902
|
+
// repo B are different servers with different commands, and MUST NOT share a
|
|
15903
|
+
// row — a shared row would let a cloned repo's .mcp.json inherit the trust
|
|
15904
|
+
// the user granted elsewhere.
|
|
15905
|
+
project: external_exports.string().optional(),
|
|
15906
|
+
// 'stdio' when the entry carries a command; otherwise the config's `type`
|
|
15907
|
+
// ('http' / 'sse' / …). Open string — the transport set is harness-defined.
|
|
15908
|
+
transport: external_exports.string().min(1),
|
|
15909
|
+
// Volatile on purpose (unlike hook `command`): a changed command/url is drift
|
|
15910
|
+
// on a stable row — visible across config_scan snapshots and preserving the
|
|
15911
|
+
// user's trust decision — never a quiet new row. One of the two is present.
|
|
15912
|
+
// Secret-masked at collection time (the scanner runs the bundled detection
|
|
15913
|
+
// packs over both — tokens routinely ride command args and URLs).
|
|
15914
|
+
command: external_exports.string().optional(),
|
|
15915
|
+
url: external_exports.string().optional(),
|
|
15916
|
+
// Env var NAMES only, never values (the no-secrets rule).
|
|
15917
|
+
envKeys: external_exports.array(external_exports.string()).optional(),
|
|
15918
|
+
// The config file the entry came from.
|
|
15919
|
+
location: external_exports.string().optional()
|
|
15920
|
+
});
|
|
15921
|
+
var ConfigFileScanEntry = external_exports.object({
|
|
15922
|
+
// Basename (settings.json, CLAUDE.md) or dir name (commands/, agents/).
|
|
15923
|
+
name: external_exports.string().min(1),
|
|
15924
|
+
// The absolute path — identity (with scope) and the promoted `location`.
|
|
15925
|
+
path: external_exports.string().min(1),
|
|
15926
|
+
scope: ConfigScope,
|
|
15927
|
+
// Human label: "User settings", "Project memory", "Slash commands", …
|
|
15928
|
+
kind: external_exports.string().min(1),
|
|
15929
|
+
// Derived SHAPE summary — top-level key names, entry counts, line counts.
|
|
15930
|
+
// Never file content or values (memory files can carry sensitive detail).
|
|
15931
|
+
detail: external_exports.string().optional(),
|
|
15932
|
+
// Dir configs (commands/, agents/) and .mcp.json: how many entries.
|
|
15933
|
+
entryCount: external_exports.number().optional(),
|
|
15934
|
+
// File mtime (ISO) — the freshness signal.
|
|
15935
|
+
updatedAt: external_exports.iso.datetime().optional()
|
|
15936
|
+
});
|
|
15937
|
+
var ConfigScanResult = external_exports.object({
|
|
15938
|
+
scannedAt: external_exports.iso.datetime(),
|
|
15939
|
+
skills: external_exports.array(SkillScanEntry),
|
|
15940
|
+
hooks: external_exports.array(HookScanEntry),
|
|
15941
|
+
mcpServers: external_exports.array(McpServerScanEntry),
|
|
15942
|
+
configFiles: external_exports.array(ConfigFileScanEntry),
|
|
15943
|
+
errors: external_exports.array(external_exports.object({ source: external_exports.string(), reason: external_exports.string() }))
|
|
15944
|
+
});
|
|
15945
|
+
var ConfigPostureFindingInput = external_exports.object({
|
|
15946
|
+
ruleId: external_exports.string().min(1),
|
|
15947
|
+
version: external_exports.string().min(1),
|
|
15948
|
+
span: Span,
|
|
15949
|
+
// For posture rules this is the offending COMMAND (config the user already
|
|
15950
|
+
// holds locally, not captured secret content) — it is also the correlation
|
|
15951
|
+
// key the read surface matches back to a hook row.
|
|
15952
|
+
maskedMatch: external_exports.string(),
|
|
15953
|
+
actionTaken: ActionTaken,
|
|
15954
|
+
confidence: external_exports.number().min(0).max(1)
|
|
15955
|
+
});
|
|
15956
|
+
var ConfigScanRecord = external_exports.object({
|
|
15957
|
+
items: external_exports.array(InventoryInput),
|
|
15958
|
+
scanEvent: AuditEventInput,
|
|
15959
|
+
definitions: external_exports.array(InspectionDefinitionInput).optional(),
|
|
15960
|
+
findings: external_exports.array(ConfigPostureFindingInput).optional()
|
|
15961
|
+
});
|
|
15962
|
+
|
|
15963
|
+
// ../../packages/schema/src/zod/control-plane.ts
|
|
15964
|
+
var ATTACHED_CREDENTIAL_SPEC_VERSION = 1;
|
|
15965
|
+
var AttachedCredential = external_exports.object({
|
|
15966
|
+
specVersion: external_exports.literal(ATTACHED_CREDENTIAL_SPEC_VERSION),
|
|
15967
|
+
// The control-plane endpoint this credential was minted against.
|
|
15968
|
+
endpoint: external_exports.string().min(1),
|
|
15969
|
+
// The bearer credential itself. Never logged, never rendered — status
|
|
15970
|
+
// surfaces show `keyPrefix` and nothing else.
|
|
15971
|
+
apiKey: external_exports.string().min(1),
|
|
15972
|
+
// First few characters of the key, safe to display so a user can match the
|
|
15973
|
+
// credential against their organization's key list.
|
|
15974
|
+
keyPrefix: external_exports.string().min(1).max(16).optional(),
|
|
15975
|
+
mintedAt: external_exports.iso.datetime().optional()
|
|
15976
|
+
});
|
|
15977
|
+
var MAX_DATE_MS = 253402300799999;
|
|
15978
|
+
var MAX_INT4 = 2147483647;
|
|
15979
|
+
var StorePosturePack = external_exports.object({
|
|
15980
|
+
packId: external_exports.string().min(1),
|
|
15981
|
+
// 'namespace/packId'
|
|
15982
|
+
version: external_exports.string().min(1),
|
|
15983
|
+
enabled: external_exports.boolean(),
|
|
15984
|
+
// Stringified pass-through of the local store's `installed_packs.updated_at`
|
|
15985
|
+
// — the column format is store-version-dependent (epoch millis vs ISO), so
|
|
15986
|
+
// the wire shape assumes neither.
|
|
15987
|
+
updatedAt: external_exports.string().nullable()
|
|
15988
|
+
}).meta({ id: "StorePosturePack" });
|
|
15989
|
+
var StorePosturePolicyCounts = external_exports.object({
|
|
15990
|
+
total: external_exports.number().int().min(0),
|
|
15991
|
+
disabled: external_exports.number().int().min(0),
|
|
15992
|
+
// Exhaustive per-action map; the builder pre-fills every action with 0.
|
|
15993
|
+
//
|
|
15994
|
+
// Spelled out member-by-member rather than `z.record(ActionTaken, …)`. Zod
|
|
15995
|
+
// enforces exhaustiveness either way, but z.record emits `propertyNames` +
|
|
15996
|
+
// `additionalProperties` into a generated schema document, and a type
|
|
15997
|
+
// generator renders THAT with every key optional — a sender built against
|
|
15998
|
+
// the generated type would typecheck and still be rejected at runtime. An
|
|
15999
|
+
// explicit object emits `properties` + `required`, so generated types
|
|
16000
|
+
// demand all five.
|
|
16001
|
+
//
|
|
16002
|
+
// `satisfies Record<ActionTaken, …>` keeps the link to the enum: adding an
|
|
16003
|
+
// ActionTaken member is a COMPILE error here instead of silent drift.
|
|
16004
|
+
// `.strict()` is load-bearing — it rejects an unknown action key, which a
|
|
16005
|
+
// bare object would silently STRIP, accepting a miscounted map as valid.
|
|
16006
|
+
byAction: external_exports.object({
|
|
16007
|
+
warn: external_exports.number().int().min(0),
|
|
16008
|
+
redact: external_exports.number().int().min(0),
|
|
16009
|
+
block: external_exports.number().int().min(0),
|
|
16010
|
+
allow: external_exports.number().int().min(0),
|
|
16011
|
+
log: external_exports.number().int().min(0)
|
|
16012
|
+
}).strict()
|
|
16013
|
+
}).meta({ id: "StorePosturePolicyCounts" });
|
|
16014
|
+
var StorePosturePlugin = external_exports.object({
|
|
16015
|
+
/** Package name of the reporting plugin. */
|
|
16016
|
+
package: external_exports.string().min(1).max(200),
|
|
16017
|
+
version: external_exports.string().min(1).max(64),
|
|
16018
|
+
/** Version of the bundled core, when the build records one separately. */
|
|
16019
|
+
ossVersion: external_exports.string().max(64).nullable(),
|
|
15971
16020
|
/**
|
|
15972
|
-
*
|
|
15973
|
-
*
|
|
16021
|
+
* `version` of the policy bundle this machine last fetched. Bounded at 200
|
|
16022
|
+
* rather than the 64 a bare sha256 hex digest needs today, so a later
|
|
16023
|
+
* format with an algorithm prefix does not start rejecting the channel.
|
|
15974
16024
|
*/
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
var InventoryStats = external_exports.object({
|
|
16015
|
-
/** Total assets/projects with ≥1 flag or finding (drives the attention header chip). */
|
|
16016
|
-
attention: external_exports.number().int().nonnegative(),
|
|
16017
|
-
byType: external_exports.object({
|
|
16018
|
-
project: external_exports.number().int().nonnegative(),
|
|
16019
|
-
skill: external_exports.number().int().nonnegative(),
|
|
16020
|
-
mcp: external_exports.number().int().nonnegative(),
|
|
16021
|
-
hook: external_exports.number().int().nonnegative(),
|
|
16022
|
-
config: external_exports.number().int().nonnegative()
|
|
16023
|
-
}),
|
|
16024
|
-
harnesses: external_exports.number().int().nonnegative(),
|
|
16025
|
-
mcpTrust: external_exports.object({
|
|
16026
|
-
"known-good": external_exports.number().int().nonnegative(),
|
|
16027
|
-
risky: external_exports.number().int().nonnegative(),
|
|
16028
|
-
unapproved: external_exports.number().int().nonnegative()
|
|
16029
|
-
})
|
|
16030
|
-
}).meta({ id: "InventoryStats" });
|
|
16031
|
-
var FileSummary = external_exports.object({
|
|
16032
|
-
path: external_exports.string(),
|
|
16033
|
-
name: external_exports.string(),
|
|
16034
|
-
origin: Origin,
|
|
16035
|
-
/** Effective access (override applied). */
|
|
16036
|
-
access: AccessLevel,
|
|
16037
|
-
/** True when a file_access_override differs from the computed default. */
|
|
16038
|
-
isCustom: external_exports.boolean(),
|
|
16039
|
-
findings: external_exports.number().int().nonnegative(),
|
|
16040
|
-
/** When the file was auto-blocked by a detection; null when not blocked. */
|
|
16041
|
-
blockedAt: external_exports.iso.datetime().nullable().optional(),
|
|
16042
|
-
/** Why the file was blocked; null when absent. */
|
|
16043
|
-
note: external_exports.string().nullable().optional()
|
|
16044
|
-
}).meta({ id: "FileSummary" });
|
|
16045
|
-
var FolderSummary = external_exports.object({
|
|
16046
|
-
name: external_exports.string(),
|
|
16047
|
-
path: external_exports.string(),
|
|
16048
|
-
/** Rollup of effective access across all descendants. */
|
|
16049
|
-
accessCounts: AccessCounts
|
|
16050
|
-
}).meta({ id: "FolderSummary" });
|
|
16051
|
-
var ProjectTreeResponse = external_exports.object({
|
|
16052
|
-
project: external_exports.object({
|
|
16053
|
-
id: external_exports.string(),
|
|
16054
|
-
repo: external_exports.string(),
|
|
16055
|
-
visibility: Visibility
|
|
16056
|
-
}),
|
|
16057
|
-
path: external_exports.string(),
|
|
16058
|
-
/** Browse mode: one-level folders at the current path. Omitted in search mode. */
|
|
16059
|
-
folders: external_exports.array(FolderSummary).optional(),
|
|
16060
|
-
files: external_exports.array(FileSummary)
|
|
16061
|
-
}).meta({ id: "ProjectTreeResponse" });
|
|
16062
|
-
var FileDetail = FileSummary.extend({
|
|
16063
|
-
project: external_exports.object({
|
|
16064
|
-
repo: external_exports.string(),
|
|
16065
|
-
visibility: Visibility,
|
|
16066
|
-
language: external_exports.string(),
|
|
16067
|
-
policyDefault: AccessLevel,
|
|
16068
|
-
updatedAt: external_exports.iso.datetime()
|
|
16069
|
-
}),
|
|
16070
|
-
findingsRefs: external_exports.array(external_exports.object({ id: external_exports.string(), title: external_exports.string() }))
|
|
16071
|
-
}).meta({ id: "FileDetail" });
|
|
16072
|
-
var SetFileAccessBody = external_exports.object({
|
|
16073
|
-
path: external_exports.string(),
|
|
16074
|
-
access: AccessLevel
|
|
16075
|
-
}).meta({ id: "SetFileAccessBody" });
|
|
16076
|
-
var SetFileAccessResponse = external_exports.object({
|
|
16077
|
-
file: FileSummary,
|
|
16078
|
-
accessCounts: AccessCounts
|
|
16079
|
-
}).meta({ id: "SetFileAccessResponse" });
|
|
16080
|
-
var SetMcpTrustBody = external_exports.object({ trust: TrustLevel }).meta({ id: "SetMcpTrustBody" });
|
|
16081
|
-
var HarnessEventItem = external_exports.object({
|
|
16082
|
-
kind: HarnessEventKind,
|
|
16083
|
-
title: external_exports.string(),
|
|
16084
|
-
detail: external_exports.string(),
|
|
16085
|
-
occurredAt: external_exports.iso.datetime(),
|
|
16086
|
-
findingId: external_exports.string().nullable().optional()
|
|
16087
|
-
}).meta({ id: "HarnessEventItem" });
|
|
16088
|
-
var HarnessEventsResponse = external_exports.object({
|
|
16089
|
-
counts: external_exports.object({
|
|
16090
|
-
block: external_exports.number().int().nonnegative(),
|
|
16091
|
-
redact: external_exports.number().int().nonnegative(),
|
|
16092
|
-
warn: external_exports.number().int().nonnegative()
|
|
16093
|
-
}),
|
|
16094
|
-
items: external_exports.array(HarnessEventItem)
|
|
16095
|
-
}).meta({ id: "HarnessEventsResponse" });
|
|
16096
|
-
var RescanResponse = external_exports.object({
|
|
16097
|
-
jobId: external_exports.string(),
|
|
16098
|
-
startedAt: external_exports.iso.datetime()
|
|
16099
|
-
}).meta({ id: "RescanResponse" });
|
|
16100
|
-
var ConnectProjectBody = external_exports.object({ repo: external_exports.string() }).meta({ id: "ConnectProjectBody" });
|
|
16101
|
-
var ListAssetsQuery = external_exports.object({
|
|
16102
|
-
/** Filter by one or more AssetType values; absent means all types. */
|
|
16103
|
-
type: external_exports.array(AssetType).optional(),
|
|
16104
|
-
/** Free-text search term. */
|
|
16105
|
-
q: external_exports.string().optional()
|
|
16106
|
-
});
|
|
16107
|
-
var GetProjectTreeQuery = external_exports.object({
|
|
16108
|
-
/** Subtree root path; defaults to repository root when absent. */
|
|
16109
|
-
path: external_exports.string().optional(),
|
|
16110
|
-
/** Free-text filter applied to file paths. */
|
|
16111
|
-
q: external_exports.string().optional(),
|
|
16112
|
-
/**
|
|
16113
|
-
* Special listing mode. `blocked` returns every effectively-blocked, auto-blocked
|
|
16114
|
-
* file across the whole repo (folders omitted, most-recent first), ignoring
|
|
16115
|
-
* `path`/`q` — powers the project-wide "recently blocked" strip.
|
|
16116
|
-
*/
|
|
16117
|
-
filter: external_exports.enum(["blocked"]).optional()
|
|
16025
|
+
policyBundleVersion: external_exports.string().max(200).nullable(),
|
|
16026
|
+
/** Epoch millis, on the CLIENT clock, of that fetch. */
|
|
16027
|
+
policyFetchedAt: external_exports.number().int().min(0).max(MAX_DATE_MS).nullable()
|
|
16028
|
+
}).meta({ id: "StorePosturePlugin" });
|
|
16029
|
+
var StorePostureSnapshot = external_exports.object({
|
|
16030
|
+
deviceId: external_exports.guid(),
|
|
16031
|
+
hostname: external_exports.string().min(1).max(253),
|
|
16032
|
+
// Epoch millis on the CLIENT clock. Bounded by what a receiving store
|
|
16033
|
+
// accepts (see MAX_DATE_MS), not by what a JavaScript Date can hold.
|
|
16034
|
+
capturedAt: external_exports.number().int().min(0).max(MAX_DATE_MS),
|
|
16035
|
+
// False is a measurement, not an error state: "no local store exists on
|
|
16036
|
+
// this machine".
|
|
16037
|
+
storePresent: external_exports.boolean(),
|
|
16038
|
+
schemaVersion: external_exports.number().int().min(0).max(MAX_INT4).nullable(),
|
|
16039
|
+
// PRAGMA user_version
|
|
16040
|
+
findingsTotal: external_exports.number().int().min(0).max(MAX_INT4),
|
|
16041
|
+
// Epoch millis, bounded like `capturedAt` — see MAX_DATE_MS on what that
|
|
16042
|
+
// bound does and does not do. Worth stating for these two specifically:
|
|
16043
|
+
// they are read from the local store's own ROWS rather than from this
|
|
16044
|
+
// machine's clock, so a damaged or hand-edited store is enough to produce
|
|
16045
|
+
// an out-of-range value with no clock skew involved.
|
|
16046
|
+
findingsFirstAt: external_exports.number().int().min(0).max(MAX_DATE_MS).nullable(),
|
|
16047
|
+
findingsLastAt: external_exports.number().int().min(0).max(MAX_DATE_MS).nullable(),
|
|
16048
|
+
packs: external_exports.array(StorePosturePack).max(500),
|
|
16049
|
+
policyCounts: StorePosturePolicyCounts,
|
|
16050
|
+
// OPTIONAL, not nullable: a reporter that predates this member keeps
|
|
16051
|
+
// getting its 200 without a payload change.
|
|
16052
|
+
plugin: StorePosturePlugin.optional()
|
|
16053
|
+
}).meta({ id: "StorePostureSnapshot" });
|
|
16054
|
+
var CAPTURE_VERSION_PREFIX = "capture/";
|
|
16055
|
+
var RecordAuditEventRequest = AuditEventInput.extend({
|
|
16056
|
+
inspections: external_exports.array(ToolCallInspection).default([])
|
|
16057
|
+
}).refine((v) => v.inspections.every((i) => !i.ruleVersion.startsWith(CAPTURE_VERSION_PREFIX)), {
|
|
16058
|
+
message: `inspections[].ruleVersion must not start with \`${CAPTURE_VERSION_PREFIX}\` \u2014 that namespace is reserved for capture definitions the control plane mints itself`,
|
|
16059
|
+
path: ["inspections"]
|
|
16060
|
+
}).meta({ id: "RecordAuditEventRequest" });
|
|
16061
|
+
var IngestAck = external_exports.object({
|
|
16062
|
+
accepted: external_exports.number().int().nonnegative(),
|
|
16063
|
+
duplicates: external_exports.number().int().nonnegative()
|
|
16118
16064
|
});
|
|
16119
|
-
var
|
|
16120
|
-
|
|
16121
|
-
|
|
16065
|
+
var PRINTABLE = /^[^\p{Cc}\p{Cf}]*$/u;
|
|
16066
|
+
var printable = (max) => external_exports.string().max(max).regex(PRINTABLE, "must not contain control characters");
|
|
16067
|
+
var PluginWhoami = external_exports.object({
|
|
16068
|
+
tenantName: printable(200),
|
|
16069
|
+
userEmail: printable(320),
|
|
16070
|
+
role: printable(64),
|
|
16071
|
+
keyKind: printable(64),
|
|
16072
|
+
serverTime: printable(64)
|
|
16122
16073
|
});
|
|
16123
|
-
var
|
|
16124
|
-
|
|
16125
|
-
|
|
16074
|
+
var ControlPlaneErrorBody = external_exports.object({
|
|
16075
|
+
error: external_exports.object({
|
|
16076
|
+
code: external_exports.string().optional(),
|
|
16077
|
+
message: external_exports.string().optional()
|
|
16078
|
+
}).optional()
|
|
16126
16079
|
});
|
|
16127
16080
|
|
|
16128
|
-
// ../../packages/schema/src/zod/
|
|
16129
|
-
var
|
|
16130
|
-
var
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
provider: external_exports.string().optional()
|
|
16134
|
-
}).strict();
|
|
16135
|
-
var ExceptionCapability = external_exports.enum(["suppress", "reveal_to_model"]);
|
|
16136
|
-
var DetectionException = external_exports.object({
|
|
16137
|
-
id: external_exports.guid(),
|
|
16138
|
-
ruleId: external_exports.string(),
|
|
16139
|
-
// Denormalized from the rule, for reporting — never matched on.
|
|
16140
|
-
category: DetectionCategory,
|
|
16141
|
-
// HMAC-SHA256 hex of the raw match under a machine-local key: a KEYED
|
|
16142
|
-
// fingerprint, never the raw value, and never reversible. Matching recomputes
|
|
16143
|
-
// the fingerprint from a fresh capture; the value itself is never stored.
|
|
16144
|
-
// Shape-constrained so a malformed — or accidentally raw — value is rejected
|
|
16145
|
-
// at the boundary rather than persisted.
|
|
16146
|
-
valueFingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
16147
|
-
// Version of the fingerprint key the grant was written under; a rotated key
|
|
16148
|
-
// invalidates old grants rather than silently mismatching them.
|
|
16149
|
-
keyVersion: external_exports.number().int().positive(),
|
|
16150
|
-
// maskMatch() preview of the approved value — never the raw value.
|
|
16151
|
-
maskedValue: external_exports.string(),
|
|
16152
|
-
capability: ExceptionCapability.default("suppress"),
|
|
16153
|
-
scope: ExceptionScope,
|
|
16154
|
-
expiresAt: external_exports.iso.datetime().nullable(),
|
|
16155
|
-
maxUses: external_exports.number().int().positive().nullable(),
|
|
16156
|
-
useCount: external_exports.number().int().nonnegative(),
|
|
16157
|
-
lastUsedAt: external_exports.iso.datetime().nullable(),
|
|
16158
|
-
// Mandatory: every grant carries the human reason it exists.
|
|
16159
|
-
justification: external_exports.string().min(1),
|
|
16160
|
-
conditions: ExceptionConditions.nullable(),
|
|
16161
|
-
createdBy: external_exports.string(),
|
|
16162
|
-
createdVia: external_exports.enum(["cli-approve", "cli-add", "web-approve", "web-add", "api", "setup-triage"]),
|
|
16163
|
-
createdAt: external_exports.iso.datetime(),
|
|
16164
|
-
updatedAt: external_exports.iso.datetime(),
|
|
16165
|
-
// Revocation is terminal and retained — consumed/expired/revoked rows are
|
|
16166
|
-
// audit evidence; nothing in the exception lifecycle hard-deletes.
|
|
16167
|
-
revokedAt: external_exports.iso.datetime().nullable(),
|
|
16168
|
-
revokedBy: external_exports.string().nullable(),
|
|
16169
|
-
revokeReason: external_exports.string().nullable()
|
|
16170
|
-
});
|
|
16171
|
-
var ExceptionBundleEntry = DetectionException.pick({
|
|
16172
|
-
id: true,
|
|
16173
|
-
ruleId: true,
|
|
16174
|
-
valueFingerprint: true,
|
|
16175
|
-
keyVersion: true,
|
|
16176
|
-
capability: true,
|
|
16177
|
-
expiresAt: true,
|
|
16178
|
-
maxUses: true,
|
|
16179
|
-
useCount: true,
|
|
16180
|
-
conditions: true
|
|
16181
|
-
});
|
|
16182
|
-
var ExceptionDescriptor = DetectionException.omit({ valueFingerprint: true });
|
|
16081
|
+
// ../../packages/schema/src/zod/registry.ts
|
|
16082
|
+
var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
16083
|
+
var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
16084
|
+
var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
|
|
16085
|
+
var PublisherKind = external_exports.enum(["labs", "user", "org"]);
|
|
16183
16086
|
|
|
16184
16087
|
// ../../packages/schema/src/zod/rule.ts
|
|
16185
|
-
var MatcherType = external_exports.enum(["keyword", "regex"
|
|
16088
|
+
var MatcherType = external_exports.enum(["keyword", "regex"]).meta({ id: "MatcherType" });
|
|
16186
16089
|
var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
|
|
16187
|
-
var KeywordMatcher = external_exports.
|
|
16090
|
+
var KeywordMatcher = external_exports.strictObject({
|
|
16188
16091
|
type: external_exports.literal("keyword"),
|
|
16189
16092
|
// An empty keyword matches at every position, yielding one zero-length span
|
|
16190
16093
|
// per character. Rejected here because a keyword that matches everything is
|
|
16191
16094
|
// never intentional.
|
|
16192
|
-
keywords: external_exports.array(external_exports.string().min(1)).min(1),
|
|
16193
|
-
caseSensitive: external_exports.boolean().default(false)
|
|
16194
|
-
});
|
|
16195
|
-
function isValidRegex(pattern, flags) {
|
|
16196
|
-
try {
|
|
16197
|
-
new RegExp(pattern, flags);
|
|
16198
|
-
return true;
|
|
16199
|
-
} catch {
|
|
16200
|
-
return false;
|
|
16201
|
-
}
|
|
16202
|
-
}
|
|
16203
|
-
function matchesEmptyString(pattern, flags) {
|
|
16204
|
-
try {
|
|
16205
|
-
const re = new RegExp(pattern, flags.replace(/[gy]/g, ""));
|
|
16206
|
-
return re.exec("")?.[0].length === 0;
|
|
16207
|
-
} catch {
|
|
16208
|
-
return false;
|
|
16209
|
-
}
|
|
16210
|
-
}
|
|
16211
|
-
var MAX_PATTERN_LENGTH = 2e3;
|
|
16212
|
-
var RegexMatcher = external_exports.object({
|
|
16213
|
-
type: external_exports.literal("regex"),
|
|
16214
|
-
pattern: external_exports.string().min(1).max(MAX_PATTERN_LENGTH),
|
|
16215
|
-
flags: external_exports.string().default("gi"),
|
|
16216
|
-
captureGroup: external_exports.number().int().nonnegative().optional()
|
|
16217
|
-
}).refine((v) => isValidRegex(v.pattern, v.flags), {
|
|
16218
|
-
message: "pattern/flags do not form a valid JavaScript regular expression",
|
|
16219
|
-
path: ["pattern"]
|
|
16220
|
-
}).refine((v) => v.captureGroup !== void 0 || !matchesEmptyString(v.pattern, v.flags), {
|
|
16221
|
-
message: 'a whole-match regex that can match the empty string (e.g. "\\d*", "a?", "(?:)") can hang the matcher \u2014 scope the quantifier to a captureGroup, or require at least one character',
|
|
16222
|
-
path: ["pattern"]
|
|
16223
|
-
});
|
|
16224
|
-
var ValidatorMatcher = external_exports.object({
|
|
16225
|
-
type: external_exports.literal("validator"),
|
|
16226
|
-
name: external_exports.enum(["luhn", "entropy", "ssn-checksum"]),
|
|
16227
|
-
config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
16228
|
-
});
|
|
16229
|
-
var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, RegexMatcher, ValidatorMatcher]).meta({ id: "Matcher" });
|
|
16230
|
-
var AppliesTo = external_exports.object({
|
|
16231
|
-
// Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
|
|
16232
|
-
extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1)
|
|
16233
|
-
}).meta({ id: "AppliesTo" });
|
|
16234
|
-
var PostValidatorRef = external_exports.union([
|
|
16235
|
-
external_exports.string(),
|
|
16236
|
-
external_exports.object({
|
|
16237
|
-
name: external_exports.string(),
|
|
16238
|
-
config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
16239
|
-
})
|
|
16240
|
-
]).meta({ id: "PostValidatorRef" });
|
|
16241
|
-
var RequiresNearby = external_exports.object({
|
|
16242
|
-
// Each array, when present, must be non-empty and contain non-empty strings —
|
|
16243
|
-
// an empty/blank criterion would either never fire or (for labels) match
|
|
16244
|
-
// everything.
|
|
16245
|
-
categories: external_exports.array(DetectionCategory).min(1).optional(),
|
|
16246
|
-
ruleIds: external_exports.array(external_exports.string().min(1)).min(1).optional(),
|
|
16247
|
-
labels: external_exports.array(external_exports.string().min(1)).min(1).optional(),
|
|
16248
|
-
windowChars: external_exports.number().int().positive().default(160),
|
|
16249
|
-
// Optional confidence bump applied when a gated match is corroborated. Capped
|
|
16250
|
-
// small: it nudges confidence, it does not assert certainty.
|
|
16251
|
-
confidenceBoost: external_exports.number().min(0).max(0.3).optional()
|
|
16252
|
-
}).refine(
|
|
16253
|
-
(v) => (v.categories?.length ?? 0) + (v.ruleIds?.length ?? 0) + (v.labels?.length ?? 0) > 0,
|
|
16254
|
-
{ message: "requiresNearby needs at least one of categories, ruleIds, or labels" }
|
|
16255
|
-
).meta({ id: "RequiresNearby" });
|
|
16256
|
-
var RuleFixture = external_exports.object({
|
|
16257
|
-
label: external_exports.string(),
|
|
16258
|
-
text: external_exports.string().max(5e4),
|
|
16259
|
-
shouldMatch: external_exports.boolean(),
|
|
16260
|
-
// Simulated file context for the scan, so fixtures can assert `appliesTo`
|
|
16261
|
-
// gating (e.g. a Python-only pattern must NOT fire in a .ts file).
|
|
16262
|
-
filePath: external_exports.string().optional(),
|
|
16263
|
-
expectedSpans: external_exports.array(external_exports.object({ start: external_exports.number(), end: external_exports.number() })).optional()
|
|
16264
|
-
}).meta({ id: "RuleFixture" });
|
|
16265
|
-
var Rule = external_exports.object({
|
|
16266
|
-
specVersion: external_exports.literal(1),
|
|
16267
|
-
// `packId/ruleName` (e.g. `secrets/aws-access-key`). NOTE the first segment is
|
|
16268
|
-
// the PACK id, NOT a namespace — this is a DIFFERENT slug space from a
|
|
16269
|
-
// detection id (`namespace/packId`, decoded by splitDetectionId). A Rule.id
|
|
16270
|
-
// therefore carries no namespace and is not globally unique across publishers;
|
|
16271
|
-
// never feed one to splitDetectionId. `category` below (per-rule) is the
|
|
16272
|
-
// taxonomy axis; the pack's enforcement policy is installed_packs.policy_id.
|
|
16273
|
-
id: external_exports.string().regex(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/),
|
|
16274
|
-
name: external_exports.string(),
|
|
16275
|
-
category: DetectionCategory,
|
|
16276
|
-
severity: Severity,
|
|
16277
|
-
matcher: Matcher,
|
|
16278
|
-
appliesTo: AppliesTo.optional(),
|
|
16279
|
-
postValidators: external_exports.array(PostValidatorRef).optional(),
|
|
16280
|
-
requiresNearby: RequiresNearby.optional(),
|
|
16281
|
-
examples: external_exports.array(external_exports.string()).optional()
|
|
16282
|
-
}).meta({ id: "Rule" });
|
|
16283
|
-
var Author = external_exports.object({
|
|
16284
|
-
name: external_exports.string(),
|
|
16285
|
-
email: external_exports.email().optional(),
|
|
16286
|
-
url: external_exports.url().optional()
|
|
16287
|
-
}).meta({ id: "Author" });
|
|
16288
|
-
var PackManifest = external_exports.object({
|
|
16289
|
-
specVersion: external_exports.literal(1),
|
|
16290
|
-
id: external_exports.string(),
|
|
16291
|
-
name: external_exports.string(),
|
|
16292
|
-
version: external_exports.string(),
|
|
16293
|
-
rules: external_exports.array(external_exports.string()),
|
|
16294
|
-
// Optional attribution/provenance — consumed by the rule marketplace.
|
|
16295
|
-
description: external_exports.string().optional(),
|
|
16296
|
-
author: Author.optional(),
|
|
16297
|
-
license: external_exports.string().optional(),
|
|
16298
|
-
sourceUrl: external_exports.url().optional()
|
|
16299
|
-
}).meta({ id: "PackManifest" });
|
|
16300
|
-
|
|
16301
|
-
// ../../packages/schema/src/zod/policy.ts
|
|
16302
|
-
var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
|
|
16303
|
-
var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
|
|
16304
|
-
var Policy = external_exports.object({
|
|
16305
|
-
id: external_exports.guid(),
|
|
16306
|
-
scope: PolicyScope,
|
|
16307
|
-
target: PolicyTarget,
|
|
16308
|
-
action: ActionTaken,
|
|
16309
|
-
enabled: external_exports.boolean().default(true),
|
|
16310
|
-
customKeywords: external_exports.array(external_exports.string()).optional(),
|
|
16311
|
-
// Display name — optional so older policy rows without name still parse.
|
|
16312
|
-
// Added for the findings API (policy.name column migration).
|
|
16313
|
-
name: external_exports.string().optional()
|
|
16314
|
-
}).meta({ id: "Policy" });
|
|
16315
|
-
var PolicyBundle = external_exports.object({
|
|
16316
|
-
version: external_exports.string(),
|
|
16317
|
-
policies: external_exports.array(Policy),
|
|
16318
|
-
// Rules from the installed marketplace packs (snapshotted by the
|
|
16319
|
-
// control plane). The plugin registers these in addition to its bundled
|
|
16320
|
-
// packs. Optional so older backends — and older on-disk caches — that omit
|
|
16321
|
-
// the field still parse; consumers read `bundle.rules ?? []`.
|
|
16322
|
-
rules: external_exports.array(Rule).optional(),
|
|
16323
|
-
// When true, `rules` IS the complete effective ruleset and the runtime must
|
|
16324
|
-
// NOT merge its compiled-in bundled packs — the standalone gateway sets this
|
|
16325
|
-
// after reading the user's installed snapshot (installed_packs, enabled
|
|
16326
|
-
// packs only), which is how detection updates stay manual: new bundled
|
|
16327
|
-
// rules run only after the user applies the pack update. Absent/false keeps
|
|
16328
|
-
// the historical composition (bundled packs + rules) — older caches.
|
|
16329
|
-
rulesComplete: external_exports.boolean().optional(),
|
|
16330
|
-
// Active detection exceptions, evaluation subset only (see
|
|
16331
|
-
// ExceptionBundleEntry). Optional so older bundle producers — and older
|
|
16332
|
-
// on-disk caches — that omit the field still parse; consumers read
|
|
16333
|
-
// `bundle.exceptions ?? []`.
|
|
16334
|
-
exceptions: external_exports.array(ExceptionBundleEntry).optional(),
|
|
16335
|
-
// Installed pack version, keyed by ruleId, for rules in `rules` that came
|
|
16336
|
-
// from a versioned installed pack. Optional so older backends — and older
|
|
16337
|
-
// on-disk caches — that omit the field still parse; consumers fall back to
|
|
16338
|
-
// the rule's own spec version. NOT the bundle version above — see
|
|
16339
|
-
// installedRuleset's ruleVersions for the source of truth.
|
|
16340
|
-
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
16341
|
-
customKeywords: external_exports.array(external_exports.string()),
|
|
16342
|
-
fetchedAt: external_exports.iso.datetime()
|
|
16343
|
-
}).meta({ id: "PolicyBundle" });
|
|
16344
|
-
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
16345
|
-
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
16346
|
-
var CATEGORY_PEAK_SEVERITY = {
|
|
16347
|
-
secret: "critical",
|
|
16348
|
-
financial: "critical",
|
|
16349
|
-
// core-financial/credit-card
|
|
16350
|
-
code_flaw: "critical",
|
|
16351
|
-
pii: "high",
|
|
16352
|
-
phi: "high",
|
|
16353
|
-
custom: "high",
|
|
16354
|
-
// user-defined; conservative
|
|
16355
|
-
code_context: "low",
|
|
16356
|
-
config: "low"
|
|
16357
|
-
// observe-only; floors to monitor regardless
|
|
16358
|
-
};
|
|
16359
|
-
function severityFloorPolicy(category) {
|
|
16360
|
-
if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
|
|
16361
|
-
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
16362
|
-
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
16363
|
-
}
|
|
16364
|
-
var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
|
|
16365
|
-
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "block"];
|
|
16366
|
-
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
16367
|
-
var BUILTIN_POLICY_SPECS = {
|
|
16368
|
-
monitor: {
|
|
16369
|
-
name: "Monitor",
|
|
16370
|
-
action: "log",
|
|
16371
|
-
description: "Log every match for audit. The request is allowed through untouched."
|
|
16372
|
-
},
|
|
16373
|
-
warn: {
|
|
16374
|
-
name: "Warn",
|
|
16375
|
-
action: "warn",
|
|
16376
|
-
description: "Allow the request, but warn the user inline before it is sent."
|
|
16377
|
-
},
|
|
16378
|
-
redact: {
|
|
16379
|
-
name: "Redact",
|
|
16380
|
-
action: "redact",
|
|
16381
|
-
description: "Automatically strip the matched value from the request, then continue."
|
|
16382
|
-
},
|
|
16383
|
-
block: {
|
|
16384
|
-
name: "Block",
|
|
16385
|
-
action: "block",
|
|
16386
|
-
description: "Refuse the request entirely whenever any rule in this detection matches."
|
|
16387
|
-
}
|
|
16388
|
-
};
|
|
16389
|
-
function builtinPolicyToAction(id) {
|
|
16390
|
-
return BUILTIN_POLICY_SPECS[id].action;
|
|
16391
|
-
}
|
|
16392
|
-
var DEFAULT_ACTIONS = Object.fromEntries(
|
|
16393
|
-
DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
|
|
16394
|
-
);
|
|
16395
|
-
var BUILTIN_POLICIES = Object.fromEntries(
|
|
16396
|
-
KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
|
|
16397
|
-
);
|
|
16398
|
-
var UsedByItem = external_exports.object({
|
|
16399
|
-
id: external_exports.string(),
|
|
16400
|
-
name: external_exports.string(),
|
|
16401
|
-
ruleCount: external_exports.number().int().nonnegative(),
|
|
16402
|
-
enabled: external_exports.boolean()
|
|
16403
|
-
}).meta({ id: "UsedByItem" });
|
|
16404
|
-
var PolicyListItem = external_exports.object({
|
|
16405
|
-
id: external_exports.string(),
|
|
16406
|
-
kind: PolicyKind,
|
|
16407
|
-
name: external_exports.string(),
|
|
16408
|
-
enabled: external_exports.boolean(),
|
|
16409
|
-
usedByCount: external_exports.number().int().nonnegative()
|
|
16410
|
-
}).meta({ id: "PolicyListItem" });
|
|
16411
|
-
var PolicyDetail = external_exports.object({
|
|
16412
|
-
specVersion: external_exports.literal(1),
|
|
16413
|
-
id: external_exports.string(),
|
|
16414
|
-
kind: PolicyKind,
|
|
16415
|
-
name: external_exports.string(),
|
|
16416
|
-
enabled: external_exports.boolean(),
|
|
16417
|
-
description: external_exports.string(),
|
|
16418
|
-
usedBy: external_exports.array(UsedByItem)
|
|
16419
|
-
}).meta({ id: "PolicyDetail" });
|
|
16420
|
-
var PolicyStatsResponse = external_exports.object({
|
|
16421
|
-
policies: external_exports.number().int().nonnegative(),
|
|
16422
|
-
builtin: external_exports.number().int().nonnegative(),
|
|
16423
|
-
custom: external_exports.number().int().nonnegative(),
|
|
16424
|
-
detectionsGoverned: external_exports.number().int().nonnegative()
|
|
16425
|
-
}).meta({ id: "PolicyStatsResponse" });
|
|
16426
|
-
|
|
16427
|
-
// ../../packages/schema/src/zod/api.ts
|
|
16428
|
-
var LIST_QUERY_MAX_LIMIT = 200;
|
|
16429
|
-
var ListEventsQuery = external_exports.object({
|
|
16430
|
-
cursor: external_exports.string().optional(),
|
|
16431
|
-
limit: external_exports.coerce.number().int().min(1).max(LIST_QUERY_MAX_LIMIT).default(50),
|
|
16432
|
-
sourceTool: external_exports.string().optional(),
|
|
16433
|
-
kind: external_exports.string().optional(),
|
|
16434
|
-
from: external_exports.iso.datetime().optional(),
|
|
16435
|
-
to: external_exports.iso.datetime().optional()
|
|
16436
|
-
});
|
|
16437
|
-
var ListEventsResponse = external_exports.object({
|
|
16438
|
-
items: external_exports.array(Event),
|
|
16439
|
-
nextCursor: external_exports.string().nullable()
|
|
16440
|
-
}).meta({ id: "ListEventsResponse" });
|
|
16441
|
-
var IngestResponse = external_exports.object({
|
|
16442
|
-
accepted: external_exports.number().int().nonnegative(),
|
|
16443
|
-
duplicates: external_exports.number().int().nonnegative()
|
|
16444
|
-
}).meta({ id: "IngestResponse" });
|
|
16445
|
-
var ListFindingsQuery = external_exports.object({
|
|
16446
|
-
cursor: external_exports.string().optional(),
|
|
16447
|
-
limit: external_exports.coerce.number().int().min(1).max(LIST_QUERY_MAX_LIMIT).default(50),
|
|
16448
|
-
severity: external_exports.string().optional(),
|
|
16449
|
-
category: external_exports.string().optional(),
|
|
16450
|
-
eventId: external_exports.guid().optional()
|
|
16451
|
-
});
|
|
16452
|
-
var ListFindingsResponse = external_exports.object({
|
|
16453
|
-
items: external_exports.array(Finding),
|
|
16454
|
-
nextCursor: external_exports.string().nullable()
|
|
16455
|
-
}).meta({ id: "ListFindingsResponse" });
|
|
16456
|
-
var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
|
|
16457
|
-
var CreatePolicyRequest = Policy.omit({ id: true }).meta({
|
|
16458
|
-
id: "CreatePolicyRequest"
|
|
16459
|
-
});
|
|
16460
|
-
var UpdatePolicyRequest = Policy.partial().required({ id: true }).meta({ id: "UpdatePolicyRequest" });
|
|
16461
|
-
var RecordAuditEventResponse = external_exports.object({ accepted: external_exports.boolean() }).meta({ id: "RecordAuditEventResponse" });
|
|
16462
|
-
var ErrorResponse = external_exports.object({
|
|
16463
|
-
error: external_exports.object({
|
|
16464
|
-
code: external_exports.string(),
|
|
16465
|
-
message: external_exports.string(),
|
|
16466
|
-
details: external_exports.unknown().optional()
|
|
16467
|
-
})
|
|
16468
|
-
}).meta({ id: "ErrorResponse" });
|
|
16469
|
-
|
|
16470
|
-
// ../../packages/schema/src/zod/config-inventory.ts
|
|
16471
|
-
var ConfigScope = external_exports.enum(["user", "project", "local", "plugin"]);
|
|
16472
|
-
var SkillScanEntry = external_exports.object({
|
|
16473
|
-
name: external_exports.string().min(1),
|
|
16474
|
-
// The identity source: a marketplace repo for plugin skills (e.g.
|
|
16475
|
-
// 'anthropics/skills'), 'local' for personal ~/.claude/skills, or
|
|
16476
|
-
// 'project:<repo-identity>' for checked-in project skills. The surrogate keeps
|
|
16477
|
-
// a personal skill named 'pdf' from colliding with the marketplace 'pdf'.
|
|
16478
|
-
source: external_exports.string().min(1),
|
|
16479
|
-
scope: ConfigScope,
|
|
16480
|
-
pluginName: external_exports.string().optional(),
|
|
16481
|
-
// Volatile — rides the attribute bag, never the identity hash.
|
|
16482
|
-
version: external_exports.string().optional(),
|
|
16483
|
-
description: external_exports.string().optional(),
|
|
16484
|
-
// Skill directory mtime (ISO) — the "updated Nd ago" freshness signal.
|
|
16485
|
-
updatedAt: external_exports.iso.datetime().optional(),
|
|
16486
|
-
// Filesystem path — the promoted inventory `location` column.
|
|
16487
|
-
location: external_exports.string().optional()
|
|
16488
|
-
});
|
|
16489
|
-
var HookScanEntry = external_exports.object({
|
|
16490
|
-
// Hook event name (PreToolUse, PostToolUse, …). Open string, not an enum: the
|
|
16491
|
-
// set is harness-defined and grows without a schema change.
|
|
16492
|
-
event: external_exports.string().min(1),
|
|
16493
|
-
// The tool matcher ('Bash', 'Edit|Write', …). Absent = matches all tools.
|
|
16494
|
-
matcher: external_exports.string().optional(),
|
|
16495
|
-
command: external_exports.string().min(1),
|
|
16496
|
-
timeout: external_exports.number().optional(),
|
|
16497
|
-
scope: ConfigScope,
|
|
16498
|
-
pluginName: external_exports.string().optional(),
|
|
16499
|
-
// The settings file / hooks.json the entry came from.
|
|
16500
|
-
location: external_exports.string().optional()
|
|
16501
|
-
});
|
|
16502
|
-
var McpServerScanEntry = external_exports.object({
|
|
16503
|
-
// The server's config key ("github", "filesystem", …) — identity, with the
|
|
16504
|
-
// qualified scope (see mcpServerIdentityKey).
|
|
16505
|
-
name: external_exports.string().min(1),
|
|
16506
|
-
scope: ConfigScope,
|
|
16507
|
-
pluginName: external_exports.string().optional(),
|
|
16508
|
-
// The owning plugin's marketplace — part of PLUGIN-scope identity: two
|
|
16509
|
-
// marketplaces can each ship a plugin named `guard`, and without this their
|
|
16510
|
-
// same-named servers would collapse to one row (the second silently dropped,
|
|
16511
|
-
// inheriting the first's trust).
|
|
16512
|
-
marketplace: external_exports.string().optional(),
|
|
16513
|
-
// The repo identity (remote url, or the cwd for un-remoted repos) — part of
|
|
16514
|
-
// PROJECT/LOCAL-scope identity: a server named `github` in repo A and one in
|
|
16515
|
-
// repo B are different servers with different commands, and MUST NOT share a
|
|
16516
|
-
// row — a shared row would let a cloned repo's .mcp.json inherit the trust
|
|
16517
|
-
// the user granted elsewhere.
|
|
16518
|
-
project: external_exports.string().optional(),
|
|
16519
|
-
// 'stdio' when the entry carries a command; otherwise the config's `type`
|
|
16520
|
-
// ('http' / 'sse' / …). Open string — the transport set is harness-defined.
|
|
16521
|
-
transport: external_exports.string().min(1),
|
|
16522
|
-
// Volatile on purpose (unlike hook `command`): a changed command/url is drift
|
|
16523
|
-
// on a stable row — visible across config_scan snapshots and preserving the
|
|
16524
|
-
// user's trust decision — never a quiet new row. One of the two is present.
|
|
16525
|
-
// Secret-masked at collection time (the scanner runs the bundled detection
|
|
16526
|
-
// packs over both — tokens routinely ride command args and URLs).
|
|
16527
|
-
command: external_exports.string().optional(),
|
|
16528
|
-
url: external_exports.string().optional(),
|
|
16529
|
-
// Env var NAMES only, never values (the no-secrets rule).
|
|
16530
|
-
envKeys: external_exports.array(external_exports.string()).optional(),
|
|
16531
|
-
// The config file the entry came from.
|
|
16532
|
-
location: external_exports.string().optional()
|
|
16533
|
-
});
|
|
16534
|
-
var ConfigFileScanEntry = external_exports.object({
|
|
16535
|
-
// Basename (settings.json, CLAUDE.md) or dir name (commands/, agents/).
|
|
16536
|
-
name: external_exports.string().min(1),
|
|
16537
|
-
// The absolute path — identity (with scope) and the promoted `location`.
|
|
16538
|
-
path: external_exports.string().min(1),
|
|
16539
|
-
scope: ConfigScope,
|
|
16540
|
-
// Human label: "User settings", "Project memory", "Slash commands", …
|
|
16541
|
-
kind: external_exports.string().min(1),
|
|
16542
|
-
// Derived SHAPE summary — top-level key names, entry counts, line counts.
|
|
16543
|
-
// Never file content or values (memory files can carry sensitive detail).
|
|
16544
|
-
detail: external_exports.string().optional(),
|
|
16545
|
-
// Dir configs (commands/, agents/) and .mcp.json: how many entries.
|
|
16546
|
-
entryCount: external_exports.number().optional(),
|
|
16547
|
-
// File mtime (ISO) — the freshness signal.
|
|
16548
|
-
updatedAt: external_exports.iso.datetime().optional()
|
|
16549
|
-
});
|
|
16550
|
-
var ConfigScanResult = external_exports.object({
|
|
16551
|
-
scannedAt: external_exports.iso.datetime(),
|
|
16552
|
-
skills: external_exports.array(SkillScanEntry),
|
|
16553
|
-
hooks: external_exports.array(HookScanEntry),
|
|
16554
|
-
mcpServers: external_exports.array(McpServerScanEntry),
|
|
16555
|
-
configFiles: external_exports.array(ConfigFileScanEntry),
|
|
16556
|
-
errors: external_exports.array(external_exports.object({ source: external_exports.string(), reason: external_exports.string() }))
|
|
16557
|
-
});
|
|
16558
|
-
var ConfigPostureFindingInput = external_exports.object({
|
|
16559
|
-
ruleId: external_exports.string().min(1),
|
|
16560
|
-
version: external_exports.string().min(1),
|
|
16561
|
-
span: Span,
|
|
16562
|
-
// For posture rules this is the offending COMMAND (config the user already
|
|
16563
|
-
// holds locally, not captured secret content) — it is also the correlation
|
|
16564
|
-
// key the read surface matches back to a hook row.
|
|
16565
|
-
maskedMatch: external_exports.string(),
|
|
16566
|
-
actionTaken: ActionTaken,
|
|
16567
|
-
confidence: external_exports.number().min(0).max(1)
|
|
16568
|
-
});
|
|
16569
|
-
var ConfigScanRecord = external_exports.object({
|
|
16570
|
-
items: external_exports.array(InventoryInput),
|
|
16571
|
-
scanEvent: AuditEventInput,
|
|
16572
|
-
definitions: external_exports.array(InspectionDefinitionInput).optional(),
|
|
16573
|
-
findings: external_exports.array(ConfigPostureFindingInput).optional()
|
|
16095
|
+
keywords: external_exports.array(external_exports.string().min(1)).min(1),
|
|
16096
|
+
caseSensitive: external_exports.boolean().default(false)
|
|
16574
16097
|
});
|
|
16575
|
-
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16098
|
+
function isValidRegex(pattern, flags) {
|
|
16099
|
+
try {
|
|
16100
|
+
new RegExp(pattern, flags);
|
|
16101
|
+
return true;
|
|
16102
|
+
} catch {
|
|
16103
|
+
return false;
|
|
16104
|
+
}
|
|
16105
|
+
}
|
|
16106
|
+
function probeFlags(flags) {
|
|
16107
|
+
return flags.replace(/[gy]/g, "");
|
|
16108
|
+
}
|
|
16109
|
+
function matchesEmptyString(pattern, flags) {
|
|
16110
|
+
try {
|
|
16111
|
+
const re = new RegExp(pattern, probeFlags(flags));
|
|
16112
|
+
return re.exec("")?.[0].length === 0;
|
|
16113
|
+
} catch {
|
|
16114
|
+
return false;
|
|
16115
|
+
}
|
|
16116
|
+
}
|
|
16117
|
+
function spansWholeMatch(captureGroup) {
|
|
16118
|
+
return captureGroup === void 0 || captureGroup === 0;
|
|
16119
|
+
}
|
|
16120
|
+
function captureGroupCount(pattern, flags) {
|
|
16121
|
+
try {
|
|
16122
|
+
const probe = new RegExp(`${pattern}|`, probeFlags(flags));
|
|
16123
|
+
const result = probe.exec("");
|
|
16124
|
+
return result ? result.length - 1 : void 0;
|
|
16125
|
+
} catch {
|
|
16126
|
+
return void 0;
|
|
16127
|
+
}
|
|
16128
|
+
}
|
|
16129
|
+
var MAX_PATTERN_LENGTH = 2e3;
|
|
16130
|
+
var RegexMatcher = external_exports.strictObject({
|
|
16131
|
+
type: external_exports.literal("regex"),
|
|
16132
|
+
pattern: external_exports.string().min(1).max(MAX_PATTERN_LENGTH),
|
|
16133
|
+
flags: external_exports.string().default("gi"),
|
|
16134
|
+
captureGroup: external_exports.number().int().nonnegative().optional()
|
|
16135
|
+
}).refine((v) => isValidRegex(v.pattern, v.flags), {
|
|
16136
|
+
message: "pattern/flags do not form a valid JavaScript regular expression",
|
|
16137
|
+
path: ["pattern"]
|
|
16138
|
+
}).refine((v) => !spansWholeMatch(v.captureGroup) || !matchesEmptyString(v.pattern, v.flags), {
|
|
16139
|
+
message: 'a whole-match regex that can match the empty string (e.g. "\\d*", "a?", "(?:)") can hang the matcher \u2014 scope the quantifier to a captureGroup, or require at least one character',
|
|
16140
|
+
path: ["pattern"]
|
|
16141
|
+
}).superRefine((v, ctx) => {
|
|
16142
|
+
if (v.captureGroup === void 0) return;
|
|
16143
|
+
const groups = captureGroupCount(v.pattern, v.flags);
|
|
16144
|
+
if (groups === void 0 || v.captureGroup <= groups) return;
|
|
16145
|
+
ctx.addIssue({
|
|
16146
|
+
code: "custom",
|
|
16147
|
+
path: ["captureGroup"],
|
|
16148
|
+
message: `captureGroup ${String(v.captureGroup)} is out of range \u2014 the pattern declares ${String(groups)} capture group(s), so valid values are 0-${String(groups)}. An out-of-range group never matches, which would make the rule silently never fire.`
|
|
16149
|
+
});
|
|
16150
|
+
});
|
|
16151
|
+
var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, RegexMatcher]).meta({ id: "Matcher" });
|
|
16152
|
+
var MATCHER_TYPES = MatcherType.options;
|
|
16153
|
+
var AppliesTo = external_exports.strictObject({
|
|
16154
|
+
// Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
|
|
16155
|
+
extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1)
|
|
16156
|
+
}).meta({ id: "AppliesTo" });
|
|
16157
|
+
var PostValidatorName = external_exports.enum(["entropy", "luhn"]).meta({ id: "PostValidatorName" });
|
|
16158
|
+
var PostValidatorRef = external_exports.union(
|
|
16159
|
+
[
|
|
16160
|
+
PostValidatorName,
|
|
16161
|
+
external_exports.strictObject({
|
|
16162
|
+
name: PostValidatorName,
|
|
16163
|
+
config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
16164
|
+
})
|
|
16165
|
+
],
|
|
16166
|
+
{
|
|
16167
|
+
// A union reports one collapsed issue for every way its arms can fail, so
|
|
16168
|
+
// this has to describe the whole shape rather than just the name — it is
|
|
16169
|
+
// what an author sees for a misspelled name AND for a stray key in the
|
|
16170
|
+
// object form. The names come from the enum so the message cannot go
|
|
16171
|
+
// stale. Without it Zod says only "Invalid input", which is precisely the
|
|
16172
|
+
// no-feedback outcome this schema exists to remove.
|
|
16173
|
+
error: () => `not a valid post-validator: use a bare name (${PostValidatorName.options.map((name) => JSON.stringify(name)).join(
|
|
16174
|
+
" or "
|
|
16175
|
+
)}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`
|
|
16176
|
+
}
|
|
16177
|
+
).meta({ id: "PostValidatorRef" });
|
|
16178
|
+
var RequiresNearby = external_exports.strictObject({
|
|
16179
|
+
// Each array, when present, must be non-empty and contain non-empty strings —
|
|
16180
|
+
// an empty/blank criterion would either never fire or (for labels) match
|
|
16181
|
+
// everything.
|
|
16182
|
+
categories: external_exports.array(DetectionCategory).min(1).optional(),
|
|
16183
|
+
ruleIds: external_exports.array(external_exports.string().min(1)).min(1).optional(),
|
|
16184
|
+
labels: external_exports.array(external_exports.string().min(1)).min(1).optional(),
|
|
16185
|
+
windowChars: external_exports.number().int().positive().default(160),
|
|
16186
|
+
// Optional confidence bump applied when a gated match is corroborated. Capped
|
|
16187
|
+
// small: it nudges confidence, it does not assert certainty.
|
|
16188
|
+
confidenceBoost: external_exports.number().min(0).max(0.3).optional()
|
|
16189
|
+
}).refine(
|
|
16190
|
+
(v) => (v.categories?.length ?? 0) + (v.ruleIds?.length ?? 0) + (v.labels?.length ?? 0) > 0,
|
|
16191
|
+
{ message: "requiresNearby needs at least one of categories, ruleIds, or labels" }
|
|
16192
|
+
).meta({ id: "RequiresNearby" });
|
|
16193
|
+
var RuleFixture = external_exports.strictObject({
|
|
16194
|
+
label: external_exports.string(),
|
|
16195
|
+
text: external_exports.string().max(5e4),
|
|
16196
|
+
shouldMatch: external_exports.boolean(),
|
|
16197
|
+
// Simulated file context for the scan, so fixtures can assert `appliesTo`
|
|
16198
|
+
// gating (e.g. a Python-only pattern must NOT fire in a .ts file).
|
|
16199
|
+
filePath: external_exports.string().optional(),
|
|
16200
|
+
expectedSpans: external_exports.array(external_exports.strictObject({ start: external_exports.number(), end: external_exports.number() })).optional()
|
|
16201
|
+
}).meta({ id: "RuleFixture" });
|
|
16202
|
+
var Rule = external_exports.strictObject({
|
|
16203
|
+
// A pinned literal over a STRICT object, and the two together decide how this
|
|
16204
|
+
// format may grow. A rule carrying a key not listed below is refused with
|
|
16205
|
+
// `unrecognized_keys`; a rule declaring `specVersion: 2` is refused with
|
|
16206
|
+
// `invalid_value`. So the only additive path is adding an OPTIONAL field here
|
|
16207
|
+
// — that keeps every rule authored before it valid — and a rule author has no
|
|
16208
|
+
// way to introduce a field of their own or to opt into a later version.
|
|
16209
|
+
// Widening the format means changing this literal and every consumer of it.
|
|
16210
|
+
specVersion: external_exports.literal(1),
|
|
16211
|
+
// `packId/ruleName` (e.g. `secrets/aws-access-key`). NOTE the first segment is
|
|
16212
|
+
// the PACK id, NOT a namespace — this is a DIFFERENT slug space from a
|
|
16213
|
+
// detection id (`namespace/packId`, decoded by splitDetectionId). A Rule.id
|
|
16214
|
+
// therefore carries no namespace and is not globally unique across publishers;
|
|
16215
|
+
// never feed one to splitDetectionId. `category` below (per-rule) is the
|
|
16216
|
+
// taxonomy axis; the pack's enforcement policy is installed_packs.policy_id.
|
|
16217
|
+
id: external_exports.string().regex(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/),
|
|
16218
|
+
name: external_exports.string(),
|
|
16219
|
+
category: DetectionCategory,
|
|
16220
|
+
severity: Severity,
|
|
16221
|
+
matcher: Matcher,
|
|
16222
|
+
appliesTo: AppliesTo.optional(),
|
|
16223
|
+
postValidators: external_exports.array(PostValidatorRef).optional(),
|
|
16224
|
+
requiresNearby: RequiresNearby.optional(),
|
|
16225
|
+
examples: external_exports.array(external_exports.string()).optional()
|
|
16226
|
+
}).meta({ id: "Rule" });
|
|
16227
|
+
var Author = external_exports.object({
|
|
16228
|
+
name: external_exports.string(),
|
|
16229
|
+
email: external_exports.email().optional(),
|
|
16230
|
+
url: external_exports.url().optional()
|
|
16231
|
+
}).meta({ id: "Author" });
|
|
16232
|
+
var PackManifest = external_exports.object({
|
|
16233
|
+
specVersion: external_exports.literal(1),
|
|
16234
|
+
id: external_exports.string(),
|
|
16235
|
+
name: external_exports.string(),
|
|
16236
|
+
version: external_exports.string(),
|
|
16237
|
+
rules: external_exports.array(external_exports.string()),
|
|
16238
|
+
// Optional attribution/provenance — consumed by the rule marketplace.
|
|
16239
|
+
description: external_exports.string().optional(),
|
|
16240
|
+
author: Author.optional(),
|
|
16241
|
+
license: external_exports.string().optional(),
|
|
16242
|
+
sourceUrl: external_exports.url().optional()
|
|
16243
|
+
}).meta({ id: "PackManifest" });
|
|
16581
16244
|
|
|
16582
16245
|
// ../../packages/schema/src/zod/detection.ts
|
|
16583
16246
|
var OriginEnum = external_exports.enum(["library"]).meta({ id: "OriginEnum" });
|
|
@@ -16699,6 +16362,231 @@ var ImportDetectionRequest = external_exports.object({
|
|
|
16699
16362
|
})
|
|
16700
16363
|
}).meta({ id: "ImportDetectionRequest" });
|
|
16701
16364
|
|
|
16365
|
+
// ../../packages/schema/src/zod/inventory.ts
|
|
16366
|
+
var AssetType = external_exports.enum(["project", "skill", "mcp", "hook", "config"]).meta({ id: "AssetType" });
|
|
16367
|
+
var AccessLevel = external_exports.enum(["open", "approved", "blocked"]).meta({ id: "AccessLevel" });
|
|
16368
|
+
var Origin = external_exports.enum(["source", "public-dep", "vendored", "config", "data", "docs", "generated"]).meta({ id: "Origin" });
|
|
16369
|
+
var TrustLevel = external_exports.enum(["known-good", "risky", "unapproved"]).meta({ id: "TrustLevel" });
|
|
16370
|
+
var Flag = external_exports.enum(["update", "stale", "conflict", "unknown", "change", "untracked", "risk", "findings"]).meta({ id: "Flag" });
|
|
16371
|
+
var Visibility = external_exports.enum(["public", "private"]).meta({ id: "Visibility" });
|
|
16372
|
+
var HarnessEventKind = external_exports.enum(["block", "redact", "warn"]).meta({ id: "HarnessEventKind" });
|
|
16373
|
+
var HarnessId = Harness.extract(["ClaudeCode", "Cursor", "Codex", "Antigravity"]).meta({
|
|
16374
|
+
id: "HarnessId"
|
|
16375
|
+
});
|
|
16376
|
+
var AccessCounts = external_exports.object({
|
|
16377
|
+
open: external_exports.number().int().nonnegative(),
|
|
16378
|
+
approved: external_exports.number().int().nonnegative(),
|
|
16379
|
+
blocked: external_exports.number().int().nonnegative(),
|
|
16380
|
+
total: external_exports.number().int().nonnegative()
|
|
16381
|
+
}).meta({ id: "AccessCounts" });
|
|
16382
|
+
var AssetSummary = external_exports.object({
|
|
16383
|
+
id: external_exports.string(),
|
|
16384
|
+
type: AssetType,
|
|
16385
|
+
name: external_exports.string(),
|
|
16386
|
+
sub: external_exports.string(),
|
|
16387
|
+
flags: external_exports.array(Flag),
|
|
16388
|
+
/** MCP servers only — omitted for all other types. */
|
|
16389
|
+
trust: TrustLevel.optional()
|
|
16390
|
+
}).meta({ id: "AssetSummary" });
|
|
16391
|
+
var ProjectSummary = external_exports.object({
|
|
16392
|
+
id: external_exports.string(),
|
|
16393
|
+
name: external_exports.string(),
|
|
16394
|
+
repo: external_exports.string(),
|
|
16395
|
+
visibility: Visibility,
|
|
16396
|
+
language: external_exports.string(),
|
|
16397
|
+
policyDefault: AccessLevel,
|
|
16398
|
+
updatedAt: external_exports.iso.datetime(),
|
|
16399
|
+
accessCounts: AccessCounts,
|
|
16400
|
+
findingsCount: external_exports.number().int().nonnegative()
|
|
16401
|
+
}).meta({ id: "ProjectSummary" });
|
|
16402
|
+
var HarnessCategory = external_exports.object({
|
|
16403
|
+
/** One of config/skill/mcp/hook — never project (enforced at service layer). */
|
|
16404
|
+
type: AssetType,
|
|
16405
|
+
assets: external_exports.array(AssetSummary)
|
|
16406
|
+
});
|
|
16407
|
+
var HarnessSummary = external_exports.object({
|
|
16408
|
+
id: HarnessId,
|
|
16409
|
+
label: external_exports.string(),
|
|
16410
|
+
kind: external_exports.string(),
|
|
16411
|
+
version: external_exports.string(),
|
|
16412
|
+
sessions: external_exports.number().int().nonnegative(),
|
|
16413
|
+
assetCount: external_exports.number().int().nonnegative(),
|
|
16414
|
+
flagCount: external_exports.number().int().nonnegative(),
|
|
16415
|
+
projects: external_exports.array(ProjectSummary),
|
|
16416
|
+
categories: external_exports.array(HarnessCategory)
|
|
16417
|
+
}).meta({ id: "HarnessSummary" });
|
|
16418
|
+
var ListHarnessesResponse = external_exports.object({ items: external_exports.array(HarnessSummary) }).meta({ id: "ListHarnessesResponse" });
|
|
16419
|
+
var AssetGroup = external_exports.object({
|
|
16420
|
+
/** Group key — never project (enforced at service layer). */
|
|
16421
|
+
type: AssetType,
|
|
16422
|
+
total: external_exports.number().int().nonnegative(),
|
|
16423
|
+
/**
|
|
16424
|
+
* MCP group only — omitted for all other types.
|
|
16425
|
+
* Partial: only TrustLevel keys with non-zero counts are included.
|
|
16426
|
+
* Strict: unknown keys are rejected — only TrustLevel values are valid keys.
|
|
16427
|
+
*/
|
|
16428
|
+
trustRollup: external_exports.object({
|
|
16429
|
+
"known-good": external_exports.number().int().nonnegative(),
|
|
16430
|
+
risky: external_exports.number().int().nonnegative(),
|
|
16431
|
+
unapproved: external_exports.number().int().nonnegative()
|
|
16432
|
+
}).partial().strict().optional(),
|
|
16433
|
+
/**
|
|
16434
|
+
* Partial: only Flag keys with non-zero counts are included.
|
|
16435
|
+
* Strict: unknown keys are rejected — only Flag values are valid keys.
|
|
16436
|
+
*/
|
|
16437
|
+
flagRollup: external_exports.object({
|
|
16438
|
+
update: external_exports.number().int().nonnegative(),
|
|
16439
|
+
stale: external_exports.number().int().nonnegative(),
|
|
16440
|
+
conflict: external_exports.number().int().nonnegative(),
|
|
16441
|
+
unknown: external_exports.number().int().nonnegative(),
|
|
16442
|
+
change: external_exports.number().int().nonnegative(),
|
|
16443
|
+
untracked: external_exports.number().int().nonnegative(),
|
|
16444
|
+
risk: external_exports.number().int().nonnegative(),
|
|
16445
|
+
findings: external_exports.number().int().nonnegative()
|
|
16446
|
+
}).partial().strict(),
|
|
16447
|
+
items: external_exports.array(AssetSummary)
|
|
16448
|
+
}).meta({ id: "AssetGroup" });
|
|
16449
|
+
var ListAssetsResponse = external_exports.object({ groups: external_exports.array(AssetGroup) }).meta({ id: "ListAssetsResponse" });
|
|
16450
|
+
var McpTool = external_exports.object({
|
|
16451
|
+
name: external_exports.string(),
|
|
16452
|
+
signature: external_exports.string(),
|
|
16453
|
+
description: external_exports.string(),
|
|
16454
|
+
write: external_exports.boolean(),
|
|
16455
|
+
/** Non-null string when tool is dangerous / blocked; null otherwise. */
|
|
16456
|
+
risk: external_exports.string().nullable()
|
|
16457
|
+
}).meta({ id: "McpTool" });
|
|
16458
|
+
var AssetFindingRef = external_exports.object({
|
|
16459
|
+
id: external_exports.string(),
|
|
16460
|
+
title: external_exports.string(),
|
|
16461
|
+
note: external_exports.string()
|
|
16462
|
+
});
|
|
16463
|
+
var AssetDetail = AssetSummary.extend({
|
|
16464
|
+
/** string | null — null when no description is available. */
|
|
16465
|
+
description: external_exports.string().nullable(),
|
|
16466
|
+
/** trustLevel | null — null for non-MCP assets. */
|
|
16467
|
+
trust: TrustLevel.nullable(),
|
|
16468
|
+
/** Type-specific raw key/values — FE renders the grid. */
|
|
16469
|
+
meta: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
16470
|
+
/** always present — object when there is an active finding, null when absent. */
|
|
16471
|
+
finding: AssetFindingRef.nullable(),
|
|
16472
|
+
/** MCP exposed-tools list — omitted for non-mcp. */
|
|
16473
|
+
tools: external_exports.array(McpTool).optional()
|
|
16474
|
+
}).meta({ id: "AssetDetail" });
|
|
16475
|
+
var ListProjectsResponse = external_exports.object({ items: external_exports.array(ProjectSummary) }).meta({ id: "ListProjectsResponse" });
|
|
16476
|
+
var InventoryStats = external_exports.object({
|
|
16477
|
+
/** Total assets/projects with ≥1 flag or finding (drives the attention header chip). */
|
|
16478
|
+
attention: external_exports.number().int().nonnegative(),
|
|
16479
|
+
byType: external_exports.object({
|
|
16480
|
+
project: external_exports.number().int().nonnegative(),
|
|
16481
|
+
skill: external_exports.number().int().nonnegative(),
|
|
16482
|
+
mcp: external_exports.number().int().nonnegative(),
|
|
16483
|
+
hook: external_exports.number().int().nonnegative(),
|
|
16484
|
+
config: external_exports.number().int().nonnegative()
|
|
16485
|
+
}),
|
|
16486
|
+
harnesses: external_exports.number().int().nonnegative(),
|
|
16487
|
+
mcpTrust: external_exports.object({
|
|
16488
|
+
"known-good": external_exports.number().int().nonnegative(),
|
|
16489
|
+
risky: external_exports.number().int().nonnegative(),
|
|
16490
|
+
unapproved: external_exports.number().int().nonnegative()
|
|
16491
|
+
})
|
|
16492
|
+
}).meta({ id: "InventoryStats" });
|
|
16493
|
+
var FileSummary = external_exports.object({
|
|
16494
|
+
path: external_exports.string(),
|
|
16495
|
+
name: external_exports.string(),
|
|
16496
|
+
origin: Origin,
|
|
16497
|
+
/** Effective access (override applied). */
|
|
16498
|
+
access: AccessLevel,
|
|
16499
|
+
/** True when a file_access_override differs from the computed default. */
|
|
16500
|
+
isCustom: external_exports.boolean(),
|
|
16501
|
+
findings: external_exports.number().int().nonnegative(),
|
|
16502
|
+
/** When the file was auto-blocked by a detection; null when not blocked. */
|
|
16503
|
+
blockedAt: external_exports.iso.datetime().nullable().optional(),
|
|
16504
|
+
/** Why the file was blocked; null when absent. */
|
|
16505
|
+
note: external_exports.string().nullable().optional()
|
|
16506
|
+
}).meta({ id: "FileSummary" });
|
|
16507
|
+
var FolderSummary = external_exports.object({
|
|
16508
|
+
name: external_exports.string(),
|
|
16509
|
+
path: external_exports.string(),
|
|
16510
|
+
/** Rollup of effective access across all descendants. */
|
|
16511
|
+
accessCounts: AccessCounts
|
|
16512
|
+
}).meta({ id: "FolderSummary" });
|
|
16513
|
+
var ProjectTreeResponse = external_exports.object({
|
|
16514
|
+
project: external_exports.object({
|
|
16515
|
+
id: external_exports.string(),
|
|
16516
|
+
repo: external_exports.string(),
|
|
16517
|
+
visibility: Visibility
|
|
16518
|
+
}),
|
|
16519
|
+
path: external_exports.string(),
|
|
16520
|
+
/** Browse mode: one-level folders at the current path. Omitted in search mode. */
|
|
16521
|
+
folders: external_exports.array(FolderSummary).optional(),
|
|
16522
|
+
files: external_exports.array(FileSummary)
|
|
16523
|
+
}).meta({ id: "ProjectTreeResponse" });
|
|
16524
|
+
var FileDetail = FileSummary.extend({
|
|
16525
|
+
project: external_exports.object({
|
|
16526
|
+
repo: external_exports.string(),
|
|
16527
|
+
visibility: Visibility,
|
|
16528
|
+
language: external_exports.string(),
|
|
16529
|
+
policyDefault: AccessLevel,
|
|
16530
|
+
updatedAt: external_exports.iso.datetime()
|
|
16531
|
+
}),
|
|
16532
|
+
findingsRefs: external_exports.array(external_exports.object({ id: external_exports.string(), title: external_exports.string() }))
|
|
16533
|
+
}).meta({ id: "FileDetail" });
|
|
16534
|
+
var SetFileAccessBody = external_exports.object({
|
|
16535
|
+
path: external_exports.string(),
|
|
16536
|
+
access: AccessLevel
|
|
16537
|
+
}).meta({ id: "SetFileAccessBody" });
|
|
16538
|
+
var SetFileAccessResponse = external_exports.object({
|
|
16539
|
+
file: FileSummary,
|
|
16540
|
+
accessCounts: AccessCounts
|
|
16541
|
+
}).meta({ id: "SetFileAccessResponse" });
|
|
16542
|
+
var SetMcpTrustBody = external_exports.object({ trust: TrustLevel }).meta({ id: "SetMcpTrustBody" });
|
|
16543
|
+
var HarnessEventItem = external_exports.object({
|
|
16544
|
+
kind: HarnessEventKind,
|
|
16545
|
+
title: external_exports.string(),
|
|
16546
|
+
detail: external_exports.string(),
|
|
16547
|
+
occurredAt: external_exports.iso.datetime(),
|
|
16548
|
+
findingId: external_exports.string().nullable().optional()
|
|
16549
|
+
}).meta({ id: "HarnessEventItem" });
|
|
16550
|
+
var HarnessEventsResponse = external_exports.object({
|
|
16551
|
+
counts: external_exports.object({
|
|
16552
|
+
block: external_exports.number().int().nonnegative(),
|
|
16553
|
+
redact: external_exports.number().int().nonnegative(),
|
|
16554
|
+
warn: external_exports.number().int().nonnegative()
|
|
16555
|
+
}),
|
|
16556
|
+
items: external_exports.array(HarnessEventItem)
|
|
16557
|
+
}).meta({ id: "HarnessEventsResponse" });
|
|
16558
|
+
var RescanResponse = external_exports.object({
|
|
16559
|
+
jobId: external_exports.string(),
|
|
16560
|
+
startedAt: external_exports.iso.datetime()
|
|
16561
|
+
}).meta({ id: "RescanResponse" });
|
|
16562
|
+
var ConnectProjectBody = external_exports.object({ repo: external_exports.string() }).meta({ id: "ConnectProjectBody" });
|
|
16563
|
+
var ListAssetsQuery = external_exports.object({
|
|
16564
|
+
/** Filter by one or more AssetType values; absent means all types. */
|
|
16565
|
+
type: external_exports.array(AssetType).optional(),
|
|
16566
|
+
/** Free-text search term. */
|
|
16567
|
+
q: external_exports.string().optional()
|
|
16568
|
+
});
|
|
16569
|
+
var GetProjectTreeQuery = external_exports.object({
|
|
16570
|
+
/** Subtree root path; defaults to repository root when absent. */
|
|
16571
|
+
path: external_exports.string().optional(),
|
|
16572
|
+
/** Free-text filter applied to file paths. */
|
|
16573
|
+
q: external_exports.string().optional(),
|
|
16574
|
+
/**
|
|
16575
|
+
* Special listing mode. `blocked` returns every effectively-blocked, auto-blocked
|
|
16576
|
+
* file across the whole repo (folders omitted, most-recent first), ignoring
|
|
16577
|
+
* `path`/`q` — powers the project-wide "recently blocked" strip.
|
|
16578
|
+
*/
|
|
16579
|
+
filter: external_exports.enum(["blocked"]).optional()
|
|
16580
|
+
});
|
|
16581
|
+
var GetProjectFileQuery = external_exports.object({
|
|
16582
|
+
/** Repository-relative file path; absent or empty → 400. */
|
|
16583
|
+
path: external_exports.string()
|
|
16584
|
+
});
|
|
16585
|
+
var GetHarnessEventsQuery = external_exports.object({
|
|
16586
|
+
/** Maximum number of events to return. Range: 1–50; default: 7. */
|
|
16587
|
+
limit: external_exports.coerce.number().int().min(1).max(50).default(7)
|
|
16588
|
+
});
|
|
16589
|
+
|
|
16702
16590
|
// ../../packages/schema/src/zod/shares.ts
|
|
16703
16591
|
var DestinationKind = external_exports.enum(["provider", "internal", "external", "ip"]).meta({ id: "DestinationKind" });
|
|
16704
16592
|
var Transport = external_exports.enum(["https", "http", "sftp", "grpc", "smtp", "ws", "wss"]).meta({ id: "Transport" });
|
|
@@ -16838,72 +16726,193 @@ var ExportSharesQuery = external_exports.object({
|
|
|
16838
16726
|
q: external_exports.string().optional(),
|
|
16839
16727
|
kind: external_exports.array(DestinationKind).optional()
|
|
16840
16728
|
});
|
|
16841
|
-
|
|
16842
|
-
// ../../packages/schema/src/zod/egress-extraction.ts
|
|
16843
|
-
var EgressEcosystem = external_exports.enum(["npm", "pypi", "go", "maven", "rubygems", "cargo", "composer", "nuget"]).meta({ id: "EgressEcosystem" });
|
|
16844
|
-
var ProviderRegistryEntry = external_exports.object({
|
|
16845
|
-
id: external_exports.string(),
|
|
16846
|
-
name: external_exports.string(),
|
|
16847
|
-
category: external_exports.string(),
|
|
16848
|
-
/** Suffix-matched: 'stripe.com' matches api.stripe.com, never evilstripe.com. */
|
|
16849
|
-
hostSuffixes: external_exports.array(external_exports.string()).min(1),
|
|
16850
|
-
/** Canonical API base URL recorded for manifest-derived (method 'SDK') endpoints. */
|
|
16851
|
-
apiBase: external_exports.string(),
|
|
16852
|
-
/** Most-sensitive first; index 0 becomes the endpoint dataClass. */
|
|
16853
|
-
defaultDataClasses: external_exports.array(DataClass).min(1),
|
|
16854
|
-
/** SDK identifiers per ecosystem ('go' prefix-matched by path, 'maven' by group-id prefix). */
|
|
16855
|
-
sdks: external_exports.partialRecord(EgressEcosystem, external_exports.array(external_exports.string()))
|
|
16856
|
-
}).meta({ id: "ProviderRegistryEntry" });
|
|
16857
|
-
var EgressCallSiteHit = external_exports.object({
|
|
16858
|
-
file: external_exports.string(),
|
|
16859
|
-
line: external_exports.number().int().positive(),
|
|
16860
|
-
snippet: external_exports.string(),
|
|
16861
|
-
dynamic: external_exports.boolean(),
|
|
16862
|
-
vendored: external_exports.boolean()
|
|
16863
|
-
}).meta({ id: "EgressCallSiteHit" });
|
|
16864
|
-
var ResolvedEgressHit = external_exports.object({
|
|
16865
|
-
host: external_exports.string(),
|
|
16866
|
-
kind: DestinationKind,
|
|
16867
|
-
name: external_exports.string(),
|
|
16868
|
-
category: external_exports.string(),
|
|
16869
|
-
trust: ShareTrustLevel,
|
|
16870
|
-
network: DestinationNetwork.nullable(),
|
|
16871
|
-
method: HttpMethod,
|
|
16872
|
-
transport: Transport,
|
|
16873
|
-
url: external_exports.string(),
|
|
16874
|
-
template: external_exports.boolean(),
|
|
16875
|
-
dataClass: DataClass,
|
|
16876
|
-
site: EgressCallSiteHit
|
|
16877
|
-
}).meta({ id: "ResolvedEgressHit" });
|
|
16878
|
-
var EgressReconcile = external_exports.discriminatedUnion("mode", [
|
|
16879
|
-
external_exports.object({ mode: external_exports.literal("walk"), walkedPrefix: external_exports.string() }),
|
|
16880
|
-
external_exports.object({
|
|
16881
|
-
mode: external_exports.literal("ledger"),
|
|
16882
|
-
scannedFiles: external_exports.array(external_exports.string()),
|
|
16883
|
-
deletedFiles: external_exports.array(external_exports.string())
|
|
16884
|
-
})
|
|
16885
|
-
]).meta({ id: "EgressReconcile" });
|
|
16886
|
-
var RecordProjectEgressInput = external_exports.object({
|
|
16887
|
-
/** Stable reconcile key: 'git:<repo identity>' or 'path:<abs root>' (non-git). */
|
|
16888
|
-
projectKey: external_exports.string().min(1),
|
|
16889
|
-
/** Display name only — never keys reconciliation. */
|
|
16890
|
-
project: external_exports.string(),
|
|
16891
|
-
projectId: external_exports.string().nullable(),
|
|
16892
|
-
reconcile: EgressReconcile,
|
|
16893
|
-
hits: external_exports.array(ResolvedEgressHit)
|
|
16894
|
-
}).meta({ id: "RecordProjectEgressInput" });
|
|
16895
|
-
var EgressWriteSummary = external_exports.object({
|
|
16896
|
-
destinations: external_exports.number().int().nonnegative(),
|
|
16897
|
-
endpoints: external_exports.number().int().nonnegative(),
|
|
16898
|
-
callSites: external_exports.number().int().nonnegative(),
|
|
16899
|
-
truncated: external_exports.boolean(),
|
|
16900
|
-
/**
|
|
16901
|
-
* Files the cap dropped whole. Their stored rows were left untouched, so a
|
|
16902
|
-
* ledger-keeping caller must withhold their ledger entries and read them
|
|
16903
|
-
* again next scan.
|
|
16904
|
-
*/
|
|
16905
|
-
droppedFiles: external_exports.array(external_exports.string()).default([])
|
|
16906
|
-
}).meta({ id: "EgressWriteSummary" });
|
|
16729
|
+
|
|
16730
|
+
// ../../packages/schema/src/zod/egress-extraction.ts
|
|
16731
|
+
var EgressEcosystem = external_exports.enum(["npm", "pypi", "go", "maven", "rubygems", "cargo", "composer", "nuget"]).meta({ id: "EgressEcosystem" });
|
|
16732
|
+
var ProviderRegistryEntry = external_exports.object({
|
|
16733
|
+
id: external_exports.string(),
|
|
16734
|
+
name: external_exports.string(),
|
|
16735
|
+
category: external_exports.string(),
|
|
16736
|
+
/** Suffix-matched: 'stripe.com' matches api.stripe.com, never evilstripe.com. */
|
|
16737
|
+
hostSuffixes: external_exports.array(external_exports.string()).min(1),
|
|
16738
|
+
/** Canonical API base URL recorded for manifest-derived (method 'SDK') endpoints. */
|
|
16739
|
+
apiBase: external_exports.string(),
|
|
16740
|
+
/** Most-sensitive first; index 0 becomes the endpoint dataClass. */
|
|
16741
|
+
defaultDataClasses: external_exports.array(DataClass).min(1),
|
|
16742
|
+
/** SDK identifiers per ecosystem ('go' prefix-matched by path, 'maven' by group-id prefix). */
|
|
16743
|
+
sdks: external_exports.partialRecord(EgressEcosystem, external_exports.array(external_exports.string()))
|
|
16744
|
+
}).meta({ id: "ProviderRegistryEntry" });
|
|
16745
|
+
var EgressCallSiteHit = external_exports.object({
|
|
16746
|
+
file: external_exports.string(),
|
|
16747
|
+
line: external_exports.number().int().positive(),
|
|
16748
|
+
snippet: external_exports.string(),
|
|
16749
|
+
dynamic: external_exports.boolean(),
|
|
16750
|
+
vendored: external_exports.boolean()
|
|
16751
|
+
}).meta({ id: "EgressCallSiteHit" });
|
|
16752
|
+
var ResolvedEgressHit = external_exports.object({
|
|
16753
|
+
host: external_exports.string(),
|
|
16754
|
+
kind: DestinationKind,
|
|
16755
|
+
name: external_exports.string(),
|
|
16756
|
+
category: external_exports.string(),
|
|
16757
|
+
trust: ShareTrustLevel,
|
|
16758
|
+
network: DestinationNetwork.nullable(),
|
|
16759
|
+
method: HttpMethod,
|
|
16760
|
+
transport: Transport,
|
|
16761
|
+
url: external_exports.string(),
|
|
16762
|
+
template: external_exports.boolean(),
|
|
16763
|
+
dataClass: DataClass,
|
|
16764
|
+
site: EgressCallSiteHit
|
|
16765
|
+
}).meta({ id: "ResolvedEgressHit" });
|
|
16766
|
+
var EgressReconcile = external_exports.discriminatedUnion("mode", [
|
|
16767
|
+
external_exports.object({ mode: external_exports.literal("walk"), walkedPrefix: external_exports.string() }),
|
|
16768
|
+
external_exports.object({
|
|
16769
|
+
mode: external_exports.literal("ledger"),
|
|
16770
|
+
scannedFiles: external_exports.array(external_exports.string()),
|
|
16771
|
+
deletedFiles: external_exports.array(external_exports.string())
|
|
16772
|
+
})
|
|
16773
|
+
]).meta({ id: "EgressReconcile" });
|
|
16774
|
+
var RecordProjectEgressInput = external_exports.object({
|
|
16775
|
+
/** Stable reconcile key: 'git:<repo identity>' or 'path:<abs root>' (non-git). */
|
|
16776
|
+
projectKey: external_exports.string().min(1),
|
|
16777
|
+
/** Display name only — never keys reconciliation. */
|
|
16778
|
+
project: external_exports.string(),
|
|
16779
|
+
projectId: external_exports.string().nullable(),
|
|
16780
|
+
reconcile: EgressReconcile,
|
|
16781
|
+
hits: external_exports.array(ResolvedEgressHit)
|
|
16782
|
+
}).meta({ id: "RecordProjectEgressInput" });
|
|
16783
|
+
var EgressWriteSummary = external_exports.object({
|
|
16784
|
+
destinations: external_exports.number().int().nonnegative(),
|
|
16785
|
+
endpoints: external_exports.number().int().nonnegative(),
|
|
16786
|
+
callSites: external_exports.number().int().nonnegative(),
|
|
16787
|
+
truncated: external_exports.boolean(),
|
|
16788
|
+
/**
|
|
16789
|
+
* Files the cap dropped whole. Their stored rows were left untouched, so a
|
|
16790
|
+
* ledger-keeping caller must withhold their ledger entries and read them
|
|
16791
|
+
* again next scan.
|
|
16792
|
+
*/
|
|
16793
|
+
droppedFiles: external_exports.array(external_exports.string()).default([])
|
|
16794
|
+
}).meta({ id: "EgressWriteSummary" });
|
|
16795
|
+
|
|
16796
|
+
// ../../packages/schema/src/zod/event.ts
|
|
16797
|
+
var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
|
|
16798
|
+
var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
|
|
16799
|
+
var EventMetadata = external_exports.object({
|
|
16800
|
+
sessionId: external_exports.string().optional(),
|
|
16801
|
+
repo: external_exports.string().optional(),
|
|
16802
|
+
filePath: external_exports.string().optional(),
|
|
16803
|
+
// The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
|
|
16804
|
+
// set by the tool-scanning hooks. The tool NAME only — never the tool's
|
|
16805
|
+
// arguments or output, which can carry the very value a finding masked
|
|
16806
|
+
// (metadata is stored unredacted). Gives findings on non-file captures a
|
|
16807
|
+
// display location ("via Bash") when no filePath exists.
|
|
16808
|
+
toolName: external_exports.string().optional(),
|
|
16809
|
+
// Set (true) by the worktree scanner when the file is excluded by the
|
|
16810
|
+
// repo's .gitignore. Gitignored files ARE still scanned — local scratch and
|
|
16811
|
+
// generated code can leak real secrets — but the provenance is recorded so
|
|
16812
|
+
// policy/dashboards can treat those findings as informational rather than
|
|
16813
|
+
// blocking. Omitted (not false) for tracked files and non-scan events.
|
|
16814
|
+
gitignored: external_exports.boolean().optional(),
|
|
16815
|
+
// Set (true) ONLY when the event's `content` is the COMPLETE file at
|
|
16816
|
+
// capture time (a worktree scan reading from disk). Hook-captured edits
|
|
16817
|
+
// (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
|
|
16818
|
+
// this. The resolver-on-ingest keys its fixed-at-source dropout
|
|
16819
|
+
// diff on this marker: only a whole-file snapshot can prove a previously
|
|
16820
|
+
// open finding is gone; a fragment's absence proves nothing (the secret
|
|
16821
|
+
// may live outside the hunk). Omitted (not false) for fragments and
|
|
16822
|
+
// non-scan events, so pre-marker clients safely default to the
|
|
16823
|
+
// non-authoritative path.
|
|
16824
|
+
wholeFile: external_exports.boolean().optional(),
|
|
16825
|
+
model: external_exports.string().optional(),
|
|
16826
|
+
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
16827
|
+
// Distributed-tracing correlation. `correlationId` ties a recorded event back
|
|
16828
|
+
// to the request that captured/ingested it (a UUID, generated independently of
|
|
16829
|
+
// the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
|
|
16830
|
+
// originating span when telemetry is enabled. Both optional + backward
|
|
16831
|
+
// compatible — populated by the plugin (see @akasecurity/plugin-sdk).
|
|
16832
|
+
correlationId: external_exports.uuid().optional(),
|
|
16833
|
+
traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
|
|
16834
|
+
// Ids of the detection exceptions that downgraded findings in this capture
|
|
16835
|
+
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
16836
|
+
// authorized the bypass. Absent on captures where no exception applied.
|
|
16837
|
+
exceptionIds: external_exports.array(external_exports.guid()).optional()
|
|
16838
|
+
}).meta({ id: "EventMetadata" });
|
|
16839
|
+
var Event = external_exports.object({
|
|
16840
|
+
id: external_exports.guid(),
|
|
16841
|
+
sourceTool: SourceTool,
|
|
16842
|
+
kind: EventKind,
|
|
16843
|
+
occurredAt: external_exports.iso.datetime(),
|
|
16844
|
+
contentHash: external_exports.string(),
|
|
16845
|
+
content: external_exports.string(),
|
|
16846
|
+
metadata: EventMetadata.optional()
|
|
16847
|
+
}).meta({ id: "Event" });
|
|
16848
|
+
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
16849
|
+
var IngestBatch = external_exports.object({
|
|
16850
|
+
events: external_exports.array(IngestEvent).min(1).max(100),
|
|
16851
|
+
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
16852
|
+
// additionally rejects any event whose contentHash the store has already
|
|
16853
|
+
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
16854
|
+
// backfill), where a re-run mints fresh event ids for identical content and
|
|
16855
|
+
// would otherwise accumulate duplicates. Live hook traffic must NOT set it:
|
|
16856
|
+
// two genuinely separate prompts can be byte-identical and both belong on
|
|
16857
|
+
// the timeline.
|
|
16858
|
+
dedupe: external_exports.literal("content-hash").optional()
|
|
16859
|
+
}).meta({ id: "IngestBatch" });
|
|
16860
|
+
|
|
16861
|
+
// ../../packages/schema/src/zod/exception.ts
|
|
16862
|
+
var ExceptionScope = external_exports.enum(["once", "temporary", "permanent"]);
|
|
16863
|
+
var ExceptionConditions = external_exports.object({
|
|
16864
|
+
repo: external_exports.string().optional(),
|
|
16865
|
+
sourceTool: external_exports.string().optional(),
|
|
16866
|
+
provider: external_exports.string().optional()
|
|
16867
|
+
}).strict();
|
|
16868
|
+
var ExceptionCapability = external_exports.enum(["suppress", "reveal_to_model"]);
|
|
16869
|
+
var DetectionException = external_exports.object({
|
|
16870
|
+
id: external_exports.guid(),
|
|
16871
|
+
ruleId: external_exports.string(),
|
|
16872
|
+
// Denormalized from the rule, for reporting — never matched on.
|
|
16873
|
+
category: DetectionCategory,
|
|
16874
|
+
// HMAC-SHA256 hex of the raw match under a machine-local key: a KEYED
|
|
16875
|
+
// fingerprint, never the raw value, and never reversible. Matching recomputes
|
|
16876
|
+
// the fingerprint from a fresh capture; the value itself is never stored.
|
|
16877
|
+
// Shape-constrained so a malformed — or accidentally raw — value is rejected
|
|
16878
|
+
// at the boundary rather than persisted.
|
|
16879
|
+
valueFingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
16880
|
+
// Version of the fingerprint key the grant was written under; a rotated key
|
|
16881
|
+
// invalidates old grants rather than silently mismatching them.
|
|
16882
|
+
keyVersion: external_exports.number().int().positive(),
|
|
16883
|
+
// maskMatch() preview of the approved value — never the raw value.
|
|
16884
|
+
maskedValue: external_exports.string(),
|
|
16885
|
+
capability: ExceptionCapability.default("suppress"),
|
|
16886
|
+
scope: ExceptionScope,
|
|
16887
|
+
expiresAt: external_exports.iso.datetime().nullable(),
|
|
16888
|
+
maxUses: external_exports.number().int().positive().nullable(),
|
|
16889
|
+
useCount: external_exports.number().int().nonnegative(),
|
|
16890
|
+
lastUsedAt: external_exports.iso.datetime().nullable(),
|
|
16891
|
+
// Mandatory: every grant carries the human reason it exists.
|
|
16892
|
+
justification: external_exports.string().min(1),
|
|
16893
|
+
conditions: ExceptionConditions.nullable(),
|
|
16894
|
+
createdBy: external_exports.string(),
|
|
16895
|
+
createdVia: external_exports.enum(["cli-approve", "cli-add", "web-approve", "web-add", "api", "setup-triage"]),
|
|
16896
|
+
createdAt: external_exports.iso.datetime(),
|
|
16897
|
+
updatedAt: external_exports.iso.datetime(),
|
|
16898
|
+
// Revocation is terminal and retained — consumed/expired/revoked rows are
|
|
16899
|
+
// audit evidence; nothing in the exception lifecycle hard-deletes.
|
|
16900
|
+
revokedAt: external_exports.iso.datetime().nullable(),
|
|
16901
|
+
revokedBy: external_exports.string().nullable(),
|
|
16902
|
+
revokeReason: external_exports.string().nullable()
|
|
16903
|
+
});
|
|
16904
|
+
var ExceptionBundleEntry = DetectionException.pick({
|
|
16905
|
+
id: true,
|
|
16906
|
+
ruleId: true,
|
|
16907
|
+
valueFingerprint: true,
|
|
16908
|
+
keyVersion: true,
|
|
16909
|
+
capability: true,
|
|
16910
|
+
expiresAt: true,
|
|
16911
|
+
maxUses: true,
|
|
16912
|
+
useCount: true,
|
|
16913
|
+
conditions: true
|
|
16914
|
+
});
|
|
16915
|
+
var ExceptionDescriptor = DetectionException.omit({ valueFingerprint: true });
|
|
16907
16916
|
|
|
16908
16917
|
// ../../packages/schema/src/zod/exception-action.ts
|
|
16909
16918
|
var confirmation = external_exports.string().optional();
|
|
@@ -17116,7 +17125,13 @@ var VaultConsent = external_exports.object({
|
|
|
17116
17125
|
|
|
17117
17126
|
// ../../packages/schema/src/zod/local.ts
|
|
17118
17127
|
var WORKSPACE_SETTINGS_SPEC_VERSION = 5;
|
|
17119
|
-
var RunMode = external_exports.enum(["standalone"]);
|
|
17128
|
+
var RunMode = external_exports.enum(["standalone", "attached"]);
|
|
17129
|
+
var ControlPlaneConnection = external_exports.object({
|
|
17130
|
+
endpoint: external_exports.string().min(1),
|
|
17131
|
+
// Display name for the deployment, shown instead of the raw endpoint.
|
|
17132
|
+
label: external_exports.string().min(1).optional(),
|
|
17133
|
+
attachedAt: external_exports.iso.datetime()
|
|
17134
|
+
}).meta({ id: "ControlPlaneConnection" });
|
|
17120
17135
|
var SimpleDetectionPolicy = external_exports.enum(["redact", "warn"]);
|
|
17121
17136
|
var HistoricalAccess = external_exports.enum(["full", "session-only"]);
|
|
17122
17137
|
var ModelJudgeConsent = external_exports.object({
|
|
@@ -17125,12 +17140,10 @@ var ModelJudgeConsent = external_exports.object({
|
|
|
17125
17140
|
});
|
|
17126
17141
|
var WorkspaceSettings = external_exports.object({
|
|
17127
17142
|
specVersion: external_exports.number().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
|
|
17128
|
-
|
|
17129
|
-
//
|
|
17130
|
-
runMode:
|
|
17131
|
-
|
|
17132
|
-
RunMode.default("standalone")
|
|
17133
|
-
),
|
|
17143
|
+
runMode: RunMode.default("standalone"),
|
|
17144
|
+
// Present only while attached; a detach clears it. Its presence is what makes
|
|
17145
|
+
// `runMode: 'attached'` mean anything — see isAttached.
|
|
17146
|
+
controlPlane: ControlPlaneConnection.optional(),
|
|
17134
17147
|
policy: SimpleDetectionPolicy.default("redact"),
|
|
17135
17148
|
// Consent for scanning pre-install surfaces; opt-in (see HistoricalAccess).
|
|
17136
17149
|
historicalAccess: HistoricalAccess.default("session-only"),
|
|
@@ -17156,6 +17169,195 @@ var WorkspaceSettings = external_exports.object({
|
|
|
17156
17169
|
modelJudgeConsent: ModelJudgeConsent.optional()
|
|
17157
17170
|
});
|
|
17158
17171
|
|
|
17172
|
+
// ../../packages/schema/src/zod/managed.ts
|
|
17173
|
+
var MANAGED_SETTINGS_SPEC_VERSION = 1;
|
|
17174
|
+
var ManagedSettingKey = external_exports.enum([
|
|
17175
|
+
"runMode",
|
|
17176
|
+
"historicalAccess",
|
|
17177
|
+
"vaultConsent",
|
|
17178
|
+
"vaultKeyCustody",
|
|
17179
|
+
"vaultInlineReveal",
|
|
17180
|
+
"modelJudgeConsent",
|
|
17181
|
+
"dataSharesInPlace"
|
|
17182
|
+
]).meta({ id: "ManagedSettingKey" });
|
|
17183
|
+
var ManagedSettingsValues = external_exports.object({
|
|
17184
|
+
runMode: external_exports.enum(["standalone", "attached"]).optional(),
|
|
17185
|
+
controlPlane: external_exports.object({
|
|
17186
|
+
endpoint: external_exports.string().min(1),
|
|
17187
|
+
label: external_exports.string().min(1).optional()
|
|
17188
|
+
}).optional(),
|
|
17189
|
+
historicalAccess: external_exports.enum(["full", "session-only"]).optional(),
|
|
17190
|
+
vaultConsent: external_exports.boolean().optional(),
|
|
17191
|
+
vaultKeyCustody: external_exports.enum(["file", "keychain"]).optional(),
|
|
17192
|
+
vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
|
|
17193
|
+
modelJudgeConsent: external_exports.boolean().optional(),
|
|
17194
|
+
dataSharesInPlace: external_exports.boolean().optional()
|
|
17195
|
+
}).meta({ id: "ManagedSettingsValues" });
|
|
17196
|
+
var ManagedSettings = external_exports.object({
|
|
17197
|
+
specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
|
|
17198
|
+
// Shown on every locked control, so the user can tell an administrative
|
|
17199
|
+
// decision from a bug. Absent renders as a generic "your organization".
|
|
17200
|
+
organization: external_exports.string().min(1).optional(),
|
|
17201
|
+
// What the administrator pinned.
|
|
17202
|
+
values: ManagedSettingsValues.default({}),
|
|
17203
|
+
// Which of those the user may not change. A key here with no matching value
|
|
17204
|
+
// freezes whatever the user last chose; a value with no lock is a DEFAULT
|
|
17205
|
+
// the user may still override. The two are separable on purpose.
|
|
17206
|
+
lockedFields: external_exports.array(ManagedSettingKey).default([])
|
|
17207
|
+
}).meta({ id: "ManagedSettings" });
|
|
17208
|
+
|
|
17209
|
+
// ../../packages/schema/src/zod/policy.ts
|
|
17210
|
+
var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
|
|
17211
|
+
var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
|
|
17212
|
+
var Policy = external_exports.object({
|
|
17213
|
+
id: external_exports.guid(),
|
|
17214
|
+
scope: PolicyScope,
|
|
17215
|
+
target: PolicyTarget,
|
|
17216
|
+
action: ActionTaken,
|
|
17217
|
+
enabled: external_exports.boolean().default(true),
|
|
17218
|
+
customKeywords: external_exports.array(external_exports.string()).optional(),
|
|
17219
|
+
// Display name — optional so older policy rows without name still parse.
|
|
17220
|
+
// Added for the findings API (policy.name column migration).
|
|
17221
|
+
name: external_exports.string().optional()
|
|
17222
|
+
}).meta({ id: "Policy" });
|
|
17223
|
+
var PolicyBundle = external_exports.object({
|
|
17224
|
+
version: external_exports.string(),
|
|
17225
|
+
policies: external_exports.array(Policy),
|
|
17226
|
+
// Rules from the installed marketplace packs (snapshotted by the
|
|
17227
|
+
// control plane). The plugin registers these in addition to its bundled
|
|
17228
|
+
// packs. Optional so older backends — and older on-disk caches — that omit
|
|
17229
|
+
// the field still parse; consumers read `bundle.rules ?? []`.
|
|
17230
|
+
rules: external_exports.array(Rule).optional(),
|
|
17231
|
+
// When true, `rules` IS the complete effective ruleset and the runtime must
|
|
17232
|
+
// NOT merge its compiled-in bundled packs — the standalone gateway sets this
|
|
17233
|
+
// after reading the user's installed snapshot (installed_packs, enabled
|
|
17234
|
+
// packs only), which is how detection updates stay manual: new bundled
|
|
17235
|
+
// rules run only after the user applies the pack update. Absent/false keeps
|
|
17236
|
+
// the historical composition (bundled packs + rules) — older caches.
|
|
17237
|
+
rulesComplete: external_exports.boolean().optional(),
|
|
17238
|
+
// Active detection exceptions, evaluation subset only (see
|
|
17239
|
+
// ExceptionBundleEntry). Optional so older bundle producers — and older
|
|
17240
|
+
// on-disk caches — that omit the field still parse; consumers read
|
|
17241
|
+
// `bundle.exceptions ?? []`.
|
|
17242
|
+
exceptions: external_exports.array(ExceptionBundleEntry).optional(),
|
|
17243
|
+
// Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
|
|
17244
|
+
// A second axis over the same `redact` action, carried beside the policies
|
|
17245
|
+
// rather than on them: nothing writes ruleId-targeted policies to disk, so
|
|
17246
|
+
// widening Policy itself would change a persisted shape to express something
|
|
17247
|
+
// only the in-memory bundle needs. Optional so an older producer — or an
|
|
17248
|
+
// older on-disk cache — still parses; consumers read `?? []` and get the
|
|
17249
|
+
// pre-existing one-way behaviour, which is the safe direction to default.
|
|
17250
|
+
reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
|
|
17251
|
+
// Installed pack version, keyed by ruleId, for rules in `rules` that came
|
|
17252
|
+
// from a versioned installed pack. Optional so older backends — and older
|
|
17253
|
+
// on-disk caches — that omit the field still parse; consumers fall back to
|
|
17254
|
+
// the rule's own spec version. NOT the bundle version above — see
|
|
17255
|
+
// installedRuleset's ruleVersions for the source of truth.
|
|
17256
|
+
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
17257
|
+
customKeywords: external_exports.array(external_exports.string()),
|
|
17258
|
+
fetchedAt: external_exports.iso.datetime()
|
|
17259
|
+
}).meta({ id: "PolicyBundle" });
|
|
17260
|
+
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
17261
|
+
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
17262
|
+
var CATEGORY_PEAK_SEVERITY = {
|
|
17263
|
+
secret: "critical",
|
|
17264
|
+
financial: "critical",
|
|
17265
|
+
// core-financial/credit-card
|
|
17266
|
+
code_flaw: "critical",
|
|
17267
|
+
pii: "high",
|
|
17268
|
+
phi: "high",
|
|
17269
|
+
custom: "high",
|
|
17270
|
+
// user-defined; conservative
|
|
17271
|
+
code_context: "low",
|
|
17272
|
+
config: "low"
|
|
17273
|
+
// observe-only; floors to monitor regardless
|
|
17274
|
+
};
|
|
17275
|
+
function severityFloorPolicy(category) {
|
|
17276
|
+
if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
|
|
17277
|
+
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
17278
|
+
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
17279
|
+
}
|
|
17280
|
+
var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
|
|
17281
|
+
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
17282
|
+
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
17283
|
+
var BUILTIN_POLICY_SPECS = {
|
|
17284
|
+
monitor: {
|
|
17285
|
+
name: "Monitor",
|
|
17286
|
+
action: "log",
|
|
17287
|
+
reversible: false,
|
|
17288
|
+
description: "Log every match for audit. The request is allowed through untouched."
|
|
17289
|
+
},
|
|
17290
|
+
warn: {
|
|
17291
|
+
name: "Warn",
|
|
17292
|
+
action: "warn",
|
|
17293
|
+
reversible: false,
|
|
17294
|
+
description: "Allow the request, but warn the user inline before it is sent."
|
|
17295
|
+
},
|
|
17296
|
+
redact: {
|
|
17297
|
+
name: "Redact",
|
|
17298
|
+
action: "redact",
|
|
17299
|
+
reversible: false,
|
|
17300
|
+
description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
|
|
17301
|
+
},
|
|
17302
|
+
vault: {
|
|
17303
|
+
name: "Redact & Vault",
|
|
17304
|
+
action: "redact",
|
|
17305
|
+
reversible: true,
|
|
17306
|
+
description: "Strip the matched value from the request and keep an encrypted, recoverable copy in the local vault, leaving a pointer in its place. Needs the vault consent granted under Settings; without it this behaves as Redact."
|
|
17307
|
+
},
|
|
17308
|
+
block: {
|
|
17309
|
+
name: "Block",
|
|
17310
|
+
action: "block",
|
|
17311
|
+
reversible: false,
|
|
17312
|
+
description: "Refuse the request entirely whenever any rule in this detection matches."
|
|
17313
|
+
}
|
|
17314
|
+
};
|
|
17315
|
+
function builtinPolicyToAction(id) {
|
|
17316
|
+
return BUILTIN_POLICY_SPECS[id].action;
|
|
17317
|
+
}
|
|
17318
|
+
var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
17319
|
+
(id) => !BUILTIN_POLICY_SPECS[id].reversible
|
|
17320
|
+
);
|
|
17321
|
+
var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
17322
|
+
(id) => BUILTIN_POLICY_SPECS[id].reversible
|
|
17323
|
+
);
|
|
17324
|
+
var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
|
|
17325
|
+
var DEFAULT_ACTIONS = Object.fromEntries(
|
|
17326
|
+
DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
|
|
17327
|
+
);
|
|
17328
|
+
var BUILTIN_POLICIES = Object.fromEntries(
|
|
17329
|
+
KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
|
|
17330
|
+
);
|
|
17331
|
+
var UsedByItem = external_exports.object({
|
|
17332
|
+
id: external_exports.string(),
|
|
17333
|
+
name: external_exports.string(),
|
|
17334
|
+
ruleCount: external_exports.number().int().nonnegative(),
|
|
17335
|
+
enabled: external_exports.boolean()
|
|
17336
|
+
}).meta({ id: "UsedByItem" });
|
|
17337
|
+
var PolicyListItem = external_exports.object({
|
|
17338
|
+
id: external_exports.string(),
|
|
17339
|
+
kind: PolicyKind,
|
|
17340
|
+
name: external_exports.string(),
|
|
17341
|
+
enabled: external_exports.boolean(),
|
|
17342
|
+
usedByCount: external_exports.number().int().nonnegative()
|
|
17343
|
+
}).meta({ id: "PolicyListItem" });
|
|
17344
|
+
var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
|
|
17345
|
+
var PolicyDetail = external_exports.object({
|
|
17346
|
+
specVersion: external_exports.literal(1),
|
|
17347
|
+
id: external_exports.string(),
|
|
17348
|
+
kind: PolicyKind,
|
|
17349
|
+
name: external_exports.string(),
|
|
17350
|
+
enabled: external_exports.boolean(),
|
|
17351
|
+
description: external_exports.string(),
|
|
17352
|
+
usedBy: external_exports.array(UsedByItem)
|
|
17353
|
+
}).meta({ id: "PolicyDetail" });
|
|
17354
|
+
var PolicyStatsResponse = external_exports.object({
|
|
17355
|
+
policies: external_exports.number().int().nonnegative(),
|
|
17356
|
+
builtin: external_exports.number().int().nonnegative(),
|
|
17357
|
+
custom: external_exports.number().int().nonnegative(),
|
|
17358
|
+
detectionsGoverned: external_exports.number().int().nonnegative()
|
|
17359
|
+
}).meta({ id: "PolicyStatsResponse" });
|
|
17360
|
+
|
|
17159
17361
|
// ../../packages/schema/src/zod/project-files.ts
|
|
17160
17362
|
var ProjectFileInput = external_exports.object({
|
|
17161
17363
|
path: external_exports.string().min(1),
|
|
@@ -17228,44 +17430,6 @@ var BatchedRemediation = external_exports.discriminatedUnion("kind", [
|
|
|
17228
17430
|
NoRemediationDecision
|
|
17229
17431
|
]);
|
|
17230
17432
|
|
|
17231
|
-
// ../../packages/schema/src/zod/rule-test.ts
|
|
17232
|
-
var TestRulesRequest = external_exports.object({
|
|
17233
|
-
rules: external_exports.array(Rule).min(1).max(100),
|
|
17234
|
-
text: external_exports.string().max(5e4).optional(),
|
|
17235
|
-
fixtures: external_exports.array(RuleFixture).max(200).optional()
|
|
17236
|
-
}).refine((v) => v.text !== void 0 || (v.fixtures?.length ?? 0) > 0, {
|
|
17237
|
-
message: "Provide `text`, `fixtures`, or both \u2014 there must be something to test"
|
|
17238
|
-
}).meta({ id: "TestRulesRequest" });
|
|
17239
|
-
var RuleTestMatch = external_exports.object({
|
|
17240
|
-
ruleId: external_exports.string(),
|
|
17241
|
-
category: DetectionCategory,
|
|
17242
|
-
severity: Severity,
|
|
17243
|
-
span: Span,
|
|
17244
|
-
confidence: external_exports.number().min(0).max(1),
|
|
17245
|
-
match: external_exports.string()
|
|
17246
|
-
}).meta({ id: "RuleTestMatch" });
|
|
17247
|
-
var FixtureResult = external_exports.object({
|
|
17248
|
-
label: external_exports.string(),
|
|
17249
|
-
shouldMatch: external_exports.boolean(),
|
|
17250
|
-
didMatch: external_exports.boolean(),
|
|
17251
|
-
passed: external_exports.boolean(),
|
|
17252
|
-
matches: external_exports.array(RuleTestMatch)
|
|
17253
|
-
}).meta({ id: "FixtureResult" });
|
|
17254
|
-
var TestRulesResponse = external_exports.object({
|
|
17255
|
-
// Present only when the request supplied `text`.
|
|
17256
|
-
adhoc: external_exports.object({ matches: external_exports.array(RuleTestMatch) }).optional(),
|
|
17257
|
-
fixtures: external_exports.array(FixtureResult),
|
|
17258
|
-
summary: external_exports.object({
|
|
17259
|
-
total: external_exports.number().int().nonnegative(),
|
|
17260
|
-
passed: external_exports.number().int().nonnegative(),
|
|
17261
|
-
failed: external_exports.number().int().nonnegative()
|
|
17262
|
-
}),
|
|
17263
|
-
// Ids of rules whose matcher type the engine cannot evaluate today (e.g.
|
|
17264
|
-
// `validator`), so they silently never match. Surfaced so an author is not
|
|
17265
|
-
// misled by a green run that actually skipped a rule.
|
|
17266
|
-
unsupportedRuleIds: external_exports.array(external_exports.string())
|
|
17267
|
-
}).meta({ id: "TestRulesResponse" });
|
|
17268
|
-
|
|
17269
17433
|
// ../../packages/schema/src/zod/security.ts
|
|
17270
17434
|
var SeveritySummaryItem = external_exports.object({
|
|
17271
17435
|
severity: Severity,
|
|
@@ -17363,10 +17527,22 @@ var TopSourcesQuery = external_exports.object({
|
|
|
17363
17527
|
// Omit for both kinds.
|
|
17364
17528
|
kind: external_exports.enum(SOURCE_KINDS).optional()
|
|
17365
17529
|
});
|
|
17366
|
-
var Provider =
|
|
17530
|
+
var Provider = Harness.extract([
|
|
17531
|
+
"ClaudeCode",
|
|
17532
|
+
"Cursor",
|
|
17533
|
+
"Codex",
|
|
17534
|
+
"Antigravity",
|
|
17535
|
+
"ClaudeAi",
|
|
17536
|
+
"ChatGpt",
|
|
17537
|
+
"Copilot",
|
|
17538
|
+
"Api"
|
|
17539
|
+
]).meta({ id: "Provider" });
|
|
17367
17540
|
var ScanCoverageProvider = external_exports.object({
|
|
17368
17541
|
provider: Provider,
|
|
17369
|
-
// Percent of that provider's traffic
|
|
17542
|
+
// Percent of that provider's traffic the shipped capture surface reaches.
|
|
17543
|
+
// A curated business fact, constant across every `range` — not a measured
|
|
17544
|
+
// per-window metric. 0 exactly when `supported` is false. See the comment
|
|
17545
|
+
// above the block for where these numbers are decided.
|
|
17370
17546
|
coverage: external_exports.number().int().min(0).max(100),
|
|
17371
17547
|
supported: external_exports.boolean()
|
|
17372
17548
|
}).meta({ id: "ScanCoverageProvider" });
|
|
@@ -17420,6 +17596,18 @@ var ApplyRecommendedActionResponse = external_exports.object({
|
|
|
17420
17596
|
var DismissRecommendedActionResponse = external_exports.object({ id: external_exports.string(), status: external_exports.literal("dismissed") }).meta({ id: "DismissRecommendedActionResponse" });
|
|
17421
17597
|
var RecommendedActionIdParam = external_exports.object({ id: external_exports.string() });
|
|
17422
17598
|
|
|
17599
|
+
// ../../packages/schema/src/zod/settings-action.ts
|
|
17600
|
+
var SaveSettingsInput = external_exports.object({
|
|
17601
|
+
historicalAccess: external_exports.string(),
|
|
17602
|
+
modelJudgeConsent: external_exports.boolean(),
|
|
17603
|
+
vaultConsent: external_exports.string(),
|
|
17604
|
+
vaultInlineReveal: external_exports.string()
|
|
17605
|
+
});
|
|
17606
|
+
var AttachInput = external_exports.object({
|
|
17607
|
+
endpoint: external_exports.string(),
|
|
17608
|
+
label: external_exports.string().optional()
|
|
17609
|
+
});
|
|
17610
|
+
|
|
17423
17611
|
// ../../packages/schema/src/zod/triage.ts
|
|
17424
17612
|
var TriageHit = external_exports.object({
|
|
17425
17613
|
ruleId: external_exports.string(),
|
|
@@ -17434,7 +17622,7 @@ var TriageHit = external_exports.object({
|
|
|
17434
17622
|
valueFingerprint: external_exports.string().optional(),
|
|
17435
17623
|
keyVersion: external_exports.number().int().nonnegative().optional()
|
|
17436
17624
|
});
|
|
17437
|
-
var TriagePolicy =
|
|
17625
|
+
var TriagePolicy = CategoryPolicyId;
|
|
17438
17626
|
var TriageCategoryRec = external_exports.object({
|
|
17439
17627
|
category: DetectionCategory,
|
|
17440
17628
|
action: TriagePolicy,
|
|
@@ -17533,21 +17721,12 @@ import { execFileSync } from "child_process";
|
|
|
17533
17721
|
var USE_SHELL = process.platform === "win32";
|
|
17534
17722
|
|
|
17535
17723
|
// ../../packages/plugin-sdk/src/config.ts
|
|
17536
|
-
import { existsSync as
|
|
17537
|
-
import { join as
|
|
17538
|
-
|
|
17539
|
-
// ../../packages/persistence/src/database.ts
|
|
17540
|
-
import { randomUUID as randomUUID10 } from "crypto";
|
|
17541
|
-
import { join as join2, sep } from "path";
|
|
17542
|
-
import { DatabaseSync } from "node:sqlite";
|
|
17543
|
-
|
|
17544
|
-
// ../../packages/persistence/src/ids.ts
|
|
17545
|
-
import { createHash } from "crypto";
|
|
17724
|
+
import { existsSync as existsSync6 } from "fs";
|
|
17725
|
+
import { join as join10 } from "path";
|
|
17546
17726
|
|
|
17547
|
-
// ../../packages/persistence/src/
|
|
17548
|
-
import {
|
|
17549
|
-
import {
|
|
17550
|
-
import { basename, dirname, join } from "path";
|
|
17727
|
+
// ../../packages/persistence/src/control-plane-credential.ts
|
|
17728
|
+
import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, rmSync as rmSync2, statSync } from "fs";
|
|
17729
|
+
import { join } from "path";
|
|
17551
17730
|
|
|
17552
17731
|
// ../../packages/persistence/src/paths.ts
|
|
17553
17732
|
import {
|
|
@@ -17561,11 +17740,25 @@ import {
|
|
|
17561
17740
|
} from "fs";
|
|
17562
17741
|
import { threadId } from "worker_threads";
|
|
17563
17742
|
|
|
17743
|
+
// ../../packages/persistence/src/database.ts
|
|
17744
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
17745
|
+
import { join as join3, sep } from "path";
|
|
17746
|
+
import { DatabaseSync } from "node:sqlite";
|
|
17747
|
+
|
|
17748
|
+
// ../../packages/persistence/src/ids.ts
|
|
17749
|
+
import { createHash } from "crypto";
|
|
17750
|
+
|
|
17564
17751
|
// ../../packages/persistence/src/internal/snapshot.ts
|
|
17752
|
+
import { randomUUID } from "crypto";
|
|
17753
|
+
import { existsSync, readdirSync, renameSync as renameSync2, rmSync as rmSync3, statSync as statSync2 } from "fs";
|
|
17754
|
+
import { basename, dirname, join as join2 } from "path";
|
|
17565
17755
|
var STALE_PARTIAL_MS = 5 * 6e4;
|
|
17756
|
+
var SNAPSHOT_STAGING_SUFFIX = ".partial";
|
|
17757
|
+
var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
|
|
17566
17758
|
|
|
17567
17759
|
// ../../packages/persistence/src/repositories/activity.ts
|
|
17568
17760
|
var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
|
|
17761
|
+
var DEFAULT_HARNESS = HARNESS.ClaudeCode;
|
|
17569
17762
|
|
|
17570
17763
|
// ../../packages/persistence/src/repositories/exceptions.ts
|
|
17571
17764
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -17584,7 +17777,20 @@ import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
|
|
|
17584
17777
|
// ../../packages/persistence/src/repositories/inventory-assets.ts
|
|
17585
17778
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
17586
17779
|
var VALID_HARNESS_IDS = new Set(HarnessId.options);
|
|
17780
|
+
var HARNESS_LABELS = {
|
|
17781
|
+
[HARNESS.ClaudeCode]: "Claude Code",
|
|
17782
|
+
[HARNESS.Cursor]: "Cursor",
|
|
17783
|
+
[HARNESS.Codex]: "Codex",
|
|
17784
|
+
[HARNESS.Antigravity]: "Antigravity"
|
|
17785
|
+
};
|
|
17587
17786
|
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
17787
|
+
var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
|
|
17788
|
+
var TITLE_NEEDLES = {
|
|
17789
|
+
ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
|
|
17790
|
+
Cursor: stripSeparators(SOURCE_TOOL.Cursor),
|
|
17791
|
+
Codex: stripSeparators(SOURCE_TOOL.Codex),
|
|
17792
|
+
Antigravity: stripSeparators(SOURCE_TOOL.Antigravity)
|
|
17793
|
+
};
|
|
17588
17794
|
|
|
17589
17795
|
// ../../packages/persistence/src/repositories/policies.ts
|
|
17590
17796
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
@@ -17598,6 +17804,18 @@ import { randomUUID as randomUUID7 } from "crypto";
|
|
|
17598
17804
|
// ../../packages/persistence/src/repositories/secret-vault.ts
|
|
17599
17805
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
17600
17806
|
|
|
17807
|
+
// ../../packages/persistence/src/repositories/security.ts
|
|
17808
|
+
var SCAN_COVERAGE = {
|
|
17809
|
+
[HARNESS.Antigravity]: { coverage: 60, supported: true },
|
|
17810
|
+
[HARNESS.Api]: { coverage: 0, supported: false },
|
|
17811
|
+
[HARNESS.ChatGpt]: { coverage: 40, supported: true },
|
|
17812
|
+
[HARNESS.ClaudeAi]: { coverage: 40, supported: true },
|
|
17813
|
+
[HARNESS.ClaudeCode]: { coverage: 100, supported: true },
|
|
17814
|
+
[HARNESS.Codex]: { coverage: 80, supported: true },
|
|
17815
|
+
[HARNESS.Copilot]: { coverage: 0, supported: false },
|
|
17816
|
+
[HARNESS.Cursor]: { coverage: 0, supported: false }
|
|
17817
|
+
};
|
|
17818
|
+
|
|
17601
17819
|
// ../../packages/persistence/src/repositories/shares.ts
|
|
17602
17820
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
17603
17821
|
|
|
@@ -17607,9 +17825,9 @@ import {
|
|
|
17607
17825
|
closeSync,
|
|
17608
17826
|
existsSync as existsSync2,
|
|
17609
17827
|
openSync,
|
|
17610
|
-
readFileSync,
|
|
17611
|
-
rmSync as
|
|
17612
|
-
statSync as
|
|
17828
|
+
readFileSync as readFileSync2,
|
|
17829
|
+
rmSync as rmSync4,
|
|
17830
|
+
statSync as statSync3,
|
|
17613
17831
|
writeFileSync as writeFileSync2
|
|
17614
17832
|
} from "fs";
|
|
17615
17833
|
import { hostname as hostname3 } from "os";
|
|
@@ -17620,19 +17838,27 @@ import { createHash as createHash3 } from "crypto";
|
|
|
17620
17838
|
|
|
17621
17839
|
// ../../packages/persistence/src/fingerprint.ts
|
|
17622
17840
|
import { createHmac, randomBytes } from "crypto";
|
|
17623
|
-
import { existsSync as existsSync3, readFileSync as
|
|
17624
|
-
import { join as
|
|
17841
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
17842
|
+
import { join as join4 } from "path";
|
|
17625
17843
|
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
17626
17844
|
|
|
17627
17845
|
// ../../packages/persistence/src/local-layout.ts
|
|
17628
17846
|
import { renameSync as renameSync3 } from "fs";
|
|
17629
17847
|
import { mkdir } from "fs/promises";
|
|
17630
17848
|
import { homedir } from "os";
|
|
17631
|
-
import { join as
|
|
17849
|
+
import { join as join5 } from "path";
|
|
17850
|
+
|
|
17851
|
+
// ../../packages/persistence/src/managed-settings.ts
|
|
17852
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
17853
|
+
import { posix, win32 } from "path";
|
|
17632
17854
|
|
|
17633
17855
|
// ../../packages/persistence/src/settings.ts
|
|
17634
|
-
import { readFileSync as
|
|
17635
|
-
import { join as
|
|
17856
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
17857
|
+
import { join as join6 } from "path";
|
|
17858
|
+
|
|
17859
|
+
// ../../packages/persistence/src/store-symlinks.ts
|
|
17860
|
+
import { existsSync as existsSync4, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
|
|
17861
|
+
import { dirname as dirname2, join as join7, resolve } from "path";
|
|
17636
17862
|
|
|
17637
17863
|
// ../../packages/persistence/src/vault/crypto.ts
|
|
17638
17864
|
import {
|
|
@@ -17646,23 +17872,15 @@ import {
|
|
|
17646
17872
|
// ../../packages/persistence/src/vault/key-provider.ts
|
|
17647
17873
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
17648
17874
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
17649
|
-
import {
|
|
17650
|
-
|
|
17651
|
-
mkdirSync as mkdirSync2,
|
|
17652
|
-
readFileSync as readFileSync4,
|
|
17653
|
-
renameSync as renameSync4,
|
|
17654
|
-
rmSync as rmSync4,
|
|
17655
|
-
statSync as statSync3,
|
|
17656
|
-
writeFileSync as writeFileSync3
|
|
17657
|
-
} from "fs";
|
|
17658
|
-
import { join as join6 } from "path";
|
|
17875
|
+
import { chmodSync as chmodSync3, readFileSync as readFileSync6, renameSync as renameSync4, rmSync as rmSync5, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
17876
|
+
import { join as join8 } from "path";
|
|
17659
17877
|
|
|
17660
17878
|
// ../../packages/persistence/src/vault/vault.ts
|
|
17661
17879
|
import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
|
|
17662
17880
|
|
|
17663
17881
|
// ../../packages/persistence/src/warn-era-cap.ts
|
|
17664
|
-
import { existsSync as
|
|
17665
|
-
import { join as
|
|
17882
|
+
import { existsSync as existsSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
17883
|
+
import { join as join9 } from "path";
|
|
17666
17884
|
|
|
17667
17885
|
// ../../packages/plugin-sdk/src/provider-env.ts
|
|
17668
17886
|
var booleanish = external_exports.string().optional().transform((v) => {
|
|
@@ -17683,9 +17901,9 @@ var providerEnvShape = {
|
|
|
17683
17901
|
var ProviderEnvSchema = external_exports.object(providerEnvShape);
|
|
17684
17902
|
|
|
17685
17903
|
// ../../packages/plugin-sdk/src/config-inventory.ts
|
|
17686
|
-
import { readdirSync as readdirSync2, readFileSync as
|
|
17904
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync8, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
|
|
17687
17905
|
import { homedir as homedir2 } from "os";
|
|
17688
|
-
import { basename as basename3, join as
|
|
17906
|
+
import { basename as basename3, join as join12 } from "path";
|
|
17689
17907
|
|
|
17690
17908
|
// ../../packages/detections/src/egress/registry.ts
|
|
17691
17909
|
var EXTRACTOR_VERSION = "1";
|
|
@@ -18415,6 +18633,7 @@ var CONFIG_POSTURE_RULES = [
|
|
|
18415
18633
|
];
|
|
18416
18634
|
|
|
18417
18635
|
// ../../packages/detections/src/security/redos-probe.ts
|
|
18636
|
+
var BUDGET_MS = 100;
|
|
18418
18637
|
var EXPONENTIAL_UNITS = [
|
|
18419
18638
|
"a",
|
|
18420
18639
|
"0",
|
|
@@ -18438,34 +18657,40 @@ var EXPONENTIAL_PROBES = EXPONENTIAL_UNITS.flatMap(
|
|
|
18438
18657
|
var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map(
|
|
18439
18658
|
(unit) => unit.repeat(1e4).slice(0, 4e4) + "!"
|
|
18440
18659
|
);
|
|
18660
|
+
var CPU_CORROBORATION_SHARE = 0.2;
|
|
18661
|
+
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
18441
18662
|
|
|
18442
18663
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
18443
|
-
import { existsSync as
|
|
18444
|
-
import { basename as basename2, dirname as
|
|
18664
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7, statSync as statSync6 } from "fs";
|
|
18665
|
+
import { basename as basename2, dirname as dirname3, isAbsolute, join as join11, sep as sep2 } from "path";
|
|
18445
18666
|
|
|
18446
18667
|
// ../../packages/plugin-sdk/src/events.ts
|
|
18447
18668
|
import { createHash as createHash4, randomUUID as randomUUID13 } from "crypto";
|
|
18448
18669
|
|
|
18449
18670
|
// ../../packages/plugin-sdk/src/isolated-scan.ts
|
|
18450
|
-
import { existsSync as
|
|
18671
|
+
import { existsSync as existsSync8 } from "fs";
|
|
18451
18672
|
import { fileURLToPath } from "url";
|
|
18452
18673
|
import { Worker } from "worker_threads";
|
|
18453
18674
|
|
|
18675
|
+
// ../../packages/plugin-sdk/src/ignore-layers.ts
|
|
18676
|
+
var import_ignore = __toESM(require_ignore(), 1);
|
|
18677
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
18678
|
+
import { join as join13 } from "path";
|
|
18679
|
+
|
|
18454
18680
|
// ../../packages/plugin-sdk/src/inventory-resolver.ts
|
|
18455
18681
|
import { arch, hostname as hostname4, platform, release } from "os";
|
|
18456
18682
|
|
|
18457
18683
|
// ../../packages/plugin-sdk/src/nudge.ts
|
|
18458
|
-
import { mkdirSync as
|
|
18459
|
-
import { join as
|
|
18684
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
|
|
18685
|
+
import { join as join14 } from "path";
|
|
18460
18686
|
|
|
18461
18687
|
// ../../packages/plugin-sdk/src/paths.ts
|
|
18462
|
-
import { readdirSync as readdirSync3, realpathSync as
|
|
18463
|
-
import { basename as basename4, dirname as
|
|
18688
|
+
import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
|
|
18689
|
+
import { basename as basename4, dirname as dirname4, sep as sep3 } from "path";
|
|
18464
18690
|
|
|
18465
18691
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18466
|
-
|
|
18467
|
-
import {
|
|
18468
|
-
import { basename as basename5, join as join12 } from "path";
|
|
18692
|
+
import { existsSync as existsSync9, readdirSync as readdirSync4 } from "fs";
|
|
18693
|
+
import { basename as basename5, join as join15 } from "path";
|
|
18469
18694
|
|
|
18470
18695
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18471
18696
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -18500,17 +18725,22 @@ import { randomUUID as randomUUID14 } from "crypto";
|
|
|
18500
18725
|
var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
18501
18726
|
|
|
18502
18727
|
// ../../packages/plugin-sdk/src/throttle.ts
|
|
18503
|
-
import { mkdirSync as
|
|
18504
|
-
import { join as
|
|
18728
|
+
import { mkdirSync as mkdirSync3, statSync as statSync8, writeFileSync as writeFileSync6 } from "fs";
|
|
18729
|
+
import { join as join16 } from "path";
|
|
18505
18730
|
|
|
18506
18731
|
// ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
|
|
18507
18732
|
import { writeFileSync as writeFileSync7 } from "fs";
|
|
18508
|
-
import { join as
|
|
18733
|
+
import { join as join17 } from "path";
|
|
18734
|
+
|
|
18735
|
+
// ../../packages/setup-wizard/src/triage/merge.ts
|
|
18736
|
+
var RANK = Object.fromEntries(
|
|
18737
|
+
KNOWN_BUILTIN_IDS.map((id, i) => [id, i])
|
|
18738
|
+
);
|
|
18509
18739
|
|
|
18510
18740
|
// ../../packages/setup-wizard/src/triage/plan-file.ts
|
|
18511
|
-
import { mkdtempSync, readFileSync as
|
|
18741
|
+
import { mkdtempSync, readFileSync as readFileSync11, rmdirSync, rmSync as rmSync6, writeFileSync as writeFileSync8 } from "fs";
|
|
18512
18742
|
import { tmpdir } from "os";
|
|
18513
|
-
import { basename as basename6, dirname as
|
|
18743
|
+
import { basename as basename6, dirname as dirname5, join as join18 } from "path";
|
|
18514
18744
|
var SuppressionEntrySchema = external_exports.object({
|
|
18515
18745
|
ruleId: external_exports.string(),
|
|
18516
18746
|
category: DetectionCategory,
|
|
@@ -18653,7 +18883,7 @@ function buildIntroCard(manifest2, verified) {
|
|
|
18653
18883
|
var manifestPath = process.argv[2];
|
|
18654
18884
|
var manifest = {};
|
|
18655
18885
|
try {
|
|
18656
|
-
manifest = JSON.parse(
|
|
18886
|
+
manifest = JSON.parse(readFileSync12(manifestPath ?? "", "utf8"));
|
|
18657
18887
|
} catch {
|
|
18658
18888
|
}
|
|
18659
18889
|
process.stdout.write(show(fenced(buildIntroCard(manifest))));
|