@akasecurity/ai-tc-claude-code 0.9.5 → 0.9.7
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/package.json +7 -6
- package/scripts/apply-suppressions.js +1480 -974
- package/scripts/backfill.js +1589 -1023
- package/scripts/dashboard.js +131 -10
- package/scripts/filescan.js +1519 -1021
- package/scripts/firstrun.js +1358 -908
- package/scripts/intro.js +1048 -898
- package/scripts/message-display.js +1453 -980
- package/scripts/onboard.js +1378 -895
- package/scripts/post-tool-use.js +1575 -1009
- package/scripts/pre-tool-use.js +1580 -1014
- package/scripts/query.js +1420 -965
- package/scripts/reconcile.js +1538 -1013
- package/scripts/remediate.js +1585 -1019
- package/scripts/scan-worker.js +1056 -927
- package/scripts/session-start.js +1499 -1014
- package/scripts/start-light.js +1058 -909
- package/scripts/statusline.js +1357 -907
- package/scripts/stop.js +1113 -898
- package/scripts/user-prompt-submit.js +1791 -1207
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 readFileSync11 } 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,366 +15854,122 @@ 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
|
-
var AssetGroup = external_exports.object({
|
|
15958
|
-
/** Group key — never project (enforced at service layer). */
|
|
15959
|
-
type: AssetType,
|
|
15960
|
-
total: external_exports.number().int().nonnegative(),
|
|
15961
|
-
/**
|
|
15962
|
-
* MCP group only — omitted for all other types.
|
|
15963
|
-
* Partial: only TrustLevel keys with non-zero counts are included.
|
|
15964
|
-
* Strict: unknown keys are rejected — only TrustLevel values are valid keys.
|
|
15965
|
-
*/
|
|
15966
|
-
trustRollup: external_exports.object({
|
|
15967
|
-
"known-good": external_exports.number().int().nonnegative(),
|
|
15968
|
-
risky: external_exports.number().int().nonnegative(),
|
|
15969
|
-
unapproved: external_exports.number().int().nonnegative()
|
|
15970
|
-
}).partial().strict().optional(),
|
|
15971
|
-
/**
|
|
15972
|
-
* Partial: only Flag keys with non-zero counts are included.
|
|
15973
|
-
* Strict: unknown keys are rejected — only Flag values are valid keys.
|
|
15974
|
-
*/
|
|
15975
|
-
flagRollup: external_exports.object({
|
|
15976
|
-
update: external_exports.number().int().nonnegative(),
|
|
15977
|
-
stale: external_exports.number().int().nonnegative(),
|
|
15978
|
-
conflict: external_exports.number().int().nonnegative(),
|
|
15979
|
-
unknown: external_exports.number().int().nonnegative(),
|
|
15980
|
-
change: external_exports.number().int().nonnegative(),
|
|
15981
|
-
untracked: external_exports.number().int().nonnegative(),
|
|
15982
|
-
risk: external_exports.number().int().nonnegative(),
|
|
15983
|
-
findings: external_exports.number().int().nonnegative()
|
|
15984
|
-
}).partial().strict(),
|
|
15985
|
-
items: external_exports.array(AssetSummary)
|
|
15986
|
-
}).meta({ id: "AssetGroup" });
|
|
15987
|
-
var ListAssetsResponse = external_exports.object({ groups: external_exports.array(AssetGroup) }).meta({ id: "ListAssetsResponse" });
|
|
15988
|
-
var McpTool = external_exports.object({
|
|
15989
|
-
name: external_exports.string(),
|
|
15990
|
-
signature: external_exports.string(),
|
|
15991
|
-
description: external_exports.string(),
|
|
15992
|
-
write: external_exports.boolean(),
|
|
15993
|
-
/** Non-null string when tool is dangerous / blocked; null otherwise. */
|
|
15994
|
-
risk: external_exports.string().nullable()
|
|
15995
|
-
}).meta({ id: "McpTool" });
|
|
15996
|
-
var AssetFindingRef = external_exports.object({
|
|
15997
|
-
id: external_exports.string(),
|
|
15998
|
-
title: external_exports.string(),
|
|
15999
|
-
note: external_exports.string()
|
|
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()
|
|
16000
15888
|
});
|
|
16001
|
-
var
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
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()
|
|
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()
|
|
16118
15920
|
});
|
|
16119
|
-
var
|
|
16120
|
-
|
|
16121
|
-
|
|
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()
|
|
16122
15936
|
});
|
|
16123
|
-
var
|
|
16124
|
-
|
|
16125
|
-
|
|
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() }))
|
|
16126
15944
|
});
|
|
16127
|
-
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
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()
|
|
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)
|
|
16170
15955
|
});
|
|
16171
|
-
var
|
|
16172
|
-
|
|
16173
|
-
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
capability: true,
|
|
16177
|
-
expiresAt: true,
|
|
16178
|
-
maxUses: true,
|
|
16179
|
-
useCount: true,
|
|
16180
|
-
conditions: true
|
|
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()
|
|
16181
15961
|
});
|
|
16182
|
-
|
|
15962
|
+
|
|
15963
|
+
// ../../packages/schema/src/zod/registry.ts
|
|
15964
|
+
var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
15965
|
+
var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
15966
|
+
var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
|
|
15967
|
+
var PublisherKind = external_exports.enum(["labs", "user", "org"]);
|
|
16183
15968
|
|
|
16184
15969
|
// ../../packages/schema/src/zod/rule.ts
|
|
16185
|
-
var MatcherType = external_exports.enum(["keyword", "regex"
|
|
15970
|
+
var MatcherType = external_exports.enum(["keyword", "regex"]).meta({ id: "MatcherType" });
|
|
16186
15971
|
var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
|
|
16187
|
-
var KeywordMatcher = external_exports.
|
|
15972
|
+
var KeywordMatcher = external_exports.strictObject({
|
|
16188
15973
|
type: external_exports.literal("keyword"),
|
|
16189
15974
|
// An empty keyword matches at every position, yielding one zero-length span
|
|
16190
15975
|
// per character. Rejected here because a keyword that matches everything is
|
|
@@ -16200,16 +15985,31 @@ function isValidRegex(pattern, flags) {
|
|
|
16200
15985
|
return false;
|
|
16201
15986
|
}
|
|
16202
15987
|
}
|
|
15988
|
+
function probeFlags(flags) {
|
|
15989
|
+
return flags.replace(/[gy]/g, "");
|
|
15990
|
+
}
|
|
16203
15991
|
function matchesEmptyString(pattern, flags) {
|
|
16204
15992
|
try {
|
|
16205
|
-
const re = new RegExp(pattern, flags
|
|
15993
|
+
const re = new RegExp(pattern, probeFlags(flags));
|
|
16206
15994
|
return re.exec("")?.[0].length === 0;
|
|
16207
15995
|
} catch {
|
|
16208
15996
|
return false;
|
|
16209
15997
|
}
|
|
16210
15998
|
}
|
|
15999
|
+
function spansWholeMatch(captureGroup) {
|
|
16000
|
+
return captureGroup === void 0 || captureGroup === 0;
|
|
16001
|
+
}
|
|
16002
|
+
function captureGroupCount(pattern, flags) {
|
|
16003
|
+
try {
|
|
16004
|
+
const probe = new RegExp(`${pattern}|`, probeFlags(flags));
|
|
16005
|
+
const result = probe.exec("");
|
|
16006
|
+
return result ? result.length - 1 : void 0;
|
|
16007
|
+
} catch {
|
|
16008
|
+
return void 0;
|
|
16009
|
+
}
|
|
16010
|
+
}
|
|
16211
16011
|
var MAX_PATTERN_LENGTH = 2e3;
|
|
16212
|
-
var RegexMatcher = external_exports.
|
|
16012
|
+
var RegexMatcher = external_exports.strictObject({
|
|
16213
16013
|
type: external_exports.literal("regex"),
|
|
16214
16014
|
pattern: external_exports.string().min(1).max(MAX_PATTERN_LENGTH),
|
|
16215
16015
|
flags: external_exports.string().default("gi"),
|
|
@@ -16217,28 +16017,47 @@ var RegexMatcher = external_exports.object({
|
|
|
16217
16017
|
}).refine((v) => isValidRegex(v.pattern, v.flags), {
|
|
16218
16018
|
message: "pattern/flags do not form a valid JavaScript regular expression",
|
|
16219
16019
|
path: ["pattern"]
|
|
16220
|
-
}).refine((v) => v.captureGroup
|
|
16020
|
+
}).refine((v) => !spansWholeMatch(v.captureGroup) || !matchesEmptyString(v.pattern, v.flags), {
|
|
16221
16021
|
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
16022
|
path: ["pattern"]
|
|
16023
|
+
}).superRefine((v, ctx) => {
|
|
16024
|
+
if (v.captureGroup === void 0) return;
|
|
16025
|
+
const groups = captureGroupCount(v.pattern, v.flags);
|
|
16026
|
+
if (groups === void 0 || v.captureGroup <= groups) return;
|
|
16027
|
+
ctx.addIssue({
|
|
16028
|
+
code: "custom",
|
|
16029
|
+
path: ["captureGroup"],
|
|
16030
|
+
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.`
|
|
16031
|
+
});
|
|
16223
16032
|
});
|
|
16224
|
-
var
|
|
16225
|
-
|
|
16226
|
-
|
|
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({
|
|
16033
|
+
var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, RegexMatcher]).meta({ id: "Matcher" });
|
|
16034
|
+
var MATCHER_TYPES = MatcherType.options;
|
|
16035
|
+
var AppliesTo = external_exports.strictObject({
|
|
16231
16036
|
// Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
|
|
16232
16037
|
extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1)
|
|
16233
16038
|
}).meta({ id: "AppliesTo" });
|
|
16234
|
-
var
|
|
16235
|
-
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16039
|
+
var PostValidatorName = external_exports.enum(["entropy", "luhn"]).meta({ id: "PostValidatorName" });
|
|
16040
|
+
var PostValidatorRef = external_exports.union(
|
|
16041
|
+
[
|
|
16042
|
+
PostValidatorName,
|
|
16043
|
+
external_exports.strictObject({
|
|
16044
|
+
name: PostValidatorName,
|
|
16045
|
+
config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
16046
|
+
})
|
|
16047
|
+
],
|
|
16048
|
+
{
|
|
16049
|
+
// A union reports one collapsed issue for every way its arms can fail, so
|
|
16050
|
+
// this has to describe the whole shape rather than just the name — it is
|
|
16051
|
+
// what an author sees for a misspelled name AND for a stray key in the
|
|
16052
|
+
// object form. The names come from the enum so the message cannot go
|
|
16053
|
+
// stale. Without it Zod says only "Invalid input", which is precisely the
|
|
16054
|
+
// no-feedback outcome this schema exists to remove.
|
|
16055
|
+
error: () => `not a valid post-validator: use a bare name (${PostValidatorName.options.map((name) => JSON.stringify(name)).join(
|
|
16056
|
+
" or "
|
|
16057
|
+
)}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`
|
|
16058
|
+
}
|
|
16059
|
+
).meta({ id: "PostValidatorRef" });
|
|
16060
|
+
var RequiresNearby = external_exports.strictObject({
|
|
16242
16061
|
// Each array, when present, must be non-empty and contain non-empty strings —
|
|
16243
16062
|
// an empty/blank criterion would either never fire or (for labels) match
|
|
16244
16063
|
// everything.
|
|
@@ -16253,16 +16072,23 @@ var RequiresNearby = external_exports.object({
|
|
|
16253
16072
|
(v) => (v.categories?.length ?? 0) + (v.ruleIds?.length ?? 0) + (v.labels?.length ?? 0) > 0,
|
|
16254
16073
|
{ message: "requiresNearby needs at least one of categories, ruleIds, or labels" }
|
|
16255
16074
|
).meta({ id: "RequiresNearby" });
|
|
16256
|
-
var RuleFixture = external_exports.
|
|
16075
|
+
var RuleFixture = external_exports.strictObject({
|
|
16257
16076
|
label: external_exports.string(),
|
|
16258
16077
|
text: external_exports.string().max(5e4),
|
|
16259
16078
|
shouldMatch: external_exports.boolean(),
|
|
16260
16079
|
// Simulated file context for the scan, so fixtures can assert `appliesTo`
|
|
16261
16080
|
// gating (e.g. a Python-only pattern must NOT fire in a .ts file).
|
|
16262
16081
|
filePath: external_exports.string().optional(),
|
|
16263
|
-
expectedSpans: external_exports.array(external_exports.
|
|
16082
|
+
expectedSpans: external_exports.array(external_exports.strictObject({ start: external_exports.number(), end: external_exports.number() })).optional()
|
|
16264
16083
|
}).meta({ id: "RuleFixture" });
|
|
16265
|
-
var Rule = external_exports.
|
|
16084
|
+
var Rule = external_exports.strictObject({
|
|
16085
|
+
// A pinned literal over a STRICT object, and the two together decide how this
|
|
16086
|
+
// format may grow. A rule carrying a key not listed below is refused with
|
|
16087
|
+
// `unrecognized_keys`; a rule declaring `specVersion: 2` is refused with
|
|
16088
|
+
// `invalid_value`. So the only additive path is adding an OPTIONAL field here
|
|
16089
|
+
// — that keeps every rule authored before it valid — and a rule author has no
|
|
16090
|
+
// way to introduce a field of their own or to opt into a later version.
|
|
16091
|
+
// Widening the format means changing this literal and every consumer of it.
|
|
16266
16092
|
specVersion: external_exports.literal(1),
|
|
16267
16093
|
// `packId/ruleName` (e.g. `secrets/aws-access-key`). NOTE the first segment is
|
|
16268
16094
|
// the PACK id, NOT a namespace — this is a DIFFERENT slug space from a
|
|
@@ -16298,287 +16124,6 @@ var PackManifest = external_exports.object({
|
|
|
16298
16124
|
sourceUrl: external_exports.url().optional()
|
|
16299
16125
|
}).meta({ id: "PackManifest" });
|
|
16300
16126
|
|
|
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()
|
|
16574
|
-
});
|
|
16575
|
-
|
|
16576
|
-
// ../../packages/schema/src/zod/registry.ts
|
|
16577
|
-
var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
16578
|
-
var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
16579
|
-
var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
|
|
16580
|
-
var PublisherKind = external_exports.enum(["labs", "user", "org"]);
|
|
16581
|
-
|
|
16582
16127
|
// ../../packages/schema/src/zod/detection.ts
|
|
16583
16128
|
var OriginEnum = external_exports.enum(["library"]).meta({ id: "OriginEnum" });
|
|
16584
16129
|
var DetectionFilterEnum = external_exports.enum(["all", "library", "custom", "customized", "updates"]);
|
|
@@ -16623,81 +16168,306 @@ var ListDetectionsQuery = external_exports.object({
|
|
|
16623
16168
|
filter: DetectionFilterEnum.optional().default("all"),
|
|
16624
16169
|
q: external_exports.string().optional()
|
|
16625
16170
|
});
|
|
16626
|
-
var DetectionStats = external_exports.object({
|
|
16627
|
-
detections: external_exports.number().int().nonnegative(),
|
|
16628
|
-
rules: external_exports.number().int().nonnegative(),
|
|
16629
|
-
active: external_exports.number().int().nonnegative(),
|
|
16630
|
-
findingsLast30d: external_exports.number().int().nonnegative()
|
|
16631
|
-
}).meta({ id: "DetectionStats" });
|
|
16632
|
-
var DetectionRule = external_exports.object({
|
|
16633
|
-
id: external_exports.string(),
|
|
16634
|
-
name: external_exports.string(),
|
|
16635
|
-
category: DetectionCategory,
|
|
16636
|
-
severity: Severity,
|
|
16637
|
-
matcher: Matcher
|
|
16638
|
-
}).meta({ id: "DetectionRule" });
|
|
16639
|
-
var DetectionUpdate = external_exports.object({
|
|
16640
|
-
available: external_exports.boolean(),
|
|
16641
|
-
latestVersion: SemVer,
|
|
16642
|
-
// Rule count of the latest snapshot. Lets the update UI show a meaningful
|
|
16643
|
-
// delta ("2 rules → 14 rules") when the version did NOT change but the rule
|
|
16644
|
-
// content did — the OSS store compares content, not just version. Optional:
|
|
16645
|
-
// registry-backed updates omit it.
|
|
16646
|
-
latestRuleCount: external_exports.number().int().nonnegative().optional()
|
|
16647
|
-
}).nullable().meta({ id: "DetectionUpdate" });
|
|
16648
|
-
var DetectionDetail = external_exports.object({
|
|
16649
|
-
id: external_exports.string(),
|
|
16650
|
-
name: external_exports.string(),
|
|
16651
|
-
version: SemVer,
|
|
16652
|
-
enabled: external_exports.boolean(),
|
|
16653
|
-
origin: OriginEnum,
|
|
16654
|
-
publisher: Namespace.optional(),
|
|
16655
|
-
publisherKind: PublisherKind.optional(),
|
|
16656
|
-
ruleCount: external_exports.number().int().nonnegative(),
|
|
16657
|
-
namespace: Namespace,
|
|
16658
|
-
packId: PackId,
|
|
16659
|
-
description: external_exports.string().optional(),
|
|
16660
|
-
editedAt: external_exports.iso.datetime(),
|
|
16661
|
-
findingsLast30d: external_exports.number().int().nonnegative(),
|
|
16662
|
-
latestVersion: SemVer.nullable().optional(),
|
|
16663
|
-
update: DetectionUpdate,
|
|
16664
|
-
rules: external_exports.array(DetectionRule),
|
|
16665
|
-
modified: external_exports.boolean(),
|
|
16666
|
-
// Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
|
|
16667
|
-
// (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
|
|
16668
|
-
// detection is a PACK, and its policy is the archetype applied to all its
|
|
16669
|
-
// rules. Absent == unassigned, which resolves to Monitor everywhere
|
|
16670
|
-
// (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
|
|
16671
|
-
// per-rule policies (see policyIdToAction). Typed z.string() (not
|
|
16672
|
-
// the enum) to keep the OpenAPI response tolerant of a future custom id.
|
|
16673
|
-
policyId: external_exports.string().optional()
|
|
16674
|
-
}).meta({ id: "DetectionDetail" });
|
|
16675
|
-
var LibraryItem = external_exports.object({
|
|
16676
|
-
id: external_exports.string(),
|
|
16677
|
-
name: external_exports.string(),
|
|
16678
|
-
publisher: Namespace,
|
|
16679
|
-
publisherKind: PublisherKind.optional(),
|
|
16680
|
-
// LOSSY single-category view of a pack. A pack MAY span several categories;
|
|
16681
|
-
// this carries only the canonical-first one for display. Do NOT filter/facet
|
|
16682
|
-
// on it — the library filter matches a pack's full category set (see
|
|
16683
|
-
// ListLibraryResponse.categories).
|
|
16684
|
-
category: DetectionCategory.optional(),
|
|
16685
|
-
version: SemVer,
|
|
16686
|
-
ruleCount: external_exports.number().int().nonnegative(),
|
|
16687
|
-
description: external_exports.string().optional(),
|
|
16688
|
-
updatedAt: external_exports.iso.datetime(),
|
|
16689
|
-
state: LibraryStateEnum,
|
|
16690
|
-
importedAs: external_exports.string().nullable()
|
|
16691
|
-
}).meta({ id: "LibraryItem" });
|
|
16692
|
-
var ListLibraryResponse = external_exports.object({
|
|
16693
|
-
categories: external_exports.array(DetectionCategory),
|
|
16694
|
-
items: external_exports.array(LibraryItem)
|
|
16695
|
-
}).meta({ id: "ListLibraryResponse" });
|
|
16696
|
-
var ImportDetectionRequest = external_exports.object({
|
|
16697
|
-
libraryId: external_exports.string().refine((v) => /^[^/]+\/[^/]+$/.test(v), {
|
|
16698
|
-
message: "libraryId must be in namespace/packId format"
|
|
16699
|
-
})
|
|
16700
|
-
}).meta({ id: "ImportDetectionRequest" });
|
|
16171
|
+
var DetectionStats = external_exports.object({
|
|
16172
|
+
detections: external_exports.number().int().nonnegative(),
|
|
16173
|
+
rules: external_exports.number().int().nonnegative(),
|
|
16174
|
+
active: external_exports.number().int().nonnegative(),
|
|
16175
|
+
findingsLast30d: external_exports.number().int().nonnegative()
|
|
16176
|
+
}).meta({ id: "DetectionStats" });
|
|
16177
|
+
var DetectionRule = external_exports.object({
|
|
16178
|
+
id: external_exports.string(),
|
|
16179
|
+
name: external_exports.string(),
|
|
16180
|
+
category: DetectionCategory,
|
|
16181
|
+
severity: Severity,
|
|
16182
|
+
matcher: Matcher
|
|
16183
|
+
}).meta({ id: "DetectionRule" });
|
|
16184
|
+
var DetectionUpdate = external_exports.object({
|
|
16185
|
+
available: external_exports.boolean(),
|
|
16186
|
+
latestVersion: SemVer,
|
|
16187
|
+
// Rule count of the latest snapshot. Lets the update UI show a meaningful
|
|
16188
|
+
// delta ("2 rules → 14 rules") when the version did NOT change but the rule
|
|
16189
|
+
// content did — the OSS store compares content, not just version. Optional:
|
|
16190
|
+
// registry-backed updates omit it.
|
|
16191
|
+
latestRuleCount: external_exports.number().int().nonnegative().optional()
|
|
16192
|
+
}).nullable().meta({ id: "DetectionUpdate" });
|
|
16193
|
+
var DetectionDetail = external_exports.object({
|
|
16194
|
+
id: external_exports.string(),
|
|
16195
|
+
name: external_exports.string(),
|
|
16196
|
+
version: SemVer,
|
|
16197
|
+
enabled: external_exports.boolean(),
|
|
16198
|
+
origin: OriginEnum,
|
|
16199
|
+
publisher: Namespace.optional(),
|
|
16200
|
+
publisherKind: PublisherKind.optional(),
|
|
16201
|
+
ruleCount: external_exports.number().int().nonnegative(),
|
|
16202
|
+
namespace: Namespace,
|
|
16203
|
+
packId: PackId,
|
|
16204
|
+
description: external_exports.string().optional(),
|
|
16205
|
+
editedAt: external_exports.iso.datetime(),
|
|
16206
|
+
findingsLast30d: external_exports.number().int().nonnegative(),
|
|
16207
|
+
latestVersion: SemVer.nullable().optional(),
|
|
16208
|
+
update: DetectionUpdate,
|
|
16209
|
+
rules: external_exports.array(DetectionRule),
|
|
16210
|
+
modified: external_exports.boolean(),
|
|
16211
|
+
// Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
|
|
16212
|
+
// (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
|
|
16213
|
+
// detection is a PACK, and its policy is the archetype applied to all its
|
|
16214
|
+
// rules. Absent == unassigned, which resolves to Monitor everywhere
|
|
16215
|
+
// (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
|
|
16216
|
+
// per-rule policies (see policyIdToAction). Typed z.string() (not
|
|
16217
|
+
// the enum) to keep the OpenAPI response tolerant of a future custom id.
|
|
16218
|
+
policyId: external_exports.string().optional()
|
|
16219
|
+
}).meta({ id: "DetectionDetail" });
|
|
16220
|
+
var LibraryItem = external_exports.object({
|
|
16221
|
+
id: external_exports.string(),
|
|
16222
|
+
name: external_exports.string(),
|
|
16223
|
+
publisher: Namespace,
|
|
16224
|
+
publisherKind: PublisherKind.optional(),
|
|
16225
|
+
// LOSSY single-category view of a pack. A pack MAY span several categories;
|
|
16226
|
+
// this carries only the canonical-first one for display. Do NOT filter/facet
|
|
16227
|
+
// on it — the library filter matches a pack's full category set (see
|
|
16228
|
+
// ListLibraryResponse.categories).
|
|
16229
|
+
category: DetectionCategory.optional(),
|
|
16230
|
+
version: SemVer,
|
|
16231
|
+
ruleCount: external_exports.number().int().nonnegative(),
|
|
16232
|
+
description: external_exports.string().optional(),
|
|
16233
|
+
updatedAt: external_exports.iso.datetime(),
|
|
16234
|
+
state: LibraryStateEnum,
|
|
16235
|
+
importedAs: external_exports.string().nullable()
|
|
16236
|
+
}).meta({ id: "LibraryItem" });
|
|
16237
|
+
var ListLibraryResponse = external_exports.object({
|
|
16238
|
+
categories: external_exports.array(DetectionCategory),
|
|
16239
|
+
items: external_exports.array(LibraryItem)
|
|
16240
|
+
}).meta({ id: "ListLibraryResponse" });
|
|
16241
|
+
var ImportDetectionRequest = external_exports.object({
|
|
16242
|
+
libraryId: external_exports.string().refine((v) => /^[^/]+\/[^/]+$/.test(v), {
|
|
16243
|
+
message: "libraryId must be in namespace/packId format"
|
|
16244
|
+
})
|
|
16245
|
+
}).meta({ id: "ImportDetectionRequest" });
|
|
16246
|
+
|
|
16247
|
+
// ../../packages/schema/src/zod/inventory.ts
|
|
16248
|
+
var AssetType = external_exports.enum(["project", "skill", "mcp", "hook", "config"]).meta({ id: "AssetType" });
|
|
16249
|
+
var AccessLevel = external_exports.enum(["open", "approved", "blocked"]).meta({ id: "AccessLevel" });
|
|
16250
|
+
var Origin = external_exports.enum(["source", "public-dep", "vendored", "config", "data", "docs", "generated"]).meta({ id: "Origin" });
|
|
16251
|
+
var TrustLevel = external_exports.enum(["known-good", "risky", "unapproved"]).meta({ id: "TrustLevel" });
|
|
16252
|
+
var Flag = external_exports.enum(["update", "stale", "conflict", "unknown", "change", "untracked", "risk", "findings"]).meta({ id: "Flag" });
|
|
16253
|
+
var Visibility = external_exports.enum(["public", "private"]).meta({ id: "Visibility" });
|
|
16254
|
+
var HarnessEventKind = external_exports.enum(["block", "redact", "warn"]).meta({ id: "HarnessEventKind" });
|
|
16255
|
+
var HarnessId = Harness.extract(["ClaudeCode", "Cursor", "Codex", "Antigravity"]).meta({
|
|
16256
|
+
id: "HarnessId"
|
|
16257
|
+
});
|
|
16258
|
+
var AccessCounts = external_exports.object({
|
|
16259
|
+
open: external_exports.number().int().nonnegative(),
|
|
16260
|
+
approved: external_exports.number().int().nonnegative(),
|
|
16261
|
+
blocked: external_exports.number().int().nonnegative(),
|
|
16262
|
+
total: external_exports.number().int().nonnegative()
|
|
16263
|
+
}).meta({ id: "AccessCounts" });
|
|
16264
|
+
var AssetSummary = external_exports.object({
|
|
16265
|
+
id: external_exports.string(),
|
|
16266
|
+
type: AssetType,
|
|
16267
|
+
name: external_exports.string(),
|
|
16268
|
+
sub: external_exports.string(),
|
|
16269
|
+
flags: external_exports.array(Flag),
|
|
16270
|
+
/** MCP servers only — omitted for all other types. */
|
|
16271
|
+
trust: TrustLevel.optional()
|
|
16272
|
+
}).meta({ id: "AssetSummary" });
|
|
16273
|
+
var ProjectSummary = external_exports.object({
|
|
16274
|
+
id: external_exports.string(),
|
|
16275
|
+
name: external_exports.string(),
|
|
16276
|
+
repo: external_exports.string(),
|
|
16277
|
+
visibility: Visibility,
|
|
16278
|
+
language: external_exports.string(),
|
|
16279
|
+
policyDefault: AccessLevel,
|
|
16280
|
+
updatedAt: external_exports.iso.datetime(),
|
|
16281
|
+
accessCounts: AccessCounts,
|
|
16282
|
+
findingsCount: external_exports.number().int().nonnegative()
|
|
16283
|
+
}).meta({ id: "ProjectSummary" });
|
|
16284
|
+
var HarnessCategory = external_exports.object({
|
|
16285
|
+
/** One of config/skill/mcp/hook — never project (enforced at service layer). */
|
|
16286
|
+
type: AssetType,
|
|
16287
|
+
assets: external_exports.array(AssetSummary)
|
|
16288
|
+
});
|
|
16289
|
+
var HarnessSummary = external_exports.object({
|
|
16290
|
+
id: HarnessId,
|
|
16291
|
+
label: external_exports.string(),
|
|
16292
|
+
kind: external_exports.string(),
|
|
16293
|
+
version: external_exports.string(),
|
|
16294
|
+
sessions: external_exports.number().int().nonnegative(),
|
|
16295
|
+
assetCount: external_exports.number().int().nonnegative(),
|
|
16296
|
+
flagCount: external_exports.number().int().nonnegative(),
|
|
16297
|
+
projects: external_exports.array(ProjectSummary),
|
|
16298
|
+
categories: external_exports.array(HarnessCategory)
|
|
16299
|
+
}).meta({ id: "HarnessSummary" });
|
|
16300
|
+
var ListHarnessesResponse = external_exports.object({ items: external_exports.array(HarnessSummary) }).meta({ id: "ListHarnessesResponse" });
|
|
16301
|
+
var AssetGroup = external_exports.object({
|
|
16302
|
+
/** Group key — never project (enforced at service layer). */
|
|
16303
|
+
type: AssetType,
|
|
16304
|
+
total: external_exports.number().int().nonnegative(),
|
|
16305
|
+
/**
|
|
16306
|
+
* MCP group only — omitted for all other types.
|
|
16307
|
+
* Partial: only TrustLevel keys with non-zero counts are included.
|
|
16308
|
+
* Strict: unknown keys are rejected — only TrustLevel values are valid keys.
|
|
16309
|
+
*/
|
|
16310
|
+
trustRollup: external_exports.object({
|
|
16311
|
+
"known-good": external_exports.number().int().nonnegative(),
|
|
16312
|
+
risky: external_exports.number().int().nonnegative(),
|
|
16313
|
+
unapproved: external_exports.number().int().nonnegative()
|
|
16314
|
+
}).partial().strict().optional(),
|
|
16315
|
+
/**
|
|
16316
|
+
* Partial: only Flag keys with non-zero counts are included.
|
|
16317
|
+
* Strict: unknown keys are rejected — only Flag values are valid keys.
|
|
16318
|
+
*/
|
|
16319
|
+
flagRollup: external_exports.object({
|
|
16320
|
+
update: external_exports.number().int().nonnegative(),
|
|
16321
|
+
stale: external_exports.number().int().nonnegative(),
|
|
16322
|
+
conflict: external_exports.number().int().nonnegative(),
|
|
16323
|
+
unknown: external_exports.number().int().nonnegative(),
|
|
16324
|
+
change: external_exports.number().int().nonnegative(),
|
|
16325
|
+
untracked: external_exports.number().int().nonnegative(),
|
|
16326
|
+
risk: external_exports.number().int().nonnegative(),
|
|
16327
|
+
findings: external_exports.number().int().nonnegative()
|
|
16328
|
+
}).partial().strict(),
|
|
16329
|
+
items: external_exports.array(AssetSummary)
|
|
16330
|
+
}).meta({ id: "AssetGroup" });
|
|
16331
|
+
var ListAssetsResponse = external_exports.object({ groups: external_exports.array(AssetGroup) }).meta({ id: "ListAssetsResponse" });
|
|
16332
|
+
var McpTool = external_exports.object({
|
|
16333
|
+
name: external_exports.string(),
|
|
16334
|
+
signature: external_exports.string(),
|
|
16335
|
+
description: external_exports.string(),
|
|
16336
|
+
write: external_exports.boolean(),
|
|
16337
|
+
/** Non-null string when tool is dangerous / blocked; null otherwise. */
|
|
16338
|
+
risk: external_exports.string().nullable()
|
|
16339
|
+
}).meta({ id: "McpTool" });
|
|
16340
|
+
var AssetFindingRef = external_exports.object({
|
|
16341
|
+
id: external_exports.string(),
|
|
16342
|
+
title: external_exports.string(),
|
|
16343
|
+
note: external_exports.string()
|
|
16344
|
+
});
|
|
16345
|
+
var AssetDetail = AssetSummary.extend({
|
|
16346
|
+
/** string | null — null when no description is available. */
|
|
16347
|
+
description: external_exports.string().nullable(),
|
|
16348
|
+
/** trustLevel | null — null for non-MCP assets. */
|
|
16349
|
+
trust: TrustLevel.nullable(),
|
|
16350
|
+
/** Type-specific raw key/values — FE renders the grid. */
|
|
16351
|
+
meta: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
16352
|
+
/** always present — object when there is an active finding, null when absent. */
|
|
16353
|
+
finding: AssetFindingRef.nullable(),
|
|
16354
|
+
/** MCP exposed-tools list — omitted for non-mcp. */
|
|
16355
|
+
tools: external_exports.array(McpTool).optional()
|
|
16356
|
+
}).meta({ id: "AssetDetail" });
|
|
16357
|
+
var ListProjectsResponse = external_exports.object({ items: external_exports.array(ProjectSummary) }).meta({ id: "ListProjectsResponse" });
|
|
16358
|
+
var InventoryStats = external_exports.object({
|
|
16359
|
+
/** Total assets/projects with ≥1 flag or finding (drives the attention header chip). */
|
|
16360
|
+
attention: external_exports.number().int().nonnegative(),
|
|
16361
|
+
byType: external_exports.object({
|
|
16362
|
+
project: external_exports.number().int().nonnegative(),
|
|
16363
|
+
skill: external_exports.number().int().nonnegative(),
|
|
16364
|
+
mcp: external_exports.number().int().nonnegative(),
|
|
16365
|
+
hook: external_exports.number().int().nonnegative(),
|
|
16366
|
+
config: external_exports.number().int().nonnegative()
|
|
16367
|
+
}),
|
|
16368
|
+
harnesses: external_exports.number().int().nonnegative(),
|
|
16369
|
+
mcpTrust: external_exports.object({
|
|
16370
|
+
"known-good": external_exports.number().int().nonnegative(),
|
|
16371
|
+
risky: external_exports.number().int().nonnegative(),
|
|
16372
|
+
unapproved: external_exports.number().int().nonnegative()
|
|
16373
|
+
})
|
|
16374
|
+
}).meta({ id: "InventoryStats" });
|
|
16375
|
+
var FileSummary = external_exports.object({
|
|
16376
|
+
path: external_exports.string(),
|
|
16377
|
+
name: external_exports.string(),
|
|
16378
|
+
origin: Origin,
|
|
16379
|
+
/** Effective access (override applied). */
|
|
16380
|
+
access: AccessLevel,
|
|
16381
|
+
/** True when a file_access_override differs from the computed default. */
|
|
16382
|
+
isCustom: external_exports.boolean(),
|
|
16383
|
+
findings: external_exports.number().int().nonnegative(),
|
|
16384
|
+
/** When the file was auto-blocked by a detection; null when not blocked. */
|
|
16385
|
+
blockedAt: external_exports.iso.datetime().nullable().optional(),
|
|
16386
|
+
/** Why the file was blocked; null when absent. */
|
|
16387
|
+
note: external_exports.string().nullable().optional()
|
|
16388
|
+
}).meta({ id: "FileSummary" });
|
|
16389
|
+
var FolderSummary = external_exports.object({
|
|
16390
|
+
name: external_exports.string(),
|
|
16391
|
+
path: external_exports.string(),
|
|
16392
|
+
/** Rollup of effective access across all descendants. */
|
|
16393
|
+
accessCounts: AccessCounts
|
|
16394
|
+
}).meta({ id: "FolderSummary" });
|
|
16395
|
+
var ProjectTreeResponse = external_exports.object({
|
|
16396
|
+
project: external_exports.object({
|
|
16397
|
+
id: external_exports.string(),
|
|
16398
|
+
repo: external_exports.string(),
|
|
16399
|
+
visibility: Visibility
|
|
16400
|
+
}),
|
|
16401
|
+
path: external_exports.string(),
|
|
16402
|
+
/** Browse mode: one-level folders at the current path. Omitted in search mode. */
|
|
16403
|
+
folders: external_exports.array(FolderSummary).optional(),
|
|
16404
|
+
files: external_exports.array(FileSummary)
|
|
16405
|
+
}).meta({ id: "ProjectTreeResponse" });
|
|
16406
|
+
var FileDetail = FileSummary.extend({
|
|
16407
|
+
project: external_exports.object({
|
|
16408
|
+
repo: external_exports.string(),
|
|
16409
|
+
visibility: Visibility,
|
|
16410
|
+
language: external_exports.string(),
|
|
16411
|
+
policyDefault: AccessLevel,
|
|
16412
|
+
updatedAt: external_exports.iso.datetime()
|
|
16413
|
+
}),
|
|
16414
|
+
findingsRefs: external_exports.array(external_exports.object({ id: external_exports.string(), title: external_exports.string() }))
|
|
16415
|
+
}).meta({ id: "FileDetail" });
|
|
16416
|
+
var SetFileAccessBody = external_exports.object({
|
|
16417
|
+
path: external_exports.string(),
|
|
16418
|
+
access: AccessLevel
|
|
16419
|
+
}).meta({ id: "SetFileAccessBody" });
|
|
16420
|
+
var SetFileAccessResponse = external_exports.object({
|
|
16421
|
+
file: FileSummary,
|
|
16422
|
+
accessCounts: AccessCounts
|
|
16423
|
+
}).meta({ id: "SetFileAccessResponse" });
|
|
16424
|
+
var SetMcpTrustBody = external_exports.object({ trust: TrustLevel }).meta({ id: "SetMcpTrustBody" });
|
|
16425
|
+
var HarnessEventItem = external_exports.object({
|
|
16426
|
+
kind: HarnessEventKind,
|
|
16427
|
+
title: external_exports.string(),
|
|
16428
|
+
detail: external_exports.string(),
|
|
16429
|
+
occurredAt: external_exports.iso.datetime(),
|
|
16430
|
+
findingId: external_exports.string().nullable().optional()
|
|
16431
|
+
}).meta({ id: "HarnessEventItem" });
|
|
16432
|
+
var HarnessEventsResponse = external_exports.object({
|
|
16433
|
+
counts: external_exports.object({
|
|
16434
|
+
block: external_exports.number().int().nonnegative(),
|
|
16435
|
+
redact: external_exports.number().int().nonnegative(),
|
|
16436
|
+
warn: external_exports.number().int().nonnegative()
|
|
16437
|
+
}),
|
|
16438
|
+
items: external_exports.array(HarnessEventItem)
|
|
16439
|
+
}).meta({ id: "HarnessEventsResponse" });
|
|
16440
|
+
var RescanResponse = external_exports.object({
|
|
16441
|
+
jobId: external_exports.string(),
|
|
16442
|
+
startedAt: external_exports.iso.datetime()
|
|
16443
|
+
}).meta({ id: "RescanResponse" });
|
|
16444
|
+
var ConnectProjectBody = external_exports.object({ repo: external_exports.string() }).meta({ id: "ConnectProjectBody" });
|
|
16445
|
+
var ListAssetsQuery = external_exports.object({
|
|
16446
|
+
/** Filter by one or more AssetType values; absent means all types. */
|
|
16447
|
+
type: external_exports.array(AssetType).optional(),
|
|
16448
|
+
/** Free-text search term. */
|
|
16449
|
+
q: external_exports.string().optional()
|
|
16450
|
+
});
|
|
16451
|
+
var GetProjectTreeQuery = external_exports.object({
|
|
16452
|
+
/** Subtree root path; defaults to repository root when absent. */
|
|
16453
|
+
path: external_exports.string().optional(),
|
|
16454
|
+
/** Free-text filter applied to file paths. */
|
|
16455
|
+
q: external_exports.string().optional(),
|
|
16456
|
+
/**
|
|
16457
|
+
* Special listing mode. `blocked` returns every effectively-blocked, auto-blocked
|
|
16458
|
+
* file across the whole repo (folders omitted, most-recent first), ignoring
|
|
16459
|
+
* `path`/`q` — powers the project-wide "recently blocked" strip.
|
|
16460
|
+
*/
|
|
16461
|
+
filter: external_exports.enum(["blocked"]).optional()
|
|
16462
|
+
});
|
|
16463
|
+
var GetProjectFileQuery = external_exports.object({
|
|
16464
|
+
/** Repository-relative file path; absent or empty → 400. */
|
|
16465
|
+
path: external_exports.string()
|
|
16466
|
+
});
|
|
16467
|
+
var GetHarnessEventsQuery = external_exports.object({
|
|
16468
|
+
/** Maximum number of events to return. Range: 1–50; default: 7. */
|
|
16469
|
+
limit: external_exports.coerce.number().int().min(1).max(50).default(7)
|
|
16470
|
+
});
|
|
16701
16471
|
|
|
16702
16472
|
// ../../packages/schema/src/zod/shares.ts
|
|
16703
16473
|
var DestinationKind = external_exports.enum(["provider", "internal", "external", "ip"]).meta({ id: "DestinationKind" });
|
|
@@ -16833,77 +16603,198 @@ var ListShareDestinationsQuery = external_exports.object({
|
|
|
16833
16603
|
*/
|
|
16834
16604
|
review: external_exports.stringbool().default(false)
|
|
16835
16605
|
});
|
|
16836
|
-
var ExportSharesQuery = external_exports.object({
|
|
16837
|
-
format: external_exports.enum(["csv", "json"]).default("csv"),
|
|
16838
|
-
q: external_exports.string().optional(),
|
|
16839
|
-
kind: external_exports.array(DestinationKind).optional()
|
|
16606
|
+
var ExportSharesQuery = external_exports.object({
|
|
16607
|
+
format: external_exports.enum(["csv", "json"]).default("csv"),
|
|
16608
|
+
q: external_exports.string().optional(),
|
|
16609
|
+
kind: external_exports.array(DestinationKind).optional()
|
|
16610
|
+
});
|
|
16611
|
+
|
|
16612
|
+
// ../../packages/schema/src/zod/egress-extraction.ts
|
|
16613
|
+
var EgressEcosystem = external_exports.enum(["npm", "pypi", "go", "maven", "rubygems", "cargo", "composer", "nuget"]).meta({ id: "EgressEcosystem" });
|
|
16614
|
+
var ProviderRegistryEntry = external_exports.object({
|
|
16615
|
+
id: external_exports.string(),
|
|
16616
|
+
name: external_exports.string(),
|
|
16617
|
+
category: external_exports.string(),
|
|
16618
|
+
/** Suffix-matched: 'stripe.com' matches api.stripe.com, never evilstripe.com. */
|
|
16619
|
+
hostSuffixes: external_exports.array(external_exports.string()).min(1),
|
|
16620
|
+
/** Canonical API base URL recorded for manifest-derived (method 'SDK') endpoints. */
|
|
16621
|
+
apiBase: external_exports.string(),
|
|
16622
|
+
/** Most-sensitive first; index 0 becomes the endpoint dataClass. */
|
|
16623
|
+
defaultDataClasses: external_exports.array(DataClass).min(1),
|
|
16624
|
+
/** SDK identifiers per ecosystem ('go' prefix-matched by path, 'maven' by group-id prefix). */
|
|
16625
|
+
sdks: external_exports.partialRecord(EgressEcosystem, external_exports.array(external_exports.string()))
|
|
16626
|
+
}).meta({ id: "ProviderRegistryEntry" });
|
|
16627
|
+
var EgressCallSiteHit = external_exports.object({
|
|
16628
|
+
file: external_exports.string(),
|
|
16629
|
+
line: external_exports.number().int().positive(),
|
|
16630
|
+
snippet: external_exports.string(),
|
|
16631
|
+
dynamic: external_exports.boolean(),
|
|
16632
|
+
vendored: external_exports.boolean()
|
|
16633
|
+
}).meta({ id: "EgressCallSiteHit" });
|
|
16634
|
+
var ResolvedEgressHit = external_exports.object({
|
|
16635
|
+
host: external_exports.string(),
|
|
16636
|
+
kind: DestinationKind,
|
|
16637
|
+
name: external_exports.string(),
|
|
16638
|
+
category: external_exports.string(),
|
|
16639
|
+
trust: ShareTrustLevel,
|
|
16640
|
+
network: DestinationNetwork.nullable(),
|
|
16641
|
+
method: HttpMethod,
|
|
16642
|
+
transport: Transport,
|
|
16643
|
+
url: external_exports.string(),
|
|
16644
|
+
template: external_exports.boolean(),
|
|
16645
|
+
dataClass: DataClass,
|
|
16646
|
+
site: EgressCallSiteHit
|
|
16647
|
+
}).meta({ id: "ResolvedEgressHit" });
|
|
16648
|
+
var EgressReconcile = external_exports.discriminatedUnion("mode", [
|
|
16649
|
+
external_exports.object({ mode: external_exports.literal("walk"), walkedPrefix: external_exports.string() }),
|
|
16650
|
+
external_exports.object({
|
|
16651
|
+
mode: external_exports.literal("ledger"),
|
|
16652
|
+
scannedFiles: external_exports.array(external_exports.string()),
|
|
16653
|
+
deletedFiles: external_exports.array(external_exports.string())
|
|
16654
|
+
})
|
|
16655
|
+
]).meta({ id: "EgressReconcile" });
|
|
16656
|
+
var RecordProjectEgressInput = external_exports.object({
|
|
16657
|
+
/** Stable reconcile key: 'git:<repo identity>' or 'path:<abs root>' (non-git). */
|
|
16658
|
+
projectKey: external_exports.string().min(1),
|
|
16659
|
+
/** Display name only — never keys reconciliation. */
|
|
16660
|
+
project: external_exports.string(),
|
|
16661
|
+
projectId: external_exports.string().nullable(),
|
|
16662
|
+
reconcile: EgressReconcile,
|
|
16663
|
+
hits: external_exports.array(ResolvedEgressHit)
|
|
16664
|
+
}).meta({ id: "RecordProjectEgressInput" });
|
|
16665
|
+
var EgressWriteSummary = external_exports.object({
|
|
16666
|
+
destinations: external_exports.number().int().nonnegative(),
|
|
16667
|
+
endpoints: external_exports.number().int().nonnegative(),
|
|
16668
|
+
callSites: external_exports.number().int().nonnegative(),
|
|
16669
|
+
truncated: external_exports.boolean(),
|
|
16670
|
+
/**
|
|
16671
|
+
* Files the cap dropped whole. Their stored rows were left untouched, so a
|
|
16672
|
+
* ledger-keeping caller must withhold their ledger entries and read them
|
|
16673
|
+
* again next scan.
|
|
16674
|
+
*/
|
|
16675
|
+
droppedFiles: external_exports.array(external_exports.string()).default([])
|
|
16676
|
+
}).meta({ id: "EgressWriteSummary" });
|
|
16677
|
+
|
|
16678
|
+
// ../../packages/schema/src/zod/event.ts
|
|
16679
|
+
var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
|
|
16680
|
+
var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
|
|
16681
|
+
var EventMetadata = external_exports.object({
|
|
16682
|
+
sessionId: external_exports.string().optional(),
|
|
16683
|
+
repo: external_exports.string().optional(),
|
|
16684
|
+
filePath: external_exports.string().optional(),
|
|
16685
|
+
// The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
|
|
16686
|
+
// set by the tool-scanning hooks. The tool NAME only — never the tool's
|
|
16687
|
+
// arguments or output, which can carry the very value a finding masked
|
|
16688
|
+
// (metadata is stored unredacted). Gives findings on non-file captures a
|
|
16689
|
+
// display location ("via Bash") when no filePath exists.
|
|
16690
|
+
toolName: external_exports.string().optional(),
|
|
16691
|
+
// Set (true) by the worktree scanner when the file is excluded by the
|
|
16692
|
+
// repo's .gitignore. Gitignored files ARE still scanned — local scratch and
|
|
16693
|
+
// generated code can leak real secrets — but the provenance is recorded so
|
|
16694
|
+
// policy/dashboards can treat those findings as informational rather than
|
|
16695
|
+
// blocking. Omitted (not false) for tracked files and non-scan events.
|
|
16696
|
+
gitignored: external_exports.boolean().optional(),
|
|
16697
|
+
// Set (true) ONLY when the event's `content` is the COMPLETE file at
|
|
16698
|
+
// capture time (a worktree scan reading from disk). Hook-captured edits
|
|
16699
|
+
// (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
|
|
16700
|
+
// this. The resolver-on-ingest keys its fixed-at-source dropout
|
|
16701
|
+
// diff on this marker: only a whole-file snapshot can prove a previously
|
|
16702
|
+
// open finding is gone; a fragment's absence proves nothing (the secret
|
|
16703
|
+
// may live outside the hunk). Omitted (not false) for fragments and
|
|
16704
|
+
// non-scan events, so pre-marker clients safely default to the
|
|
16705
|
+
// non-authoritative path.
|
|
16706
|
+
wholeFile: external_exports.boolean().optional(),
|
|
16707
|
+
model: external_exports.string().optional(),
|
|
16708
|
+
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
16709
|
+
// Distributed-tracing correlation. `correlationId` ties a recorded event back
|
|
16710
|
+
// to the request that captured/ingested it (a UUID, generated independently of
|
|
16711
|
+
// the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
|
|
16712
|
+
// originating span when telemetry is enabled. Both optional + backward
|
|
16713
|
+
// compatible — populated by the plugin (see @akasecurity/plugin-sdk).
|
|
16714
|
+
correlationId: external_exports.uuid().optional(),
|
|
16715
|
+
traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
|
|
16716
|
+
// Ids of the detection exceptions that downgraded findings in this capture
|
|
16717
|
+
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
16718
|
+
// authorized the bypass. Absent on captures where no exception applied.
|
|
16719
|
+
exceptionIds: external_exports.array(external_exports.guid()).optional()
|
|
16720
|
+
}).meta({ id: "EventMetadata" });
|
|
16721
|
+
var Event = external_exports.object({
|
|
16722
|
+
id: external_exports.guid(),
|
|
16723
|
+
sourceTool: SourceTool,
|
|
16724
|
+
kind: EventKind,
|
|
16725
|
+
occurredAt: external_exports.iso.datetime(),
|
|
16726
|
+
contentHash: external_exports.string(),
|
|
16727
|
+
content: external_exports.string(),
|
|
16728
|
+
metadata: EventMetadata.optional()
|
|
16729
|
+
}).meta({ id: "Event" });
|
|
16730
|
+
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
16731
|
+
var IngestBatch = external_exports.object({
|
|
16732
|
+
events: external_exports.array(IngestEvent).min(1).max(100),
|
|
16733
|
+
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
16734
|
+
// additionally rejects any event whose contentHash the store has already
|
|
16735
|
+
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
16736
|
+
// backfill), where a re-run mints fresh event ids for identical content and
|
|
16737
|
+
// would otherwise accumulate duplicates. Live hook traffic must NOT set it:
|
|
16738
|
+
// two genuinely separate prompts can be byte-identical and both belong on
|
|
16739
|
+
// the timeline.
|
|
16740
|
+
dedupe: external_exports.literal("content-hash").optional()
|
|
16741
|
+
}).meta({ id: "IngestBatch" });
|
|
16742
|
+
|
|
16743
|
+
// ../../packages/schema/src/zod/exception.ts
|
|
16744
|
+
var ExceptionScope = external_exports.enum(["once", "temporary", "permanent"]);
|
|
16745
|
+
var ExceptionConditions = external_exports.object({
|
|
16746
|
+
repo: external_exports.string().optional(),
|
|
16747
|
+
sourceTool: external_exports.string().optional(),
|
|
16748
|
+
provider: external_exports.string().optional()
|
|
16749
|
+
}).strict();
|
|
16750
|
+
var ExceptionCapability = external_exports.enum(["suppress", "reveal_to_model"]);
|
|
16751
|
+
var DetectionException = external_exports.object({
|
|
16752
|
+
id: external_exports.guid(),
|
|
16753
|
+
ruleId: external_exports.string(),
|
|
16754
|
+
// Denormalized from the rule, for reporting — never matched on.
|
|
16755
|
+
category: DetectionCategory,
|
|
16756
|
+
// HMAC-SHA256 hex of the raw match under a machine-local key: a KEYED
|
|
16757
|
+
// fingerprint, never the raw value, and never reversible. Matching recomputes
|
|
16758
|
+
// the fingerprint from a fresh capture; the value itself is never stored.
|
|
16759
|
+
// Shape-constrained so a malformed — or accidentally raw — value is rejected
|
|
16760
|
+
// at the boundary rather than persisted.
|
|
16761
|
+
valueFingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
16762
|
+
// Version of the fingerprint key the grant was written under; a rotated key
|
|
16763
|
+
// invalidates old grants rather than silently mismatching them.
|
|
16764
|
+
keyVersion: external_exports.number().int().positive(),
|
|
16765
|
+
// maskMatch() preview of the approved value — never the raw value.
|
|
16766
|
+
maskedValue: external_exports.string(),
|
|
16767
|
+
capability: ExceptionCapability.default("suppress"),
|
|
16768
|
+
scope: ExceptionScope,
|
|
16769
|
+
expiresAt: external_exports.iso.datetime().nullable(),
|
|
16770
|
+
maxUses: external_exports.number().int().positive().nullable(),
|
|
16771
|
+
useCount: external_exports.number().int().nonnegative(),
|
|
16772
|
+
lastUsedAt: external_exports.iso.datetime().nullable(),
|
|
16773
|
+
// Mandatory: every grant carries the human reason it exists.
|
|
16774
|
+
justification: external_exports.string().min(1),
|
|
16775
|
+
conditions: ExceptionConditions.nullable(),
|
|
16776
|
+
createdBy: external_exports.string(),
|
|
16777
|
+
createdVia: external_exports.enum(["cli-approve", "cli-add", "web-approve", "web-add", "api", "setup-triage"]),
|
|
16778
|
+
createdAt: external_exports.iso.datetime(),
|
|
16779
|
+
updatedAt: external_exports.iso.datetime(),
|
|
16780
|
+
// Revocation is terminal and retained — consumed/expired/revoked rows are
|
|
16781
|
+
// audit evidence; nothing in the exception lifecycle hard-deletes.
|
|
16782
|
+
revokedAt: external_exports.iso.datetime().nullable(),
|
|
16783
|
+
revokedBy: external_exports.string().nullable(),
|
|
16784
|
+
revokeReason: external_exports.string().nullable()
|
|
16785
|
+
});
|
|
16786
|
+
var ExceptionBundleEntry = DetectionException.pick({
|
|
16787
|
+
id: true,
|
|
16788
|
+
ruleId: true,
|
|
16789
|
+
valueFingerprint: true,
|
|
16790
|
+
keyVersion: true,
|
|
16791
|
+
capability: true,
|
|
16792
|
+
expiresAt: true,
|
|
16793
|
+
maxUses: true,
|
|
16794
|
+
useCount: true,
|
|
16795
|
+
conditions: true
|
|
16840
16796
|
});
|
|
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" });
|
|
16797
|
+
var ExceptionDescriptor = DetectionException.omit({ valueFingerprint: true });
|
|
16907
16798
|
|
|
16908
16799
|
// ../../packages/schema/src/zod/exception-action.ts
|
|
16909
16800
|
var confirmation = external_exports.string().optional();
|
|
@@ -17116,7 +17007,13 @@ var VaultConsent = external_exports.object({
|
|
|
17116
17007
|
|
|
17117
17008
|
// ../../packages/schema/src/zod/local.ts
|
|
17118
17009
|
var WORKSPACE_SETTINGS_SPEC_VERSION = 5;
|
|
17119
|
-
var RunMode = external_exports.enum(["standalone"]);
|
|
17010
|
+
var RunMode = external_exports.enum(["standalone", "attached"]);
|
|
17011
|
+
var ControlPlaneConnection = external_exports.object({
|
|
17012
|
+
endpoint: external_exports.string().min(1),
|
|
17013
|
+
// Display name for the deployment, shown instead of the raw endpoint.
|
|
17014
|
+
label: external_exports.string().min(1).optional(),
|
|
17015
|
+
attachedAt: external_exports.iso.datetime()
|
|
17016
|
+
}).meta({ id: "ControlPlaneConnection" });
|
|
17120
17017
|
var SimpleDetectionPolicy = external_exports.enum(["redact", "warn"]);
|
|
17121
17018
|
var HistoricalAccess = external_exports.enum(["full", "session-only"]);
|
|
17122
17019
|
var ModelJudgeConsent = external_exports.object({
|
|
@@ -17125,12 +17022,10 @@ var ModelJudgeConsent = external_exports.object({
|
|
|
17125
17022
|
});
|
|
17126
17023
|
var WorkspaceSettings = external_exports.object({
|
|
17127
17024
|
specVersion: external_exports.number().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
|
|
17128
|
-
|
|
17129
|
-
//
|
|
17130
|
-
runMode:
|
|
17131
|
-
|
|
17132
|
-
RunMode.default("standalone")
|
|
17133
|
-
),
|
|
17025
|
+
runMode: RunMode.default("standalone"),
|
|
17026
|
+
// Present only while attached; a detach clears it. Its presence is what makes
|
|
17027
|
+
// `runMode: 'attached'` mean anything — see isAttached.
|
|
17028
|
+
controlPlane: ControlPlaneConnection.optional(),
|
|
17134
17029
|
policy: SimpleDetectionPolicy.default("redact"),
|
|
17135
17030
|
// Consent for scanning pre-install surfaces; opt-in (see HistoricalAccess).
|
|
17136
17031
|
historicalAccess: HistoricalAccess.default("session-only"),
|
|
@@ -17156,6 +17051,195 @@ var WorkspaceSettings = external_exports.object({
|
|
|
17156
17051
|
modelJudgeConsent: ModelJudgeConsent.optional()
|
|
17157
17052
|
});
|
|
17158
17053
|
|
|
17054
|
+
// ../../packages/schema/src/zod/managed.ts
|
|
17055
|
+
var MANAGED_SETTINGS_SPEC_VERSION = 1;
|
|
17056
|
+
var ManagedSettingKey = external_exports.enum([
|
|
17057
|
+
"runMode",
|
|
17058
|
+
"historicalAccess",
|
|
17059
|
+
"vaultConsent",
|
|
17060
|
+
"vaultKeyCustody",
|
|
17061
|
+
"vaultInlineReveal",
|
|
17062
|
+
"modelJudgeConsent",
|
|
17063
|
+
"dataSharesInPlace"
|
|
17064
|
+
]).meta({ id: "ManagedSettingKey" });
|
|
17065
|
+
var ManagedSettingsValues = external_exports.object({
|
|
17066
|
+
runMode: external_exports.enum(["standalone", "attached"]).optional(),
|
|
17067
|
+
controlPlane: external_exports.object({
|
|
17068
|
+
endpoint: external_exports.string().min(1),
|
|
17069
|
+
label: external_exports.string().min(1).optional()
|
|
17070
|
+
}).optional(),
|
|
17071
|
+
historicalAccess: external_exports.enum(["full", "session-only"]).optional(),
|
|
17072
|
+
vaultConsent: external_exports.boolean().optional(),
|
|
17073
|
+
vaultKeyCustody: external_exports.enum(["file", "keychain"]).optional(),
|
|
17074
|
+
vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
|
|
17075
|
+
modelJudgeConsent: external_exports.boolean().optional(),
|
|
17076
|
+
dataSharesInPlace: external_exports.boolean().optional()
|
|
17077
|
+
}).meta({ id: "ManagedSettingsValues" });
|
|
17078
|
+
var ManagedSettings = external_exports.object({
|
|
17079
|
+
specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
|
|
17080
|
+
// Shown on every locked control, so the user can tell an administrative
|
|
17081
|
+
// decision from a bug. Absent renders as a generic "your organization".
|
|
17082
|
+
organization: external_exports.string().min(1).optional(),
|
|
17083
|
+
// What the administrator pinned.
|
|
17084
|
+
values: ManagedSettingsValues.default({}),
|
|
17085
|
+
// Which of those the user may not change. A key here with no matching value
|
|
17086
|
+
// freezes whatever the user last chose; a value with no lock is a DEFAULT
|
|
17087
|
+
// the user may still override. The two are separable on purpose.
|
|
17088
|
+
lockedFields: external_exports.array(ManagedSettingKey).default([])
|
|
17089
|
+
}).meta({ id: "ManagedSettings" });
|
|
17090
|
+
|
|
17091
|
+
// ../../packages/schema/src/zod/policy.ts
|
|
17092
|
+
var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
|
|
17093
|
+
var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
|
|
17094
|
+
var Policy = external_exports.object({
|
|
17095
|
+
id: external_exports.guid(),
|
|
17096
|
+
scope: PolicyScope,
|
|
17097
|
+
target: PolicyTarget,
|
|
17098
|
+
action: ActionTaken,
|
|
17099
|
+
enabled: external_exports.boolean().default(true),
|
|
17100
|
+
customKeywords: external_exports.array(external_exports.string()).optional(),
|
|
17101
|
+
// Display name — optional so older policy rows without name still parse.
|
|
17102
|
+
// Added for the findings API (policy.name column migration).
|
|
17103
|
+
name: external_exports.string().optional()
|
|
17104
|
+
}).meta({ id: "Policy" });
|
|
17105
|
+
var PolicyBundle = external_exports.object({
|
|
17106
|
+
version: external_exports.string(),
|
|
17107
|
+
policies: external_exports.array(Policy),
|
|
17108
|
+
// Rules from the installed marketplace packs (snapshotted by the
|
|
17109
|
+
// control plane). The plugin registers these in addition to its bundled
|
|
17110
|
+
// packs. Optional so older backends — and older on-disk caches — that omit
|
|
17111
|
+
// the field still parse; consumers read `bundle.rules ?? []`.
|
|
17112
|
+
rules: external_exports.array(Rule).optional(),
|
|
17113
|
+
// When true, `rules` IS the complete effective ruleset and the runtime must
|
|
17114
|
+
// NOT merge its compiled-in bundled packs — the standalone gateway sets this
|
|
17115
|
+
// after reading the user's installed snapshot (installed_packs, enabled
|
|
17116
|
+
// packs only), which is how detection updates stay manual: new bundled
|
|
17117
|
+
// rules run only after the user applies the pack update. Absent/false keeps
|
|
17118
|
+
// the historical composition (bundled packs + rules) — older caches.
|
|
17119
|
+
rulesComplete: external_exports.boolean().optional(),
|
|
17120
|
+
// Active detection exceptions, evaluation subset only (see
|
|
17121
|
+
// ExceptionBundleEntry). Optional so older bundle producers — and older
|
|
17122
|
+
// on-disk caches — that omit the field still parse; consumers read
|
|
17123
|
+
// `bundle.exceptions ?? []`.
|
|
17124
|
+
exceptions: external_exports.array(ExceptionBundleEntry).optional(),
|
|
17125
|
+
// Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
|
|
17126
|
+
// A second axis over the same `redact` action, carried beside the policies
|
|
17127
|
+
// rather than on them: nothing writes ruleId-targeted policies to disk, so
|
|
17128
|
+
// widening Policy itself would change a persisted shape to express something
|
|
17129
|
+
// only the in-memory bundle needs. Optional so an older producer — or an
|
|
17130
|
+
// older on-disk cache — still parses; consumers read `?? []` and get the
|
|
17131
|
+
// pre-existing one-way behaviour, which is the safe direction to default.
|
|
17132
|
+
reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
|
|
17133
|
+
// Installed pack version, keyed by ruleId, for rules in `rules` that came
|
|
17134
|
+
// from a versioned installed pack. Optional so older backends — and older
|
|
17135
|
+
// on-disk caches — that omit the field still parse; consumers fall back to
|
|
17136
|
+
// the rule's own spec version. NOT the bundle version above — see
|
|
17137
|
+
// installedRuleset's ruleVersions for the source of truth.
|
|
17138
|
+
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
17139
|
+
customKeywords: external_exports.array(external_exports.string()),
|
|
17140
|
+
fetchedAt: external_exports.iso.datetime()
|
|
17141
|
+
}).meta({ id: "PolicyBundle" });
|
|
17142
|
+
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
17143
|
+
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
17144
|
+
var CATEGORY_PEAK_SEVERITY = {
|
|
17145
|
+
secret: "critical",
|
|
17146
|
+
financial: "critical",
|
|
17147
|
+
// core-financial/credit-card
|
|
17148
|
+
code_flaw: "critical",
|
|
17149
|
+
pii: "high",
|
|
17150
|
+
phi: "high",
|
|
17151
|
+
custom: "high",
|
|
17152
|
+
// user-defined; conservative
|
|
17153
|
+
code_context: "low",
|
|
17154
|
+
config: "low"
|
|
17155
|
+
// observe-only; floors to monitor regardless
|
|
17156
|
+
};
|
|
17157
|
+
function severityFloorPolicy(category) {
|
|
17158
|
+
if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
|
|
17159
|
+
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
17160
|
+
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
17161
|
+
}
|
|
17162
|
+
var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
|
|
17163
|
+
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
17164
|
+
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
17165
|
+
var BUILTIN_POLICY_SPECS = {
|
|
17166
|
+
monitor: {
|
|
17167
|
+
name: "Monitor",
|
|
17168
|
+
action: "log",
|
|
17169
|
+
reversible: false,
|
|
17170
|
+
description: "Log every match for audit. The request is allowed through untouched."
|
|
17171
|
+
},
|
|
17172
|
+
warn: {
|
|
17173
|
+
name: "Warn",
|
|
17174
|
+
action: "warn",
|
|
17175
|
+
reversible: false,
|
|
17176
|
+
description: "Allow the request, but warn the user inline before it is sent."
|
|
17177
|
+
},
|
|
17178
|
+
redact: {
|
|
17179
|
+
name: "Redact",
|
|
17180
|
+
action: "redact",
|
|
17181
|
+
reversible: false,
|
|
17182
|
+
description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
|
|
17183
|
+
},
|
|
17184
|
+
vault: {
|
|
17185
|
+
name: "Redact & Vault",
|
|
17186
|
+
action: "redact",
|
|
17187
|
+
reversible: true,
|
|
17188
|
+
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."
|
|
17189
|
+
},
|
|
17190
|
+
block: {
|
|
17191
|
+
name: "Block",
|
|
17192
|
+
action: "block",
|
|
17193
|
+
reversible: false,
|
|
17194
|
+
description: "Refuse the request entirely whenever any rule in this detection matches."
|
|
17195
|
+
}
|
|
17196
|
+
};
|
|
17197
|
+
function builtinPolicyToAction(id) {
|
|
17198
|
+
return BUILTIN_POLICY_SPECS[id].action;
|
|
17199
|
+
}
|
|
17200
|
+
var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
17201
|
+
(id) => !BUILTIN_POLICY_SPECS[id].reversible
|
|
17202
|
+
);
|
|
17203
|
+
var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
17204
|
+
(id) => BUILTIN_POLICY_SPECS[id].reversible
|
|
17205
|
+
);
|
|
17206
|
+
var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
|
|
17207
|
+
var DEFAULT_ACTIONS = Object.fromEntries(
|
|
17208
|
+
DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
|
|
17209
|
+
);
|
|
17210
|
+
var BUILTIN_POLICIES = Object.fromEntries(
|
|
17211
|
+
KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
|
|
17212
|
+
);
|
|
17213
|
+
var UsedByItem = external_exports.object({
|
|
17214
|
+
id: external_exports.string(),
|
|
17215
|
+
name: external_exports.string(),
|
|
17216
|
+
ruleCount: external_exports.number().int().nonnegative(),
|
|
17217
|
+
enabled: external_exports.boolean()
|
|
17218
|
+
}).meta({ id: "UsedByItem" });
|
|
17219
|
+
var PolicyListItem = external_exports.object({
|
|
17220
|
+
id: external_exports.string(),
|
|
17221
|
+
kind: PolicyKind,
|
|
17222
|
+
name: external_exports.string(),
|
|
17223
|
+
enabled: external_exports.boolean(),
|
|
17224
|
+
usedByCount: external_exports.number().int().nonnegative()
|
|
17225
|
+
}).meta({ id: "PolicyListItem" });
|
|
17226
|
+
var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
|
|
17227
|
+
var PolicyDetail = external_exports.object({
|
|
17228
|
+
specVersion: external_exports.literal(1),
|
|
17229
|
+
id: external_exports.string(),
|
|
17230
|
+
kind: PolicyKind,
|
|
17231
|
+
name: external_exports.string(),
|
|
17232
|
+
enabled: external_exports.boolean(),
|
|
17233
|
+
description: external_exports.string(),
|
|
17234
|
+
usedBy: external_exports.array(UsedByItem)
|
|
17235
|
+
}).meta({ id: "PolicyDetail" });
|
|
17236
|
+
var PolicyStatsResponse = external_exports.object({
|
|
17237
|
+
policies: external_exports.number().int().nonnegative(),
|
|
17238
|
+
builtin: external_exports.number().int().nonnegative(),
|
|
17239
|
+
custom: external_exports.number().int().nonnegative(),
|
|
17240
|
+
detectionsGoverned: external_exports.number().int().nonnegative()
|
|
17241
|
+
}).meta({ id: "PolicyStatsResponse" });
|
|
17242
|
+
|
|
17159
17243
|
// ../../packages/schema/src/zod/project-files.ts
|
|
17160
17244
|
var ProjectFileInput = external_exports.object({
|
|
17161
17245
|
path: external_exports.string().min(1),
|
|
@@ -17228,44 +17312,6 @@ var BatchedRemediation = external_exports.discriminatedUnion("kind", [
|
|
|
17228
17312
|
NoRemediationDecision
|
|
17229
17313
|
]);
|
|
17230
17314
|
|
|
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
17315
|
// ../../packages/schema/src/zod/security.ts
|
|
17270
17316
|
var SeveritySummaryItem = external_exports.object({
|
|
17271
17317
|
severity: Severity,
|
|
@@ -17363,10 +17409,22 @@ var TopSourcesQuery = external_exports.object({
|
|
|
17363
17409
|
// Omit for both kinds.
|
|
17364
17410
|
kind: external_exports.enum(SOURCE_KINDS).optional()
|
|
17365
17411
|
});
|
|
17366
|
-
var Provider =
|
|
17412
|
+
var Provider = Harness.extract([
|
|
17413
|
+
"ClaudeCode",
|
|
17414
|
+
"Cursor",
|
|
17415
|
+
"Codex",
|
|
17416
|
+
"Antigravity",
|
|
17417
|
+
"ClaudeAi",
|
|
17418
|
+
"ChatGpt",
|
|
17419
|
+
"Copilot",
|
|
17420
|
+
"Api"
|
|
17421
|
+
]).meta({ id: "Provider" });
|
|
17367
17422
|
var ScanCoverageProvider = external_exports.object({
|
|
17368
17423
|
provider: Provider,
|
|
17369
|
-
// Percent of that provider's traffic
|
|
17424
|
+
// Percent of that provider's traffic the shipped capture surface reaches.
|
|
17425
|
+
// A curated business fact, constant across every `range` — not a measured
|
|
17426
|
+
// per-window metric. 0 exactly when `supported` is false. See the comment
|
|
17427
|
+
// above the block for where these numbers are decided.
|
|
17370
17428
|
coverage: external_exports.number().int().min(0).max(100),
|
|
17371
17429
|
supported: external_exports.boolean()
|
|
17372
17430
|
}).meta({ id: "ScanCoverageProvider" });
|
|
@@ -17420,6 +17478,18 @@ var ApplyRecommendedActionResponse = external_exports.object({
|
|
|
17420
17478
|
var DismissRecommendedActionResponse = external_exports.object({ id: external_exports.string(), status: external_exports.literal("dismissed") }).meta({ id: "DismissRecommendedActionResponse" });
|
|
17421
17479
|
var RecommendedActionIdParam = external_exports.object({ id: external_exports.string() });
|
|
17422
17480
|
|
|
17481
|
+
// ../../packages/schema/src/zod/settings-action.ts
|
|
17482
|
+
var SaveSettingsInput = external_exports.object({
|
|
17483
|
+
historicalAccess: external_exports.string(),
|
|
17484
|
+
modelJudgeConsent: external_exports.boolean(),
|
|
17485
|
+
vaultConsent: external_exports.string(),
|
|
17486
|
+
vaultInlineReveal: external_exports.string()
|
|
17487
|
+
});
|
|
17488
|
+
var AttachInput = external_exports.object({
|
|
17489
|
+
endpoint: external_exports.string(),
|
|
17490
|
+
label: external_exports.string().optional()
|
|
17491
|
+
});
|
|
17492
|
+
|
|
17423
17493
|
// ../../packages/schema/src/zod/triage.ts
|
|
17424
17494
|
var TriageHit = external_exports.object({
|
|
17425
17495
|
ruleId: external_exports.string(),
|
|
@@ -17434,7 +17504,7 @@ var TriageHit = external_exports.object({
|
|
|
17434
17504
|
valueFingerprint: external_exports.string().optional(),
|
|
17435
17505
|
keyVersion: external_exports.number().int().nonnegative().optional()
|
|
17436
17506
|
});
|
|
17437
|
-
var TriagePolicy =
|
|
17507
|
+
var TriagePolicy = CategoryPolicyId;
|
|
17438
17508
|
var TriageCategoryRec = external_exports.object({
|
|
17439
17509
|
category: DetectionCategory,
|
|
17440
17510
|
action: TriagePolicy,
|
|
@@ -17563,9 +17633,12 @@ import { threadId } from "worker_threads";
|
|
|
17563
17633
|
|
|
17564
17634
|
// ../../packages/persistence/src/internal/snapshot.ts
|
|
17565
17635
|
var STALE_PARTIAL_MS = 5 * 6e4;
|
|
17636
|
+
var SNAPSHOT_STAGING_SUFFIX = ".partial";
|
|
17637
|
+
var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
|
|
17566
17638
|
|
|
17567
17639
|
// ../../packages/persistence/src/repositories/activity.ts
|
|
17568
17640
|
var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
|
|
17641
|
+
var DEFAULT_HARNESS = HARNESS.ClaudeCode;
|
|
17569
17642
|
|
|
17570
17643
|
// ../../packages/persistence/src/repositories/exceptions.ts
|
|
17571
17644
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -17584,7 +17657,20 @@ import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
|
|
|
17584
17657
|
// ../../packages/persistence/src/repositories/inventory-assets.ts
|
|
17585
17658
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
17586
17659
|
var VALID_HARNESS_IDS = new Set(HarnessId.options);
|
|
17660
|
+
var HARNESS_LABELS = {
|
|
17661
|
+
[HARNESS.ClaudeCode]: "Claude Code",
|
|
17662
|
+
[HARNESS.Cursor]: "Cursor",
|
|
17663
|
+
[HARNESS.Codex]: "Codex",
|
|
17664
|
+
[HARNESS.Antigravity]: "Antigravity"
|
|
17665
|
+
};
|
|
17587
17666
|
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
17667
|
+
var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
|
|
17668
|
+
var TITLE_NEEDLES = {
|
|
17669
|
+
ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
|
|
17670
|
+
Cursor: stripSeparators(SOURCE_TOOL.Cursor),
|
|
17671
|
+
Codex: stripSeparators(SOURCE_TOOL.Codex),
|
|
17672
|
+
Antigravity: stripSeparators(SOURCE_TOOL.Antigravity)
|
|
17673
|
+
};
|
|
17588
17674
|
|
|
17589
17675
|
// ../../packages/persistence/src/repositories/policies.ts
|
|
17590
17676
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
@@ -17598,6 +17684,18 @@ import { randomUUID as randomUUID7 } from "crypto";
|
|
|
17598
17684
|
// ../../packages/persistence/src/repositories/secret-vault.ts
|
|
17599
17685
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
17600
17686
|
|
|
17687
|
+
// ../../packages/persistence/src/repositories/security.ts
|
|
17688
|
+
var SCAN_COVERAGE = {
|
|
17689
|
+
[HARNESS.Antigravity]: { coverage: 60, supported: true },
|
|
17690
|
+
[HARNESS.Api]: { coverage: 0, supported: false },
|
|
17691
|
+
[HARNESS.ChatGpt]: { coverage: 40, supported: true },
|
|
17692
|
+
[HARNESS.ClaudeAi]: { coverage: 40, supported: true },
|
|
17693
|
+
[HARNESS.ClaudeCode]: { coverage: 100, supported: true },
|
|
17694
|
+
[HARNESS.Codex]: { coverage: 80, supported: true },
|
|
17695
|
+
[HARNESS.Copilot]: { coverage: 0, supported: false },
|
|
17696
|
+
[HARNESS.Cursor]: { coverage: 0, supported: false }
|
|
17697
|
+
};
|
|
17698
|
+
|
|
17601
17699
|
// ../../packages/persistence/src/repositories/shares.ts
|
|
17602
17700
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
17603
17701
|
|
|
@@ -17630,8 +17728,12 @@ import { mkdir } from "fs/promises";
|
|
|
17630
17728
|
import { homedir } from "os";
|
|
17631
17729
|
import { join as join4 } from "path";
|
|
17632
17730
|
|
|
17633
|
-
// ../../packages/persistence/src/settings.ts
|
|
17731
|
+
// ../../packages/persistence/src/managed-settings.ts
|
|
17634
17732
|
import { readFileSync as readFileSync3 } from "fs";
|
|
17733
|
+
import { posix, win32 } from "path";
|
|
17734
|
+
|
|
17735
|
+
// ../../packages/persistence/src/settings.ts
|
|
17736
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
17635
17737
|
import { join as join5 } from "path";
|
|
17636
17738
|
|
|
17637
17739
|
// ../../packages/persistence/src/vault/crypto.ts
|
|
@@ -17646,15 +17748,7 @@ import {
|
|
|
17646
17748
|
// ../../packages/persistence/src/vault/key-provider.ts
|
|
17647
17749
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
17648
17750
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
17649
|
-
import {
|
|
17650
|
-
chmodSync as chmodSync2,
|
|
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";
|
|
17751
|
+
import { chmodSync as chmodSync2, readFileSync as readFileSync5, renameSync as renameSync4, rmSync as rmSync4, statSync as statSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
17658
17752
|
import { join as join6 } from "path";
|
|
17659
17753
|
|
|
17660
17754
|
// ../../packages/persistence/src/vault/vault.ts
|
|
@@ -17683,7 +17777,7 @@ var providerEnvShape = {
|
|
|
17683
17777
|
var ProviderEnvSchema = external_exports.object(providerEnvShape);
|
|
17684
17778
|
|
|
17685
17779
|
// ../../packages/plugin-sdk/src/config-inventory.ts
|
|
17686
|
-
import { readdirSync as readdirSync2, readFileSync as
|
|
17780
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync7, realpathSync, statSync as statSync5 } from "fs";
|
|
17687
17781
|
import { homedir as homedir2 } from "os";
|
|
17688
17782
|
import { basename as basename3, join as join10 } from "path";
|
|
17689
17783
|
|
|
@@ -18259,6 +18353,40 @@ function escapeRegExp2(value) {
|
|
|
18259
18353
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18260
18354
|
}
|
|
18261
18355
|
|
|
18356
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
18357
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
18358
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
18359
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
18360
|
+
function listCache(kind) {
|
|
18361
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
18362
|
+
}
|
|
18363
|
+
function memoizedRegExp(owner, build) {
|
|
18364
|
+
const cached2 = singles.get(owner);
|
|
18365
|
+
if (cached2 !== void 0) {
|
|
18366
|
+
cached2.lastIndex = 0;
|
|
18367
|
+
return cached2;
|
|
18368
|
+
}
|
|
18369
|
+
const compiled = build();
|
|
18370
|
+
singles.set(owner, compiled);
|
|
18371
|
+
return compiled;
|
|
18372
|
+
}
|
|
18373
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
18374
|
+
const cache = listCache(kind);
|
|
18375
|
+
const cached2 = cache.get(owner);
|
|
18376
|
+
if (cached2 !== void 0) {
|
|
18377
|
+
if (cached2.stateful) {
|
|
18378
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
18379
|
+
}
|
|
18380
|
+
return cached2.entries;
|
|
18381
|
+
}
|
|
18382
|
+
const entries = build();
|
|
18383
|
+
cache.set(owner, {
|
|
18384
|
+
entries,
|
|
18385
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
18386
|
+
});
|
|
18387
|
+
return entries;
|
|
18388
|
+
}
|
|
18389
|
+
|
|
18262
18390
|
// ../../packages/detections/src/matchers/limits.ts
|
|
18263
18391
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
18264
18392
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -18269,10 +18397,17 @@ var KeywordMatcher2 = class {
|
|
|
18269
18397
|
if (rule.matcher.type !== "keyword") return [];
|
|
18270
18398
|
const { keywords, caseSensitive } = rule.matcher;
|
|
18271
18399
|
const spans = [];
|
|
18272
|
-
|
|
18273
|
-
|
|
18400
|
+
const compiled = memoizedRegExpList(
|
|
18401
|
+
"keyword",
|
|
18402
|
+
rule.matcher,
|
|
18403
|
+
() => keywords.map((kw) => {
|
|
18404
|
+
if (kw.length === 0) return void 0;
|
|
18405
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18406
|
+
})
|
|
18407
|
+
);
|
|
18408
|
+
for (const re of compiled) {
|
|
18409
|
+
if (re === void 0) continue;
|
|
18274
18410
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
18275
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18276
18411
|
let m;
|
|
18277
18412
|
while ((m = re.exec(text)) !== null) {
|
|
18278
18413
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -18288,7 +18423,10 @@ var RegexMatcher2 = class {
|
|
|
18288
18423
|
match(text, rule) {
|
|
18289
18424
|
if (rule.matcher.type !== "regex") return [];
|
|
18290
18425
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
18291
|
-
const re =
|
|
18426
|
+
const re = memoizedRegExp(
|
|
18427
|
+
rule.matcher,
|
|
18428
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
18429
|
+
);
|
|
18292
18430
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
18293
18431
|
const spans = [];
|
|
18294
18432
|
let m;
|
|
@@ -18371,6 +18509,7 @@ var CONFIG_POSTURE_RULES = [
|
|
|
18371
18509
|
];
|
|
18372
18510
|
|
|
18373
18511
|
// ../../packages/detections/src/security/redos-probe.ts
|
|
18512
|
+
var BUDGET_MS = 100;
|
|
18374
18513
|
var EXPONENTIAL_UNITS = [
|
|
18375
18514
|
"a",
|
|
18376
18515
|
"0",
|
|
@@ -18394,9 +18533,11 @@ var EXPONENTIAL_PROBES = EXPONENTIAL_UNITS.flatMap(
|
|
|
18394
18533
|
var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map(
|
|
18395
18534
|
(unit) => unit.repeat(1e4).slice(0, 4e4) + "!"
|
|
18396
18535
|
);
|
|
18536
|
+
var CPU_CORROBORATION_SHARE = 0.2;
|
|
18537
|
+
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
18397
18538
|
|
|
18398
18539
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
18399
|
-
import { existsSync as existsSync6, readFileSync as
|
|
18540
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync4 } from "fs";
|
|
18400
18541
|
import { basename as basename2, dirname as dirname2, isAbsolute, join as join9, sep as sep2 } from "path";
|
|
18401
18542
|
|
|
18402
18543
|
// ../../packages/plugin-sdk/src/events.ts
|
|
@@ -18407,21 +18548,25 @@ import { existsSync as existsSync7 } from "fs";
|
|
|
18407
18548
|
import { fileURLToPath } from "url";
|
|
18408
18549
|
import { Worker } from "worker_threads";
|
|
18409
18550
|
|
|
18551
|
+
// ../../packages/plugin-sdk/src/ignore-layers.ts
|
|
18552
|
+
var import_ignore = __toESM(require_ignore(), 1);
|
|
18553
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
18554
|
+
import { join as join11 } from "path";
|
|
18555
|
+
|
|
18410
18556
|
// ../../packages/plugin-sdk/src/inventory-resolver.ts
|
|
18411
18557
|
import { arch, hostname as hostname4, platform, release } from "os";
|
|
18412
18558
|
|
|
18413
18559
|
// ../../packages/plugin-sdk/src/nudge.ts
|
|
18414
|
-
import { mkdirSync as
|
|
18415
|
-
import { join as
|
|
18560
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
|
|
18561
|
+
import { join as join12 } from "path";
|
|
18416
18562
|
|
|
18417
18563
|
// ../../packages/plugin-sdk/src/paths.ts
|
|
18418
18564
|
import { readdirSync as readdirSync3, realpathSync as realpathSync2 } from "fs";
|
|
18419
18565
|
import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
18420
18566
|
|
|
18421
18567
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18422
|
-
|
|
18423
|
-
import {
|
|
18424
|
-
import { basename as basename5, join as join12, relative, sep as sep4 } from "path";
|
|
18568
|
+
import { existsSync as existsSync8, readdirSync as readdirSync4 } from "fs";
|
|
18569
|
+
import { basename as basename5, join as join13 } from "path";
|
|
18425
18570
|
|
|
18426
18571
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18427
18572
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -18456,17 +18601,22 @@ import { randomUUID as randomUUID14 } from "crypto";
|
|
|
18456
18601
|
var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
18457
18602
|
|
|
18458
18603
|
// ../../packages/plugin-sdk/src/throttle.ts
|
|
18459
|
-
import { mkdirSync as
|
|
18460
|
-
import { join as
|
|
18604
|
+
import { mkdirSync as mkdirSync3, statSync as statSync6, writeFileSync as writeFileSync6 } from "fs";
|
|
18605
|
+
import { join as join14 } from "path";
|
|
18461
18606
|
|
|
18462
18607
|
// ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
|
|
18463
18608
|
import { writeFileSync as writeFileSync7 } from "fs";
|
|
18464
|
-
import { join as
|
|
18609
|
+
import { join as join15 } from "path";
|
|
18610
|
+
|
|
18611
|
+
// ../../packages/setup-wizard/src/triage/merge.ts
|
|
18612
|
+
var RANK = Object.fromEntries(
|
|
18613
|
+
KNOWN_BUILTIN_IDS.map((id, i) => [id, i])
|
|
18614
|
+
);
|
|
18465
18615
|
|
|
18466
18616
|
// ../../packages/setup-wizard/src/triage/plan-file.ts
|
|
18467
|
-
import { mkdtempSync, readFileSync as
|
|
18617
|
+
import { mkdtempSync, readFileSync as readFileSync10, rmdirSync, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
18468
18618
|
import { tmpdir } from "os";
|
|
18469
|
-
import { basename as basename6, dirname as dirname4, join as
|
|
18619
|
+
import { basename as basename6, dirname as dirname4, join as join16 } from "path";
|
|
18470
18620
|
var SuppressionEntrySchema = external_exports.object({
|
|
18471
18621
|
ruleId: external_exports.string(),
|
|
18472
18622
|
category: DetectionCategory,
|
|
@@ -18609,7 +18759,7 @@ function buildIntroCard(manifest2, verified) {
|
|
|
18609
18759
|
var manifestPath = process.argv[2];
|
|
18610
18760
|
var manifest = {};
|
|
18611
18761
|
try {
|
|
18612
|
-
manifest = JSON.parse(
|
|
18762
|
+
manifest = JSON.parse(readFileSync11(manifestPath ?? "", "utf8"));
|
|
18613
18763
|
} catch {
|
|
18614
18764
|
}
|
|
18615
18765
|
process.stdout.write(show(fenced(buildIntroCard(manifest))));
|