@akasecurity/ai-tc-codex 0.9.22 → 0.9.24
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/package.json +1 -1
- package/scripts/apply-suppressions.js +148 -31
- package/scripts/backfill.js +186 -40
- package/scripts/content-retention.js +97 -19
- package/scripts/filescan.js +242 -85
- package/scripts/firstrun.js +174 -47
- package/scripts/history-sync.js +160 -34
- package/scripts/intro.js +32 -6
- package/scripts/onboard.js +122 -24
- package/scripts/post-tool-use.js +200 -54
- package/scripts/pre-tool-use.js +200 -54
- package/scripts/query.js +173 -46
- package/scripts/reconcile.js +196 -51
- package/scripts/remediate.js +190 -40
- package/scripts/scan-worker.js +74 -14
- package/scripts/session-start.js +280 -120
- package/scripts/start-light.js +32 -6
- package/scripts/stop.js +178 -51
- package/scripts/sync.js +244 -87
- package/scripts/user-prompt-submit.js +206 -60
package/scripts/scan-worker.js
CHANGED
|
@@ -8329,7 +8329,11 @@ var ListFindingTypesQuery = object({
|
|
|
8329
8329
|
// and so is not bounded by what any page happens to hold.
|
|
8330
8330
|
includeId: string2().optional(),
|
|
8331
8331
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
8332
|
-
cursor: string2().optional()
|
|
8332
|
+
cursor: string2().optional(),
|
|
8333
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8334
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8335
|
+
// from wherever it lands.
|
|
8336
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8333
8337
|
});
|
|
8334
8338
|
var ListFindingTypesResponse = object({
|
|
8335
8339
|
totals: object({
|
|
@@ -8409,7 +8413,11 @@ var ListFindingInstancesQuery = object({
|
|
|
8409
8413
|
sessionId: string2().optional(),
|
|
8410
8414
|
from: iso_exports.datetime().optional(),
|
|
8411
8415
|
limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
8412
|
-
cursor: string2().optional()
|
|
8416
|
+
cursor: string2().optional(),
|
|
8417
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8418
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8419
|
+
// from wherever it lands.
|
|
8420
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8413
8421
|
});
|
|
8414
8422
|
var ListFindingInstancesResponse = object({
|
|
8415
8423
|
// Instances matching the filters across the whole scope, not just this
|
|
@@ -8480,7 +8488,11 @@ var ListFindingLocationsQuery = object({
|
|
|
8480
8488
|
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
8481
8489
|
includeId: string2().optional(),
|
|
8482
8490
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
8483
|
-
cursor: string2().optional()
|
|
8491
|
+
cursor: string2().optional(),
|
|
8492
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8493
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8494
|
+
// from wherever it lands.
|
|
8495
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8484
8496
|
});
|
|
8485
8497
|
var ListFindingLocationsResponse = object({
|
|
8486
8498
|
totals: object({
|
|
@@ -10877,7 +10889,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
10877
10889
|
var ListVaultInventoryQuery = object({
|
|
10878
10890
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
10879
10891
|
// Opaque; names the last row of the page just served.
|
|
10880
|
-
cursor: string2().optional()
|
|
10892
|
+
cursor: string2().optional(),
|
|
10893
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
10894
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
10895
|
+
// from wherever it lands.
|
|
10896
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
10881
10897
|
});
|
|
10882
10898
|
var ListVaultInventoryResponse = object({
|
|
10883
10899
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -10889,7 +10905,11 @@ var ListVaultInventoryResponse = object({
|
|
|
10889
10905
|
});
|
|
10890
10906
|
var ListVaultReuseQuery = object({
|
|
10891
10907
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
10892
|
-
cursor: string2().optional()
|
|
10908
|
+
cursor: string2().optional(),
|
|
10909
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
10910
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
10911
|
+
// from wherever it lands.
|
|
10912
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
10893
10913
|
});
|
|
10894
10914
|
var ListVaultReuseResponse = object({
|
|
10895
10915
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -10905,9 +10925,15 @@ var ListVaultDerefsQuery = object({
|
|
|
10905
10925
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
10906
10926
|
includeBatched: boolean2().optional(),
|
|
10907
10927
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
10908
|
-
cursor: string2().optional()
|
|
10928
|
+
cursor: string2().optional(),
|
|
10929
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
10930
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
10931
|
+
// from wherever it lands.
|
|
10932
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
10909
10933
|
});
|
|
10910
10934
|
var ListVaultDerefsResponse = object({
|
|
10935
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
10936
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
10911
10937
|
items: array(VaultDeref),
|
|
10912
10938
|
nextCursor: string2().nullable(),
|
|
10913
10939
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -13495,6 +13521,21 @@ function passesPostValidators(rule, value) {
|
|
|
13495
13521
|
function getLoadedRules() {
|
|
13496
13522
|
return [...packs.values()].flatMap((p) => p.rules);
|
|
13497
13523
|
}
|
|
13524
|
+
function outsideWrittenRegions(candidates, context) {
|
|
13525
|
+
const regions = context?.writtenRegions;
|
|
13526
|
+
if (!regions || regions.length === 0 || context.eventKind !== "tool_use") return candidates;
|
|
13527
|
+
return candidates.filter((c) => {
|
|
13528
|
+
if (c.rule.category !== "code_flaw") return true;
|
|
13529
|
+
const { start, end } = c.match.span;
|
|
13530
|
+
return !regions.some(
|
|
13531
|
+
(r) => r.start <= start && end <= r.end && ruleApplies(
|
|
13532
|
+
c.rule,
|
|
13533
|
+
r.filePath === void 0 ? void 0 : extensionOf(r.filePath),
|
|
13534
|
+
"code_change"
|
|
13535
|
+
)
|
|
13536
|
+
);
|
|
13537
|
+
});
|
|
13538
|
+
}
|
|
13498
13539
|
function spansOverlap(a, b) {
|
|
13499
13540
|
return a.start < b.end && a.end > b.start;
|
|
13500
13541
|
}
|
|
@@ -13682,17 +13723,20 @@ function scanEncoded(text, ruleset2, context) {
|
|
|
13682
13723
|
function scanText(text, ruleset2, context) {
|
|
13683
13724
|
const extension = context?.filePath ? extensionOf(context.filePath) : void 0;
|
|
13684
13725
|
const normalization = normalizeFormatChars(text);
|
|
13685
|
-
const originalCandidates =
|
|
13726
|
+
const originalCandidates = outsideWrittenRegions(
|
|
13727
|
+
buildCandidates(text, ruleset2, extension, context?.eventKind),
|
|
13728
|
+
context
|
|
13729
|
+
);
|
|
13686
13730
|
if (!normalization) return gate(originalCandidates, text, void 0);
|
|
13687
13731
|
const pooledOriginal = originalCandidates.map(
|
|
13688
13732
|
(candidate) => withNormalizedSpan(candidate, normalization)
|
|
13689
13733
|
);
|
|
13690
|
-
const normalizedCandidates =
|
|
13691
|
-
normalization.normalized,
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
context
|
|
13695
|
-
)
|
|
13734
|
+
const normalizedCandidates = outsideWrittenRegions(
|
|
13735
|
+
buildCandidates(normalization.normalized, ruleset2, extension, context?.eventKind).map(
|
|
13736
|
+
(candidate) => mapCandidateToOriginal(candidate, normalization, text)
|
|
13737
|
+
),
|
|
13738
|
+
context
|
|
13739
|
+
);
|
|
13696
13740
|
const findings = gate([...pooledOriginal, ...normalizedCandidates], text, normalization);
|
|
13697
13741
|
return mergeOverlappingSameRule(findings, text);
|
|
13698
13742
|
}
|
|
@@ -14015,6 +14059,21 @@ var ruleset = [...verified, ...unverified];
|
|
|
14015
14059
|
function post(message) {
|
|
14016
14060
|
port.postMessage(message);
|
|
14017
14061
|
}
|
|
14062
|
+
var MAX_REGIONS = 64;
|
|
14063
|
+
function validRegions(value, length) {
|
|
14064
|
+
if (!Array.isArray(value) || value.length === 0 || value.length > MAX_REGIONS) return void 0;
|
|
14065
|
+
let previousEnd = 0;
|
|
14066
|
+
for (const region of value) {
|
|
14067
|
+
if (typeof region !== "object" || region === null) return void 0;
|
|
14068
|
+
const { start, end, filePath } = region;
|
|
14069
|
+
if (filePath !== void 0 && typeof filePath !== "string") return void 0;
|
|
14070
|
+
if (typeof start !== "number" || typeof end !== "number") return void 0;
|
|
14071
|
+
if (!Number.isInteger(start) || !Number.isInteger(end)) return void 0;
|
|
14072
|
+
if (start < previousEnd || start >= end || end > length) return void 0;
|
|
14073
|
+
previousEnd = end;
|
|
14074
|
+
}
|
|
14075
|
+
return value;
|
|
14076
|
+
}
|
|
14018
14077
|
port.on("message", (job) => {
|
|
14019
14078
|
try {
|
|
14020
14079
|
if (job.kind === "probe") {
|
|
@@ -14030,7 +14089,8 @@ port.on("message", (job) => {
|
|
|
14030
14089
|
});
|
|
14031
14090
|
return;
|
|
14032
14091
|
}
|
|
14033
|
-
const
|
|
14092
|
+
const writtenRegions = validRegions(job.writtenRegions, job.text.length);
|
|
14093
|
+
const context = job.filePath === void 0 && job.eventKind === void 0 && writtenRegions === void 0 ? void 0 : { filePath: job.filePath, eventKind: job.eventKind, writtenRegions };
|
|
14034
14094
|
if (job.attribute) {
|
|
14035
14095
|
for (const [index, rule] of unverified.entries()) {
|
|
14036
14096
|
post({ kind: "progress", index });
|