@akasecurity/ai-tc-codex 0.9.14 → 0.9.16
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/.codex-plugin/plugin.json +1 -1
- package/hooks/hooks.json +1 -1
- package/package.json +5 -5
- package/scripts/apply-suppressions.js +1828 -463
- package/scripts/backfill.js +2406 -518
- package/scripts/content-retention.js +1002 -275
- package/scripts/filescan.js +2323 -435
- package/scripts/firstrun.js +1643 -363
- package/scripts/history-sync.js +1024 -282
- package/scripts/intro.js +385 -178
- package/scripts/onboard.js +985 -260
- package/scripts/post-tool-use.js +2446 -439
- package/scripts/pre-tool-use.js +2350 -434
- package/scripts/query.js +1642 -362
- package/scripts/reconcile.js +2297 -413
- package/scripts/remediate.js +2281 -444
- package/scripts/scan-worker.js +514 -175
- package/scripts/session-start.js +2292 -421
- package/scripts/start-light.js +385 -178
- package/scripts/stop.js +481 -207
- package/scripts/sync.js +2322 -434
- package/scripts/user-prompt-submit.js +2392 -469
- package/skills/setup/SKILL.md +27 -12
package/scripts/start-light.js
CHANGED
|
@@ -32,9 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
mod
|
|
33
33
|
));
|
|
34
34
|
|
|
35
|
-
// ../../node_modules/.pnpm/ignore@7.0.
|
|
35
|
+
// ../../node_modules/.pnpm/ignore@7.0.11/node_modules/ignore/index.js
|
|
36
36
|
var require_ignore = __commonJS({
|
|
37
|
-
"../../node_modules/.pnpm/ignore@7.0.
|
|
37
|
+
"../../node_modules/.pnpm/ignore@7.0.11/node_modules/ignore/index.js"(exports, module) {
|
|
38
38
|
"use strict";
|
|
39
39
|
function makeArray(subject) {
|
|
40
40
|
return Array.isArray(subject) ? subject : [subject];
|
|
@@ -169,6 +169,7 @@ var require_ignore = __commonJS({
|
|
|
169
169
|
"g"
|
|
170
170
|
);
|
|
171
171
|
var TRAILING_WILDCARD = "\uE000";
|
|
172
|
+
var TRAILING_DOUBLESTAR = "\uE001";
|
|
172
173
|
var extractBrackets = (pattern) => {
|
|
173
174
|
const sources = [];
|
|
174
175
|
const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
|
|
@@ -329,7 +330,7 @@ var require_ignore = __commonJS({
|
|
|
329
330
|
// Zero, one or several directories
|
|
330
331
|
// should not use '*', or it will be replaced by the next replacer
|
|
331
332
|
// Check if it is not the last `'/**'`
|
|
332
|
-
(_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" :
|
|
333
|
+
(_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : `\\/${TRAILING_DOUBLESTAR}`,
|
|
333
334
|
"*"
|
|
334
335
|
],
|
|
335
336
|
// normal intermediate wildcards
|
|
@@ -407,7 +408,7 @@ var require_ignore = __commonJS({
|
|
|
407
408
|
// 'js' will match 'a.js' and 'a.js/'
|
|
408
409
|
(source) => {
|
|
409
410
|
const last = source[source.length - 1];
|
|
410
|
-
if (!last || last === TRAILING_WILDCARD) {
|
|
411
|
+
if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) {
|
|
411
412
|
return source;
|
|
412
413
|
}
|
|
413
414
|
return last === SLASH2 ? `${source}$` : `${source}(?=$|\\/$)`;
|
|
@@ -418,17 +419,20 @@ var require_ignore = __commonJS({
|
|
|
418
419
|
var MODE_IGNORE = "regex";
|
|
419
420
|
var MODE_CHECK_IGNORE = "checkRegex";
|
|
420
421
|
var UNDERSCORE = "_";
|
|
421
|
-
var
|
|
422
|
-
[
|
|
423
|
-
|
|
424
|
-
return `${prefix}(?=$|\\/$)`;
|
|
425
|
-
},
|
|
426
|
-
[MODE_CHECK_IGNORE](_, p1) {
|
|
427
|
-
const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
|
|
428
|
-
return `${prefix}(?=$|\\/$)`;
|
|
429
|
-
}
|
|
422
|
+
var replaceTrailingWildcard = (_, p1) => {
|
|
423
|
+
const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
|
424
|
+
return `${prefix}(?=$|\\/$)`;
|
|
430
425
|
};
|
|
426
|
+
var REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
|
|
427
|
+
var replaceTrailingDoublestar = () => ".+(?=$|\\/$)";
|
|
431
428
|
var WILDCARD = "[^\\/]*";
|
|
429
|
+
var separatorAfter = (run, at) => {
|
|
430
|
+
let separator = EMPTY;
|
|
431
|
+
for (let index = at + 1; index < run.length && !run[index].wildcard; index++) {
|
|
432
|
+
separator += run[index].single;
|
|
433
|
+
}
|
|
434
|
+
return separator;
|
|
435
|
+
};
|
|
432
436
|
var pinWildcards = (source) => {
|
|
433
437
|
if (source.indexOf(WILDCARD) < 0) {
|
|
434
438
|
return source;
|
|
@@ -498,7 +502,7 @@ var require_ignore = __commonJS({
|
|
|
498
502
|
out += token.single;
|
|
499
503
|
return;
|
|
500
504
|
}
|
|
501
|
-
out += at === lastWildcard ? WILDCARD : `(?:(?!${run
|
|
505
|
+
out += at === lastWildcard ? WILDCARD : `(?:(?!${separatorAfter(run, at)})[^\\/])*`;
|
|
502
506
|
});
|
|
503
507
|
run = [];
|
|
504
508
|
};
|
|
@@ -536,6 +540,14 @@ var require_ignore = __commonJS({
|
|
|
536
540
|
(match, index) => sources[index]
|
|
537
541
|
) : replaced;
|
|
538
542
|
};
|
|
543
|
+
var checkSourceOf = (body, prefix) => {
|
|
544
|
+
if (body[body.length - 1] === SLASH2) {
|
|
545
|
+
prefix = makeRegexPrefix(body.slice(0, -1));
|
|
546
|
+
}
|
|
547
|
+
const head = prefix.slice(0, -1);
|
|
548
|
+
const last = prefix[prefix.length - 1];
|
|
549
|
+
return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? `${head}.*$` : NEVER_MATCH;
|
|
550
|
+
};
|
|
539
551
|
var matchesBasename = (body) => {
|
|
540
552
|
const index = body.indexOf(SLASH2);
|
|
541
553
|
return index < 0 || index === body.length - 1;
|
|
@@ -596,11 +608,9 @@ var require_ignore = __commonJS({
|
|
|
596
608
|
return this._make(MODE_CHECK_IGNORE, key);
|
|
597
609
|
}
|
|
598
610
|
_make(mode, key) {
|
|
599
|
-
const str = pinWildcards(
|
|
600
|
-
REGEX_REPLACE_TRAILING_WILDCARD,
|
|
601
|
-
|
|
602
|
-
TRAILING_WILD_CARD_REPLACERS[mode]
|
|
603
|
-
));
|
|
611
|
+
const str = pinWildcards(
|
|
612
|
+
mode === MODE_IGNORE ? this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, replaceTrailingWildcard).replace(REGEX_REPLACE_TRAILING_DOUBLESTAR, replaceTrailingDoublestar) : checkSourceOf(this.body, this.regexPrefix)
|
|
613
|
+
);
|
|
604
614
|
const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
|
|
605
615
|
return define(this, key, regex);
|
|
606
616
|
}
|
|
@@ -659,8 +669,39 @@ var require_ignore = __commonJS({
|
|
|
659
669
|
makeArray(
|
|
660
670
|
isString(pattern) ? splitPattern(pattern) : pattern
|
|
661
671
|
).forEach(this._add, this);
|
|
672
|
+
if (this._added) {
|
|
673
|
+
this._literalRules = UNDEFINED;
|
|
674
|
+
}
|
|
662
675
|
return this._added;
|
|
663
676
|
}
|
|
677
|
+
// Match the literal 'abc/' for `checkIgnore`, last rule wins. Only a rule
|
|
678
|
+
// ending in a wildcard can match it (see `checkSourceOf`), so the rest
|
|
679
|
+
// are left out once, rather than tested or compiled for every path.
|
|
680
|
+
testLiteral(path) {
|
|
681
|
+
const rules = this._literalRules || (this._literalRules = this._rules.filter(
|
|
682
|
+
({ body }) => body[body.length - (body[body.length - 1] === SLASH2 ? 2 : 1)] === "*"
|
|
683
|
+
));
|
|
684
|
+
let ignored = false;
|
|
685
|
+
let unignored = false;
|
|
686
|
+
let matchedRule;
|
|
687
|
+
for (let index = rules.length - 1; index >= 0; index--) {
|
|
688
|
+
const rule = rules[index];
|
|
689
|
+
if (rule.checkRegex.test(path)) {
|
|
690
|
+
ignored = !rule.negative;
|
|
691
|
+
unignored = rule.negative;
|
|
692
|
+
matchedRule = rule.negative ? UNDEFINED : rule;
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
const ret = {
|
|
697
|
+
ignored,
|
|
698
|
+
unignored
|
|
699
|
+
};
|
|
700
|
+
if (matchedRule) {
|
|
701
|
+
ret.rule = matchedRule;
|
|
702
|
+
}
|
|
703
|
+
return ret;
|
|
704
|
+
}
|
|
664
705
|
// Test one single path without recursively checking parent directories
|
|
665
706
|
//
|
|
666
707
|
// - checkUnignored `boolean` whether should check if the path is unignored,
|
|
@@ -781,14 +822,12 @@ var require_ignore = __commonJS({
|
|
|
781
822
|
if (path.charCodeAt(path.length - 1) !== SLASH_CODE) {
|
|
782
823
|
return this.test(path);
|
|
783
824
|
}
|
|
784
|
-
const
|
|
785
|
-
if (
|
|
786
|
-
|
|
787
|
-
if (parent.ignored) {
|
|
788
|
-
return parent;
|
|
789
|
-
}
|
|
825
|
+
const dir = this._t(path, this._testCache, true);
|
|
826
|
+
if (dir.ignored) {
|
|
827
|
+
return dir;
|
|
790
828
|
}
|
|
791
|
-
|
|
829
|
+
const literal2 = this._rules.testLiteral(path);
|
|
830
|
+
return literal2.ignored || literal2.unignored ? literal2 : dir;
|
|
792
831
|
}
|
|
793
832
|
_t(path, cache, checkUnignored) {
|
|
794
833
|
if (path in cache) {
|
|
@@ -21508,11 +21547,33 @@ var ResolutionMethod = external_exports.enum([
|
|
|
21508
21547
|
"false-positive",
|
|
21509
21548
|
"redetected"
|
|
21510
21549
|
]).meta({ id: "ResolutionMethod" });
|
|
21550
|
+
var FindingContextBasis = external_exports.enum(["file", "excerpt"]).meta({ id: "FindingContextBasis" });
|
|
21551
|
+
var FindingContext = external_exports.object({
|
|
21552
|
+
basis: FindingContextBasis,
|
|
21553
|
+
// 1-based line number of `lines[0]`.
|
|
21554
|
+
firstLine: external_exports.number().int().positive(),
|
|
21555
|
+
lines: external_exports.array(external_exports.string()).min(1).max(5),
|
|
21556
|
+
match: external_exports.object({
|
|
21557
|
+
// 1-based line number, within [firstLine, firstLine + lines.length).
|
|
21558
|
+
line: external_exports.number().int().positive(),
|
|
21559
|
+
// Offsets into that entry of `lines`, end exclusive.
|
|
21560
|
+
start: external_exports.number().int().nonnegative(),
|
|
21561
|
+
end: external_exports.number().int().nonnegative()
|
|
21562
|
+
}).nullable()
|
|
21563
|
+
}).meta({ id: "FindingContext" });
|
|
21564
|
+
var FindingLocation = external_exports.object({
|
|
21565
|
+
line: external_exports.number().int().positive(),
|
|
21566
|
+
col: external_exports.number().int().positive(),
|
|
21567
|
+
context: FindingContext.nullable()
|
|
21568
|
+
});
|
|
21511
21569
|
var FindingMatch = external_exports.object({
|
|
21512
21570
|
// Masked preview of the matched value. Never raw content.
|
|
21513
21571
|
maskedValue: external_exports.string(),
|
|
21514
|
-
//
|
|
21515
|
-
contextPrefix: external_exports.string()
|
|
21572
|
+
// Deprecated: always empty. Superseded by `context`.
|
|
21573
|
+
contextPrefix: external_exports.string(),
|
|
21574
|
+
// The masked lines around the match. Absent when the finding predates
|
|
21575
|
+
// context capture or none could be built safely.
|
|
21576
|
+
context: FindingContext.optional()
|
|
21516
21577
|
}).meta({ id: "FindingMatch" });
|
|
21517
21578
|
var FindingDetectionRef = external_exports.object({
|
|
21518
21579
|
id: external_exports.string(),
|
|
@@ -21532,6 +21593,11 @@ var FindingInstance = external_exports.object({
|
|
|
21532
21593
|
provider: FindingProvider,
|
|
21533
21594
|
repo: external_exports.string(),
|
|
21534
21595
|
file: external_exports.string(),
|
|
21596
|
+
// 1-based line and column of the match start in the scanned text (the
|
|
21597
|
+
// column in UTF-16 code units). Absent for findings that predate location
|
|
21598
|
+
// capture or have no source text.
|
|
21599
|
+
line: external_exports.number().int().positive().optional(),
|
|
21600
|
+
col: external_exports.number().int().positive().optional(),
|
|
21535
21601
|
// Who the capturing event is attributed to. Optional: a single-user store
|
|
21536
21602
|
// has no one to attribute a finding to and never sets it.
|
|
21537
21603
|
user: FindingUser.optional(),
|
|
@@ -21593,6 +21659,13 @@ var FindingStats = external_exports.object({
|
|
|
21593
21659
|
low: external_exports.number().int().nonnegative()
|
|
21594
21660
|
})
|
|
21595
21661
|
}).meta({ id: "FindingStats" });
|
|
21662
|
+
var FindingsOverview = external_exports.object({
|
|
21663
|
+
findings: external_exports.number().int().nonnegative(),
|
|
21664
|
+
open: external_exports.number().int().nonnegative(),
|
|
21665
|
+
handled: external_exports.number().int().nonnegative(),
|
|
21666
|
+
resolved: external_exports.number().int().nonnegative(),
|
|
21667
|
+
dismissed: external_exports.number().int().nonnegative()
|
|
21668
|
+
}).meta({ id: "FindingsOverview" });
|
|
21596
21669
|
var FindingFacetItem = external_exports.object({
|
|
21597
21670
|
value: external_exports.string(),
|
|
21598
21671
|
count: external_exports.number().int().nonnegative()
|
|
@@ -21710,6 +21783,7 @@ var FindingInstanceDetail = FindingInstance.extend({
|
|
|
21710
21783
|
policy: FindingPolicyRef
|
|
21711
21784
|
}).meta({ id: "FindingInstanceDetail" });
|
|
21712
21785
|
var MAX_FLAT_FINDINGS_LIMIT = 200;
|
|
21786
|
+
var FindingContextQuery = external_exports.object({ id: external_exports.string().min(1).max(256) });
|
|
21713
21787
|
var ListFindingInstancesQuery = external_exports.object({
|
|
21714
21788
|
severity: external_exports.array(Severity).optional(),
|
|
21715
21789
|
// Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
|
|
@@ -22041,7 +22115,23 @@ var CaptureAttributes = external_exports.object({
|
|
|
22041
22115
|
// capture denied by another finding's own Block policy carries `block`
|
|
22042
22116
|
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
22043
22117
|
// repeated rather than referenced because a store reader opens this file.
|
|
22044
|
-
redact_degraded_to: ActionTaken.optional()
|
|
22118
|
+
redact_degraded_to: ActionTaken.optional(),
|
|
22119
|
+
// The scope key this capture was stamped with: the canonical repository
|
|
22120
|
+
// (`host/owner/repo`) of the path the capture names (a relative path is read
|
|
22121
|
+
// against its working directory), else of its own working directory, or a
|
|
22122
|
+
// chat account's identity. The store's local `scope_key` column reads it, so
|
|
22123
|
+
// a scoped attachment has a per-row key to work from. Absent when no key
|
|
22124
|
+
// could be derived.
|
|
22125
|
+
//
|
|
22126
|
+
// LOCAL ONLY. That is the contract for every path that sends a row. Producers
|
|
22127
|
+
// stamp it in every attachment mode, and the two structural choke points strip
|
|
22128
|
+
// it: the attached gateway's `reKeyForForward` on the live path, and the
|
|
22129
|
+
// history drain's `rebuildAuditEvent`, which drops it through `withoutScopeKey`.
|
|
22130
|
+
// A capture row's bag reaches the wire through `rebuildCapture`, which builds
|
|
22131
|
+
// the metadata from named keys and never names this one; `toCaptureAttributes`,
|
|
22132
|
+
// which builds the bag from a wire event, never emits it. What a scoped
|
|
22133
|
+
// attachment does with the key is not part of this shape's contract.
|
|
22134
|
+
scope_key: external_exports.string().optional()
|
|
22045
22135
|
}).catchall(external_exports.unknown());
|
|
22046
22136
|
var CaptureStatusAttributes = external_exports.object({
|
|
22047
22137
|
source_tool: external_exports.string().optional(),
|
|
@@ -22071,6 +22161,12 @@ var ToolCallInspection = external_exports.object({
|
|
|
22071
22161
|
actionTaken: ActionTaken,
|
|
22072
22162
|
confidence: external_exports.number().min(0).max(1)
|
|
22073
22163
|
});
|
|
22164
|
+
var findingLocationFields = {
|
|
22165
|
+
line: external_exports.number().int().positive().optional(),
|
|
22166
|
+
col: external_exports.number().int().positive().optional(),
|
|
22167
|
+
context: FindingContext.nullable().optional()
|
|
22168
|
+
};
|
|
22169
|
+
var ToolCallInspectionInput = ToolCallInspection.extend(findingLocationFields);
|
|
22074
22170
|
var ToolCallInput = external_exports.object({
|
|
22075
22171
|
sessionId: external_exports.string().min(1),
|
|
22076
22172
|
toolUseId: external_exports.string().min(1),
|
|
@@ -22080,7 +22176,7 @@ var ToolCallInput = external_exports.object({
|
|
|
22080
22176
|
attributes: ToolCallAttributes,
|
|
22081
22177
|
// Secrets detected in the tool's (masked) target — written as linked
|
|
22082
22178
|
// `inspection_findings`. Empty for a clean tool call.
|
|
22083
|
-
inspections: external_exports.array(
|
|
22179
|
+
inspections: external_exports.array(ToolCallInspectionInput).default([])
|
|
22084
22180
|
});
|
|
22085
22181
|
var InventoryInput = external_exports.object({
|
|
22086
22182
|
objectType: InventoryObjectType,
|
|
@@ -22154,7 +22250,8 @@ var InspectionFindingInput = external_exports.object({
|
|
|
22154
22250
|
// same findingKey — mirrors the legacy `findings.first_detected_at`.
|
|
22155
22251
|
// Optional: when omitted, the writer derives it from the referenced audit
|
|
22156
22252
|
// event's startedAt on first insert (see SqliteInspectionFindingsRepository).
|
|
22157
|
-
firstDetectedAt: external_exports.iso.datetime().optional()
|
|
22253
|
+
firstDetectedAt: external_exports.iso.datetime().optional(),
|
|
22254
|
+
...findingLocationFields
|
|
22158
22255
|
});
|
|
22159
22256
|
var InventoryContext = external_exports.object({
|
|
22160
22257
|
host: InventoryInput.optional(),
|
|
@@ -22929,6 +23026,17 @@ var AttachedCredential = external_exports.object({
|
|
|
22929
23026
|
keyPrefix: external_exports.string().min(1).max(16).optional(),
|
|
22930
23027
|
mintedAt: external_exports.iso.datetime().optional()
|
|
22931
23028
|
});
|
|
23029
|
+
var AttachmentMode = external_exports.enum(["machine", "scoped"]);
|
|
23030
|
+
var ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION = 2;
|
|
23031
|
+
var AttachedCredentialV1 = AttachedCredential;
|
|
23032
|
+
var AttachedCredentialV2 = AttachedCredential.extend({
|
|
23033
|
+
specVersion: external_exports.literal(ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION),
|
|
23034
|
+
mode: external_exports.literal("scoped")
|
|
23035
|
+
});
|
|
23036
|
+
var AttachedCredentialAny = external_exports.discriminatedUnion("specVersion", [
|
|
23037
|
+
AttachedCredentialV1,
|
|
23038
|
+
AttachedCredentialV2
|
|
23039
|
+
]);
|
|
22932
23040
|
var MAX_DATE_MS = 253402300799999;
|
|
22933
23041
|
var MAX_INT4 = 2147483647;
|
|
22934
23042
|
var StorePosturePack = external_exports.object({
|
|
@@ -22985,7 +23093,29 @@ var StorePosturePlugin = external_exports.object({
|
|
|
22985
23093
|
*/
|
|
22986
23094
|
policyBundleVersion: external_exports.string().max(200).nullable(),
|
|
22987
23095
|
/** Epoch millis, on the CLIENT clock, of that fetch. */
|
|
22988
|
-
policyFetchedAt: external_exports.number().int().min(0).max(MAX_DATE_MS).nullable()
|
|
23096
|
+
policyFetchedAt: external_exports.number().int().min(0).max(MAX_DATE_MS).nullable(),
|
|
23097
|
+
/**
|
|
23098
|
+
* The newest version the host's own install record holds for this plugin —
|
|
23099
|
+
* what is on disk. After an update it leads `version` (the running copy) by
|
|
23100
|
+
* one launch. Null when no usable version can be read: no install record
|
|
23101
|
+
* (a plugin run from a checkout), no entry with a valid version, or every
|
|
23102
|
+
* such entry names an `installPath` that no longer exists; OPTIONAL, not
|
|
23103
|
+
* required, so a build that predates the member keeps getting its 200.
|
|
23104
|
+
* Bounded like `version`.
|
|
23105
|
+
*/
|
|
23106
|
+
installedVersion: external_exports.string().max(64).nullable().optional(),
|
|
23107
|
+
/**
|
|
23108
|
+
* The local-store schema version this running build migrates a store to:
|
|
23109
|
+
* the number of store migrations it carries, the count it stamps into
|
|
23110
|
+
* `PRAGMA user_version`. A snapshot whose `schemaVersion` is above it
|
|
23111
|
+
* usually describes a store a newer build migrated. It is a hint, not a
|
|
23112
|
+
* verdict: the stamp is write-only, so a store whose count ran past this
|
|
23113
|
+
* build's while this build knows every migration in its ledger reads above
|
|
23114
|
+
* it too, which is why describeStoreSkew decides skew on ledger tags and
|
|
23115
|
+
* never on the count. OPTIONAL for the same reason as `installedVersion`;
|
|
23116
|
+
* bounded like `schemaVersion`.
|
|
23117
|
+
*/
|
|
23118
|
+
buildSchemaVersion: external_exports.number().int().min(0).max(MAX_INT4).optional()
|
|
22989
23119
|
}).meta({ id: "StorePosturePlugin" });
|
|
22990
23120
|
var StorePostureSnapshot = external_exports.object({
|
|
22991
23121
|
deviceId: external_exports.guid(),
|
|
@@ -23188,6 +23318,130 @@ var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
|
23188
23318
|
var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
|
|
23189
23319
|
var PublisherKind = external_exports.enum(["labs", "user", "org"]);
|
|
23190
23320
|
|
|
23321
|
+
// ../../packages/schema/src/zod/builtin-policy-id.ts
|
|
23322
|
+
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
23323
|
+
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
23324
|
+
|
|
23325
|
+
// ../../packages/schema/src/zod/event.ts
|
|
23326
|
+
var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
|
|
23327
|
+
var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
|
|
23328
|
+
var EventMetadata = external_exports.object({
|
|
23329
|
+
sessionId: external_exports.string().optional(),
|
|
23330
|
+
repo: external_exports.string().optional(),
|
|
23331
|
+
filePath: external_exports.string().optional(),
|
|
23332
|
+
// The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
|
|
23333
|
+
// set by the tool-scanning hooks. The tool NAME only — never the tool's
|
|
23334
|
+
// arguments or output, which can carry the very value a finding masked
|
|
23335
|
+
// (metadata is stored unredacted). Gives findings on non-file captures a
|
|
23336
|
+
// display location ("via Bash") when no filePath exists.
|
|
23337
|
+
toolName: external_exports.string().optional(),
|
|
23338
|
+
// Set (true) by the worktree scanner when the file is excluded by the
|
|
23339
|
+
// repo's .gitignore. Gitignored files ARE still scanned — local scratch and
|
|
23340
|
+
// generated code can leak real secrets — but the provenance is recorded so
|
|
23341
|
+
// policy/dashboards can treat those findings as informational rather than
|
|
23342
|
+
// blocking. Omitted (not false) for tracked files and non-scan events.
|
|
23343
|
+
gitignored: external_exports.boolean().optional(),
|
|
23344
|
+
// Set (true) ONLY when the event's `content` is the COMPLETE file at
|
|
23345
|
+
// capture time (a worktree scan reading from disk). Hook-captured edits
|
|
23346
|
+
// (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
|
|
23347
|
+
// this. The resolver-on-ingest keys its fixed-at-source dropout
|
|
23348
|
+
// diff on this marker: only a whole-file snapshot can prove a previously
|
|
23349
|
+
// open finding is gone; a fragment's absence proves nothing (the secret
|
|
23350
|
+
// may live outside the hunk). Omitted (not false) for fragments and
|
|
23351
|
+
// non-scan events, so pre-marker clients safely default to the
|
|
23352
|
+
// non-authoritative path.
|
|
23353
|
+
wholeFile: external_exports.boolean().optional(),
|
|
23354
|
+
model: external_exports.string().optional(),
|
|
23355
|
+
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
23356
|
+
// Distributed-tracing correlation. `correlationId` ties a recorded event back
|
|
23357
|
+
// to the request that captured/ingested it (a UUID, generated independently of
|
|
23358
|
+
// the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
|
|
23359
|
+
// originating span when telemetry is enabled. Both optional + backward
|
|
23360
|
+
// compatible — populated by the plugin (see @akasecurity/plugin-sdk).
|
|
23361
|
+
correlationId: external_exports.uuid().optional(),
|
|
23362
|
+
traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
|
|
23363
|
+
// Ids of the detection exceptions that downgraded findings in this capture
|
|
23364
|
+
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
23365
|
+
// authorized the bypass. Absent on captures where no exception applied.
|
|
23366
|
+
exceptionIds: external_exports.array(external_exports.guid()).optional(),
|
|
23367
|
+
// The assistant message this capture belongs to, and the conversation it sits
|
|
23368
|
+
// in — set by the browser extension's network capture so a stored `response`
|
|
23369
|
+
// row can be joined to the `llm_call` leaf describing the same turn. Absent
|
|
23370
|
+
// on every other capture path, which has no such id.
|
|
23371
|
+
//
|
|
23372
|
+
// Non-empty for the reason WebExchange.messageId is: it is the join key, and
|
|
23373
|
+
// a blank one matches no `llm_call` leaf. That refusal reaches only the
|
|
23374
|
+
// places an event is PARSED; the local write path types the event and parses
|
|
23375
|
+
// nothing, which is why `toCaptureAttributes` omits a blank one separately.
|
|
23376
|
+
messageId: external_exports.string().min(1).optional(),
|
|
23377
|
+
conversationId: external_exports.string().optional(),
|
|
23378
|
+
// How long THIS capture's inspection blocked its caller, in whole
|
|
23379
|
+
// milliseconds — the plugin's own added latency, NOT the LLM call it sat in
|
|
23380
|
+
// front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
|
|
23381
|
+
// detection + redaction, the work the host session actually waits on.
|
|
23382
|
+
//
|
|
23383
|
+
// Stamped ONLY on live in-flight captures. A capture that carries its own
|
|
23384
|
+
// `occurredAt` is replaying past work (the transcript backfill, the worktree
|
|
23385
|
+
// scan), and its scan duration is not latency any host session experienced,
|
|
23386
|
+
// so those rows leave this ABSENT rather than reporting a misleading number.
|
|
23387
|
+
// Absent is also what every pre-measurement client writes, and what a
|
|
23388
|
+
// clock failure degrades to — a reader must treat absence as "not measured"
|
|
23389
|
+
// and never as a zero, which would read as "inspection is free".
|
|
23390
|
+
inspectionMs: external_exports.number().int().nonnegative().optional(),
|
|
23391
|
+
// What a `redact` this capture COULD NOT CARRY OUT became instead — the
|
|
23392
|
+
// workspace's `redactFallback`, applied because the field could not be
|
|
23393
|
+
// masked in place (a shell command, a URL, or any argument on a host whose
|
|
23394
|
+
// hook contract offers no rewrite channel).
|
|
23395
|
+
//
|
|
23396
|
+
// It exists because the action alone cannot say why. A finding recorded as
|
|
23397
|
+
// `warn` reads identically whether its detection was ASSIGNED Warn or was
|
|
23398
|
+
// assigned Redact on a field that could not take one — and those are
|
|
23399
|
+
// different facts about the same row: the first is a policy the user chose,
|
|
23400
|
+
// the second is a masking the host could not perform. Absent means no
|
|
23401
|
+
// degrade happened, which is every ordinary capture.
|
|
23402
|
+
//
|
|
23403
|
+
// TWO LIMITS a reader of a stored row has to know, because the grain here
|
|
23404
|
+
// is the CAPTURE while `actionTaken` is per FINDING:
|
|
23405
|
+
//
|
|
23406
|
+
// - It does not say WHICH finding degraded. A capture carrying a degraded
|
|
23407
|
+
// `redact` alongside a finding ASSIGNED the same action stores both
|
|
23408
|
+
// identically and one reason for the pair; attributing it to both
|
|
23409
|
+
// describes the assigned one wrongly, and to neither loses the degrade.
|
|
23410
|
+
// - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
|
|
23411
|
+
// became, not the reason the capture ended as it did — a capture denied
|
|
23412
|
+
// by some other finding's own Block policy still carries `block` here,
|
|
23413
|
+
// and clearing the workspace's fallback would not have let it through.
|
|
23414
|
+
// Gate on the value against what a fallback can produce; never read the
|
|
23415
|
+
// field's presence as "this was the fallback's doing".
|
|
23416
|
+
//
|
|
23417
|
+
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
23418
|
+
// Closing either means moving the reason onto the finding row, which
|
|
23419
|
+
// already carries its own action.
|
|
23420
|
+
redactDegradedTo: ActionTaken.optional()
|
|
23421
|
+
}).meta({ id: "EventMetadata" });
|
|
23422
|
+
var Event = external_exports.object({
|
|
23423
|
+
id: external_exports.guid(),
|
|
23424
|
+
sourceTool: SourceTool,
|
|
23425
|
+
kind: EventKind,
|
|
23426
|
+
occurredAt: external_exports.iso.datetime(),
|
|
23427
|
+
contentHash: external_exports.string(),
|
|
23428
|
+
content: external_exports.string(),
|
|
23429
|
+
metadata: EventMetadata.optional()
|
|
23430
|
+
}).meta({ id: "Event" });
|
|
23431
|
+
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
23432
|
+
var INGEST_BATCH_MAX = 100;
|
|
23433
|
+
var IngestBatch = external_exports.object({
|
|
23434
|
+
events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
|
|
23435
|
+
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
23436
|
+
// additionally rejects any event whose contentHash the store has already
|
|
23437
|
+
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
23438
|
+
// backfill), where a re-run mints fresh event ids for identical content and
|
|
23439
|
+
// would otherwise accumulate duplicates. Live hook traffic must NOT set it:
|
|
23440
|
+
// two genuinely separate prompts can be byte-identical and both belong on
|
|
23441
|
+
// the timeline.
|
|
23442
|
+
dedupe: external_exports.literal("content-hash").optional()
|
|
23443
|
+
}).meta({ id: "IngestBatch" });
|
|
23444
|
+
|
|
23191
23445
|
// ../../packages/schema/src/zod/rule.ts
|
|
23192
23446
|
var MatcherType = external_exports.enum(["keyword", "regex"]).meta({ id: "MatcherType" });
|
|
23193
23447
|
var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
|
|
@@ -23256,7 +23510,10 @@ var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, Regex
|
|
|
23256
23510
|
var MATCHER_TYPES = MatcherType.options;
|
|
23257
23511
|
var AppliesTo = external_exports.strictObject({
|
|
23258
23512
|
// Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
|
|
23259
|
-
extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1)
|
|
23513
|
+
extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1).optional(),
|
|
23514
|
+
eventKinds: external_exports.array(EventKind).min(1).optional()
|
|
23515
|
+
}).refine((v) => v.extensions !== void 0 || v.eventKinds !== void 0, {
|
|
23516
|
+
message: "appliesTo needs extensions, eventKinds, or both"
|
|
23260
23517
|
}).meta({ id: "AppliesTo" });
|
|
23261
23518
|
var PostValidatorName = external_exports.enum(["entropy", "luhn"]).meta({ id: "PostValidatorName" });
|
|
23262
23519
|
var PostValidatorRef = external_exports.union(
|
|
@@ -23279,6 +23536,7 @@ var PostValidatorRef = external_exports.union(
|
|
|
23279
23536
|
)}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`
|
|
23280
23537
|
}
|
|
23281
23538
|
).meta({ id: "PostValidatorRef" });
|
|
23539
|
+
var RuleEvidence = external_exports.enum(["code", "value"]).meta({ id: "RuleEvidence" });
|
|
23282
23540
|
var RequiresNearby = external_exports.strictObject({
|
|
23283
23541
|
// Each array, when present, must be non-empty and contain non-empty strings —
|
|
23284
23542
|
// an empty/blank criterion would either never fire or (for labels) match
|
|
@@ -23301,6 +23559,8 @@ var RuleFixture = external_exports.strictObject({
|
|
|
23301
23559
|
// Simulated file context for the scan, so fixtures can assert `appliesTo`
|
|
23302
23560
|
// gating (e.g. a Python-only pattern must NOT fire in a .ts file).
|
|
23303
23561
|
filePath: external_exports.string().optional(),
|
|
23562
|
+
// Simulated capture kind, so fixtures can assert `appliesTo.eventKinds`.
|
|
23563
|
+
eventKind: EventKind.optional(),
|
|
23304
23564
|
expectedSpans: external_exports.array(external_exports.strictObject({ start: external_exports.number(), end: external_exports.number() })).optional()
|
|
23305
23565
|
}).meta({ id: "RuleFixture" });
|
|
23306
23566
|
var Rule = external_exports.strictObject({
|
|
@@ -23326,7 +23586,9 @@ var Rule = external_exports.strictObject({
|
|
|
23326
23586
|
appliesTo: AppliesTo.optional(),
|
|
23327
23587
|
postValidators: external_exports.array(PostValidatorRef).optional(),
|
|
23328
23588
|
requiresNearby: RequiresNearby.optional(),
|
|
23329
|
-
examples: external_exports.array(external_exports.string()).optional()
|
|
23589
|
+
examples: external_exports.array(external_exports.string()).optional(),
|
|
23590
|
+
// Whether the matched text is itself sensitive. Absent means 'value'.
|
|
23591
|
+
evidence: RuleEvidence.optional()
|
|
23330
23592
|
}).meta({ id: "Rule" });
|
|
23331
23593
|
var Author = external_exports.object({
|
|
23332
23594
|
name: external_exports.string(),
|
|
@@ -23343,7 +23605,11 @@ var PackManifest = external_exports.object({
|
|
|
23343
23605
|
description: external_exports.string().optional(),
|
|
23344
23606
|
author: Author.optional(),
|
|
23345
23607
|
license: external_exports.string().optional(),
|
|
23346
|
-
sourceUrl: external_exports.url().optional()
|
|
23608
|
+
sourceUrl: external_exports.url().optional(),
|
|
23609
|
+
// The built-in policy a FIRST install of this pack assigns
|
|
23610
|
+
// (installed_packs.policy_id). Absent leaves the pack unassigned, so its
|
|
23611
|
+
// rules follow the category policies. An existing install never takes it.
|
|
23612
|
+
defaultPolicy: BuiltinPolicyId.optional()
|
|
23347
23613
|
}).meta({ id: "PackManifest" });
|
|
23348
23614
|
|
|
23349
23615
|
// ../../packages/schema/src/zod/detection.ts
|
|
@@ -23371,10 +23637,12 @@ var DetectionListItem = external_exports.object({
|
|
|
23371
23637
|
// Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
|
|
23372
23638
|
// (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
|
|
23373
23639
|
// detection is a PACK, and its policy is the archetype applied to all its
|
|
23374
|
-
// rules. Absent == unassigned, which resolves to Monitor
|
|
23375
|
-
// (DEFAULT_PACK_POLICY_ID)
|
|
23376
|
-
//
|
|
23377
|
-
//
|
|
23640
|
+
// rules. Absent == unassigned, which resolves to Monitor by default
|
|
23641
|
+
// (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
|
|
23642
|
+
// (see the dashboard's `unassignedPolicy`). Every enforcement surface
|
|
23643
|
+
// expands it into per-rule policies (see policyIdToAction). Typed
|
|
23644
|
+
// z.string() (not the enum) to keep the OpenAPI response tolerant of a
|
|
23645
|
+
// future custom id.
|
|
23378
23646
|
policyId: external_exports.string().optional(),
|
|
23379
23647
|
// Set ONLY when a newer snapshot is available for this pack (OSS: the
|
|
23380
23648
|
// bundled inventory recorded in available_packs differs from the installed
|
|
@@ -23443,10 +23711,12 @@ var DetectionDetail = external_exports.object({
|
|
|
23443
23711
|
// Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
|
|
23444
23712
|
// (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
|
|
23445
23713
|
// detection is a PACK, and its policy is the archetype applied to all its
|
|
23446
|
-
// rules. Absent == unassigned, which resolves to Monitor
|
|
23447
|
-
// (DEFAULT_PACK_POLICY_ID)
|
|
23448
|
-
//
|
|
23449
|
-
//
|
|
23714
|
+
// rules. Absent == unassigned, which resolves to Monitor by default
|
|
23715
|
+
// (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
|
|
23716
|
+
// (see the dashboard's `unassignedPolicy`). Every enforcement surface
|
|
23717
|
+
// expands it into per-rule policies (see policyIdToAction). Typed
|
|
23718
|
+
// z.string() (not the enum) to keep the OpenAPI response tolerant of a
|
|
23719
|
+
// future custom id.
|
|
23450
23720
|
policyId: external_exports.string().optional()
|
|
23451
23721
|
}).meta({ id: "DetectionDetail" });
|
|
23452
23722
|
var LibraryItem = external_exports.object({
|
|
@@ -23476,126 +23746,6 @@ var ImportDetectionRequest = external_exports.object({
|
|
|
23476
23746
|
})
|
|
23477
23747
|
}).meta({ id: "ImportDetectionRequest" });
|
|
23478
23748
|
|
|
23479
|
-
// ../../packages/schema/src/zod/event.ts
|
|
23480
|
-
var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
|
|
23481
|
-
var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
|
|
23482
|
-
var EventMetadata = external_exports.object({
|
|
23483
|
-
sessionId: external_exports.string().optional(),
|
|
23484
|
-
repo: external_exports.string().optional(),
|
|
23485
|
-
filePath: external_exports.string().optional(),
|
|
23486
|
-
// The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
|
|
23487
|
-
// set by the tool-scanning hooks. The tool NAME only — never the tool's
|
|
23488
|
-
// arguments or output, which can carry the very value a finding masked
|
|
23489
|
-
// (metadata is stored unredacted). Gives findings on non-file captures a
|
|
23490
|
-
// display location ("via Bash") when no filePath exists.
|
|
23491
|
-
toolName: external_exports.string().optional(),
|
|
23492
|
-
// Set (true) by the worktree scanner when the file is excluded by the
|
|
23493
|
-
// repo's .gitignore. Gitignored files ARE still scanned — local scratch and
|
|
23494
|
-
// generated code can leak real secrets — but the provenance is recorded so
|
|
23495
|
-
// policy/dashboards can treat those findings as informational rather than
|
|
23496
|
-
// blocking. Omitted (not false) for tracked files and non-scan events.
|
|
23497
|
-
gitignored: external_exports.boolean().optional(),
|
|
23498
|
-
// Set (true) ONLY when the event's `content` is the COMPLETE file at
|
|
23499
|
-
// capture time (a worktree scan reading from disk). Hook-captured edits
|
|
23500
|
-
// (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
|
|
23501
|
-
// this. The resolver-on-ingest keys its fixed-at-source dropout
|
|
23502
|
-
// diff on this marker: only a whole-file snapshot can prove a previously
|
|
23503
|
-
// open finding is gone; a fragment's absence proves nothing (the secret
|
|
23504
|
-
// may live outside the hunk). Omitted (not false) for fragments and
|
|
23505
|
-
// non-scan events, so pre-marker clients safely default to the
|
|
23506
|
-
// non-authoritative path.
|
|
23507
|
-
wholeFile: external_exports.boolean().optional(),
|
|
23508
|
-
model: external_exports.string().optional(),
|
|
23509
|
-
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
23510
|
-
// Distributed-tracing correlation. `correlationId` ties a recorded event back
|
|
23511
|
-
// to the request that captured/ingested it (a UUID, generated independently of
|
|
23512
|
-
// the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
|
|
23513
|
-
// originating span when telemetry is enabled. Both optional + backward
|
|
23514
|
-
// compatible — populated by the plugin (see @akasecurity/plugin-sdk).
|
|
23515
|
-
correlationId: external_exports.uuid().optional(),
|
|
23516
|
-
traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
|
|
23517
|
-
// Ids of the detection exceptions that downgraded findings in this capture
|
|
23518
|
-
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
23519
|
-
// authorized the bypass. Absent on captures where no exception applied.
|
|
23520
|
-
exceptionIds: external_exports.array(external_exports.guid()).optional(),
|
|
23521
|
-
// The assistant message this capture belongs to, and the conversation it sits
|
|
23522
|
-
// in — set by the browser extension's network capture so a stored `response`
|
|
23523
|
-
// row can be joined to the `llm_call` leaf describing the same turn. Absent
|
|
23524
|
-
// on every other capture path, which has no such id.
|
|
23525
|
-
//
|
|
23526
|
-
// Non-empty for the reason WebExchange.messageId is: it is the join key, and
|
|
23527
|
-
// a blank one matches no `llm_call` leaf. That refusal reaches only the
|
|
23528
|
-
// places an event is PARSED; the local write path types the event and parses
|
|
23529
|
-
// nothing, which is why `toCaptureAttributes` omits a blank one separately.
|
|
23530
|
-
messageId: external_exports.string().min(1).optional(),
|
|
23531
|
-
conversationId: external_exports.string().optional(),
|
|
23532
|
-
// How long THIS capture's inspection blocked its caller, in whole
|
|
23533
|
-
// milliseconds — the plugin's own added latency, NOT the LLM call it sat in
|
|
23534
|
-
// front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
|
|
23535
|
-
// detection + redaction, the work the host session actually waits on.
|
|
23536
|
-
//
|
|
23537
|
-
// Stamped ONLY on live in-flight captures. A capture that carries its own
|
|
23538
|
-
// `occurredAt` is replaying past work (the transcript backfill, the worktree
|
|
23539
|
-
// scan), and its scan duration is not latency any host session experienced,
|
|
23540
|
-
// so those rows leave this ABSENT rather than reporting a misleading number.
|
|
23541
|
-
// Absent is also what every pre-measurement client writes, and what a
|
|
23542
|
-
// clock failure degrades to — a reader must treat absence as "not measured"
|
|
23543
|
-
// and never as a zero, which would read as "inspection is free".
|
|
23544
|
-
inspectionMs: external_exports.number().int().nonnegative().optional(),
|
|
23545
|
-
// What a `redact` this capture COULD NOT CARRY OUT became instead — the
|
|
23546
|
-
// workspace's `redactFallback`, applied because the field could not be
|
|
23547
|
-
// masked in place (a shell command, a URL, or any argument on a host whose
|
|
23548
|
-
// hook contract offers no rewrite channel).
|
|
23549
|
-
//
|
|
23550
|
-
// It exists because the action alone cannot say why. A finding recorded as
|
|
23551
|
-
// `warn` reads identically whether its detection was ASSIGNED Warn or was
|
|
23552
|
-
// assigned Redact on a field that could not take one — and those are
|
|
23553
|
-
// different facts about the same row: the first is a policy the user chose,
|
|
23554
|
-
// the second is a masking the host could not perform. Absent means no
|
|
23555
|
-
// degrade happened, which is every ordinary capture.
|
|
23556
|
-
//
|
|
23557
|
-
// TWO LIMITS a reader of a stored row has to know, because the grain here
|
|
23558
|
-
// is the CAPTURE while `actionTaken` is per FINDING:
|
|
23559
|
-
//
|
|
23560
|
-
// - It does not say WHICH finding degraded. A capture carrying a degraded
|
|
23561
|
-
// `redact` alongside a finding ASSIGNED the same action stores both
|
|
23562
|
-
// identically and one reason for the pair; attributing it to both
|
|
23563
|
-
// describes the assigned one wrongly, and to neither loses the degrade.
|
|
23564
|
-
// - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
|
|
23565
|
-
// became, not the reason the capture ended as it did — a capture denied
|
|
23566
|
-
// by some other finding's own Block policy still carries `block` here,
|
|
23567
|
-
// and clearing the workspace's fallback would not have let it through.
|
|
23568
|
-
// Gate on the value against what a fallback can produce; never read the
|
|
23569
|
-
// field's presence as "this was the fallback's doing".
|
|
23570
|
-
//
|
|
23571
|
-
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
23572
|
-
// Closing either means moving the reason onto the finding row, which
|
|
23573
|
-
// already carries its own action.
|
|
23574
|
-
redactDegradedTo: ActionTaken.optional()
|
|
23575
|
-
}).meta({ id: "EventMetadata" });
|
|
23576
|
-
var Event = external_exports.object({
|
|
23577
|
-
id: external_exports.guid(),
|
|
23578
|
-
sourceTool: SourceTool,
|
|
23579
|
-
kind: EventKind,
|
|
23580
|
-
occurredAt: external_exports.iso.datetime(),
|
|
23581
|
-
contentHash: external_exports.string(),
|
|
23582
|
-
content: external_exports.string(),
|
|
23583
|
-
metadata: EventMetadata.optional()
|
|
23584
|
-
}).meta({ id: "Event" });
|
|
23585
|
-
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
23586
|
-
var INGEST_BATCH_MAX = 100;
|
|
23587
|
-
var IngestBatch = external_exports.object({
|
|
23588
|
-
events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
|
|
23589
|
-
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
23590
|
-
// additionally rejects any event whose contentHash the store has already
|
|
23591
|
-
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
23592
|
-
// backfill), where a re-run mints fresh event ids for identical content and
|
|
23593
|
-
// would otherwise accumulate duplicates. Live hook traffic must NOT set it:
|
|
23594
|
-
// two genuinely separate prompts can be byte-identical and both belong on
|
|
23595
|
-
// the timeline.
|
|
23596
|
-
dedupe: external_exports.literal("content-hash").optional()
|
|
23597
|
-
}).meta({ id: "IngestBatch" });
|
|
23598
|
-
|
|
23599
23749
|
// ../../packages/schema/src/zod/exception.ts
|
|
23600
23750
|
var ExceptionScope = external_exports.enum(["once", "temporary", "permanent"]);
|
|
23601
23751
|
var ExceptionConditions = external_exports.object({
|
|
@@ -23756,8 +23906,6 @@ var Policy = external_exports.object({
|
|
|
23756
23906
|
// test `prohibitedModels` passes and `reversibleRuleIds` fails.
|
|
23757
23907
|
provenance: PolicyProvenance.optional()
|
|
23758
23908
|
}).meta({ id: "Policy" });
|
|
23759
|
-
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
23760
|
-
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
23761
23909
|
var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
|
|
23762
23910
|
id: "RedactFallback"
|
|
23763
23911
|
});
|
|
@@ -23969,10 +24117,15 @@ var ParsedPointer = external_exports.object({
|
|
|
23969
24117
|
});
|
|
23970
24118
|
var VaultEntry = external_exports.object({
|
|
23971
24119
|
pointerId: external_exports.string(),
|
|
23972
|
-
// The keyed HMAC of the raw
|
|
23973
|
-
// derived under.
|
|
23974
|
-
// independently of the vault encryption
|
|
24120
|
+
// The keyed HMAC of the EXACT raw bytes under `exception.key`, and the epoch it
|
|
24121
|
+
// was derived under. The vault's own dedupe key: a value and its invisibly
|
|
24122
|
+
// padded twin are two rows. It rotates independently of the vault encryption
|
|
24123
|
+
// key below. Never matched against an exception or grant.
|
|
23975
24124
|
valueFingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
24125
|
+
// The same HMAC over the raw with invisible padding removed: the identity a
|
|
24126
|
+
// reveal-to-model grant and every exception match on. Shared by a value and
|
|
24127
|
+
// its padded twin.
|
|
24128
|
+
valueIdentityFingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
23976
24129
|
fingerprintKeyVersion: external_exports.number().int().positive(),
|
|
23977
24130
|
// The vault-key epoch this row's ciphertext was sealed under.
|
|
23978
24131
|
keyVersion: external_exports.number().int().positive(),
|
|
@@ -24113,7 +24266,7 @@ var VaultConsent = external_exports.object({
|
|
|
24113
24266
|
});
|
|
24114
24267
|
|
|
24115
24268
|
// ../../packages/schema/src/zod/local.ts
|
|
24116
|
-
var WORKSPACE_SETTINGS_SPEC_VERSION =
|
|
24269
|
+
var WORKSPACE_SETTINGS_SPEC_VERSION = 9;
|
|
24117
24270
|
var RunMode = external_exports.enum(["standalone", "attached"]);
|
|
24118
24271
|
var ControlPlaneConnection = external_exports.object({
|
|
24119
24272
|
endpoint: external_exports.string().min(1),
|
|
@@ -24132,6 +24285,18 @@ var HistorySyncConsent = external_exports.object({
|
|
|
24132
24285
|
payloadVersion: external_exports.number().int().positive(),
|
|
24133
24286
|
endpoint: external_exports.string()
|
|
24134
24287
|
});
|
|
24288
|
+
var ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH = 512;
|
|
24289
|
+
var AttachmentScopeEntry = external_exports.object({
|
|
24290
|
+
kind: external_exports.enum(["repo", "account"]),
|
|
24291
|
+
identity: printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH).min(1),
|
|
24292
|
+
label: printable(80).optional(),
|
|
24293
|
+
enrolledAt: external_exports.iso.datetime()
|
|
24294
|
+
});
|
|
24295
|
+
var AttachmentScope = external_exports.object({
|
|
24296
|
+
endpoint: external_exports.string().min(1),
|
|
24297
|
+
entries: external_exports.array(AttachmentScopeEntry)
|
|
24298
|
+
});
|
|
24299
|
+
var AttachmentScopeEnvelope = AttachmentScope.extend({ entries: external_exports.array(external_exports.unknown()) });
|
|
24135
24300
|
var WebChatCaptureConsent = external_exports.object({
|
|
24136
24301
|
acknowledgedAt: external_exports.iso.datetime(),
|
|
24137
24302
|
version: external_exports.number().int().positive()
|
|
@@ -24202,6 +24367,23 @@ var WorkspaceSettings = external_exports.object({
|
|
|
24202
24367
|
// both widenings. Absent until granted, and a grant for a different endpoint
|
|
24203
24368
|
// or an older payload no longer counts.
|
|
24204
24369
|
historySyncConsent: HistorySyncConsent.optional(),
|
|
24370
|
+
// The identities a SCOPED attachment forwards and the deployment they were
|
|
24371
|
+
// enrolled for (see AttachmentScope). Absent until something is enrolled.
|
|
24372
|
+
//
|
|
24373
|
+
// `z.unknown()`, NOT `AttachmentScope`, and the difference is this field's
|
|
24374
|
+
// whole failure mode. A settings.json that fails this schema reads as the
|
|
24375
|
+
// unonboarded defaults (readUserSettings in @akasecurity/persistence), and the
|
|
24376
|
+
// next save writes those defaults back over it. Typed, one entry with an
|
|
24377
|
+
// unknown `kind`, a control character or a bad timestamp would cost the
|
|
24378
|
+
// attachment, every consent and onboardedAt, permanently. Untyped, the value
|
|
24379
|
+
// is kept exactly as found and validated where it is used: parseAttachmentScope
|
|
24380
|
+
// drops a bad entry by itself, and on a scoped attachment resolveScope reads a
|
|
24381
|
+
// bad envelope as no entries, which keeps every event local.
|
|
24382
|
+
//
|
|
24383
|
+
// No default: absent must stay absent, so defaultWorkspaceSettings() and a
|
|
24384
|
+
// fresh settings.json do not change. No `.meta({ id })`, like every field
|
|
24385
|
+
// here. Not a ManagedSettingKey.
|
|
24386
|
+
attachmentScope: external_exports.unknown().optional(),
|
|
24205
24387
|
// What the browser extension may record from a web chat, and the grant that
|
|
24206
24388
|
// authorizes it. Absent until the user answers: recording something that was
|
|
24207
24389
|
// never recorded before is never an assumed grant on upgrade, so the whole
|
|
@@ -24414,10 +24596,18 @@ var SeveritySummaryItem = external_exports.object({
|
|
|
24414
24596
|
count: external_exports.number().int().nonnegative(),
|
|
24415
24597
|
// Resolution-aware breakdown (optional, additive). Populated once findings
|
|
24416
24598
|
// carry lifecycle state: `caught` = handled in-flight (enforced); `openAtRest`
|
|
24417
|
-
// = still open with no in-flight enforcement (needs remediation)
|
|
24418
|
-
//
|
|
24599
|
+
// = still open with no in-flight enforcement (needs remediation); `dismissed`
|
|
24600
|
+
// = closed by a human judgement rather than a fix — visible, but not counted as
|
|
24601
|
+
// needing remediation. The three are disjoint. Absent on the legacy count-only
|
|
24602
|
+
// response until the resolution feature lands.
|
|
24419
24603
|
caught: external_exports.number().int().nonnegative().optional(),
|
|
24420
|
-
openAtRest: external_exports.number().int().nonnegative().optional()
|
|
24604
|
+
openAtRest: external_exports.number().int().nonnegative().optional(),
|
|
24605
|
+
dismissed: external_exports.number().int().nonnegative().optional(),
|
|
24606
|
+
// The two halves of `caught`, for a reader that wants them apart: `handled` =
|
|
24607
|
+
// in-flight findings an enforcement action already contained; `resolved` =
|
|
24608
|
+
// at-rest findings closed out by fixing them. `handled + resolved === caught`.
|
|
24609
|
+
handled: external_exports.number().int().nonnegative().optional(),
|
|
24610
|
+
resolved: external_exports.number().int().nonnegative().optional()
|
|
24421
24611
|
}).meta({ id: "SeveritySummaryItem" });
|
|
24422
24612
|
var SeveritySummaryResponse = external_exports.object({
|
|
24423
24613
|
// Sum of bySeverity[].count.
|
|
@@ -24425,6 +24615,9 @@ var SeveritySummaryResponse = external_exports.object({
|
|
|
24425
24615
|
// Findings still open at rest (sum of bySeverity[].openAtRest). Optional and
|
|
24426
24616
|
// additive — absent on the legacy response until the resolution feature lands.
|
|
24427
24617
|
needsRemediation: external_exports.number().int().nonnegative().optional(),
|
|
24618
|
+
// Findings a user dismissed (sum of bySeverity[].dismissed). Excluded from
|
|
24619
|
+
// needsRemediation, and kept visible here so an accepted risk is not erased.
|
|
24620
|
+
dismissed: external_exports.number().int().nonnegative().optional(),
|
|
24428
24621
|
// All four severity levels are always present (count may be 0).
|
|
24429
24622
|
bySeverity: external_exports.array(SeveritySummaryItem)
|
|
24430
24623
|
}).meta({ id: "SeveritySummaryResponse" });
|
|
@@ -24956,7 +25149,8 @@ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS c
|
|
|
24956
25149
|
${latestResolutionStatusSql("f")} AS latest_status,
|
|
24957
25150
|
e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
|
|
24958
25151
|
e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
|
|
24959
|
-
e.outbox_owed AS outbox_owed
|
|
25152
|
+
e.outbox_owed AS outbox_owed,
|
|
25153
|
+
f.line AS line, f.col AS col`;
|
|
24960
25154
|
|
|
24961
25155
|
// ../../packages/persistence/src/repositories/installed-packs.ts
|
|
24962
25156
|
import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
|
|
@@ -25062,6 +25256,7 @@ var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
|
|
|
25062
25256
|
// ../../packages/persistence/src/egress-wire.ts
|
|
25063
25257
|
import { createHash as createHash3 } from "crypto";
|
|
25064
25258
|
var SLASH = "/".charCodeAt(0);
|
|
25259
|
+
var SCOPE_KEY = printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH);
|
|
25065
25260
|
|
|
25066
25261
|
// ../../packages/persistence/src/finding-key.ts
|
|
25067
25262
|
import { createHash as createHash4 } from "crypto";
|
|
@@ -25734,6 +25929,10 @@ function escapeRegExp2(value) {
|
|
|
25734
25929
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25735
25930
|
}
|
|
25736
25931
|
|
|
25932
|
+
// ../../packages/detections/src/format-chars.ts
|
|
25933
|
+
var HAS_FORMAT_CHAR = new RegExp("\\p{Cf}", "u");
|
|
25934
|
+
var FORMAT_CHAR_GLOBAL = new RegExp("\\p{Cf}", "gu");
|
|
25935
|
+
|
|
25737
25936
|
// ../../packages/detections/src/regex-cache.ts
|
|
25738
25937
|
var singles = /* @__PURE__ */ new WeakMap();
|
|
25739
25938
|
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
@@ -25970,6 +26169,7 @@ var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
|
25970
26169
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
25971
26170
|
import { existsSync as existsSync9, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
|
|
25972
26171
|
import { basename as basename2, dirname as dirname4, isAbsolute, join as join17, sep as sep2 } from "path";
|
|
26172
|
+
var NO_ATTRIBUTION = Object.freeze({});
|
|
25973
26173
|
|
|
25974
26174
|
// ../../packages/plugin-sdk/src/events.ts
|
|
25975
26175
|
import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
|
|
@@ -26044,6 +26244,9 @@ import { join as join23 } from "path";
|
|
|
26044
26244
|
import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
|
|
26045
26245
|
import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
|
|
26046
26246
|
|
|
26247
|
+
// ../../packages/plugin-sdk/src/policy-resolver.ts
|
|
26248
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
26249
|
+
|
|
26047
26250
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
26048
26251
|
import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
|
|
26049
26252
|
import { basename as basename5, join as join24 } from "path";
|
|
@@ -26075,14 +26278,18 @@ var codexProviderEnvShape = {
|
|
|
26075
26278
|
var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
|
|
26076
26279
|
|
|
26077
26280
|
// ../../packages/plugin-sdk/src/runtime.ts
|
|
26078
|
-
import { randomUUID as
|
|
26281
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
26282
|
+
|
|
26283
|
+
// ../../packages/plugin-sdk/src/scope-key.ts
|
|
26284
|
+
import { existsSync as existsSync12 } from "fs";
|
|
26285
|
+
import { dirname as dirname6, isAbsolute as isAbsolute2, join as join25, normalize } from "path";
|
|
26079
26286
|
|
|
26080
26287
|
// ../../packages/plugin-sdk/src/suppressions.ts
|
|
26081
26288
|
var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
26082
26289
|
|
|
26083
26290
|
// ../../packages/plugin-sdk/src/throttle.ts
|
|
26084
26291
|
import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
26085
|
-
import { join as
|
|
26292
|
+
import { join as join26 } from "path";
|
|
26086
26293
|
|
|
26087
26294
|
// ../../packages/setup-wizard/src/onboard-posture.ts
|
|
26088
26295
|
function parsePosture(json2) {
|
|
@@ -26121,7 +26328,7 @@ function parseCurrent(json2) {
|
|
|
26121
26328
|
|
|
26122
26329
|
// ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
|
|
26123
26330
|
import { writeFileSync as writeFileSync8 } from "fs";
|
|
26124
|
-
import { join as
|
|
26331
|
+
import { join as join27 } from "path";
|
|
26125
26332
|
|
|
26126
26333
|
// ../../packages/setup-wizard/src/triage/gate-display.ts
|
|
26127
26334
|
var ACTION_RANK = {
|
|
@@ -26150,7 +26357,7 @@ var RANK = Object.fromEntries(
|
|
|
26150
26357
|
// ../../packages/setup-wizard/src/triage/plan-file.ts
|
|
26151
26358
|
import { mkdtempSync, readFileSync as readFileSync17, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
|
|
26152
26359
|
import { tmpdir } from "os";
|
|
26153
|
-
import { basename as basename6, dirname as
|
|
26360
|
+
import { basename as basename6, dirname as dirname7, join as join28 } from "path";
|
|
26154
26361
|
var SuppressionEntrySchema = external_exports.object({
|
|
26155
26362
|
ruleId: external_exports.string(),
|
|
26156
26363
|
category: DetectionCategory,
|
|
@@ -26276,7 +26483,7 @@ function show(body) {
|
|
|
26276
26483
|
|
|
26277
26484
|
// src/skills-registry.ts
|
|
26278
26485
|
import { readdirSync as readdirSync5, readFileSync as readFileSync18 } from "fs";
|
|
26279
|
-
import { join as
|
|
26486
|
+
import { join as join29 } from "path";
|
|
26280
26487
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
26281
26488
|
var SKILLS_DIR = fileURLToPath2(new URL("../skills", import.meta.url));
|
|
26282
26489
|
|