@akasecurity/ai-tc-codex 0.9.5 → 0.9.6
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 +4 -4
- package/scripts/apply-suppressions.js +61 -13
- package/scripts/backfill.js +62 -13
- package/scripts/filescan.js +73 -24
- package/scripts/firstrun.js +52 -8
- package/scripts/intro.js +49 -5
- package/scripts/onboard.js +49 -5
- package/scripts/post-tool-use.js +62 -13
- package/scripts/pre-tool-use.js +62 -13
- package/scripts/query.js +54 -10
- package/scripts/reconcile.js +58 -10
- package/scripts/remediate.js +67 -18
- package/scripts/scan-worker.js +61 -12
- package/scripts/session-start.js +86 -32
- package/scripts/start-light.js +52 -8
- package/scripts/stop.js +49 -5
- package/scripts/user-prompt-submit.js +62 -13
- package/skills/setup/SKILL.md +17 -0
package/scripts/onboard.js
CHANGED
|
@@ -26123,6 +26123,40 @@ function escapeRegExp2(value) {
|
|
|
26123
26123
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26124
26124
|
}
|
|
26125
26125
|
|
|
26126
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26127
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26128
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26129
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26130
|
+
function listCache(kind) {
|
|
26131
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26132
|
+
}
|
|
26133
|
+
function memoizedRegExp(owner, build) {
|
|
26134
|
+
const cached2 = singles.get(owner);
|
|
26135
|
+
if (cached2 !== void 0) {
|
|
26136
|
+
cached2.lastIndex = 0;
|
|
26137
|
+
return cached2;
|
|
26138
|
+
}
|
|
26139
|
+
const compiled = build();
|
|
26140
|
+
singles.set(owner, compiled);
|
|
26141
|
+
return compiled;
|
|
26142
|
+
}
|
|
26143
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26144
|
+
const cache = listCache(kind);
|
|
26145
|
+
const cached2 = cache.get(owner);
|
|
26146
|
+
if (cached2 !== void 0) {
|
|
26147
|
+
if (cached2.stateful) {
|
|
26148
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26149
|
+
}
|
|
26150
|
+
return cached2.entries;
|
|
26151
|
+
}
|
|
26152
|
+
const entries = build();
|
|
26153
|
+
cache.set(owner, {
|
|
26154
|
+
entries,
|
|
26155
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26156
|
+
});
|
|
26157
|
+
return entries;
|
|
26158
|
+
}
|
|
26159
|
+
|
|
26126
26160
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26127
26161
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26128
26162
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26133,10 +26167,17 @@ var KeywordMatcher2 = class {
|
|
|
26133
26167
|
if (rule.matcher.type !== "keyword") return [];
|
|
26134
26168
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26135
26169
|
const spans = [];
|
|
26136
|
-
|
|
26137
|
-
|
|
26170
|
+
const compiled = memoizedRegExpList(
|
|
26171
|
+
"keyword",
|
|
26172
|
+
rule.matcher,
|
|
26173
|
+
() => keywords.map((kw) => {
|
|
26174
|
+
if (kw.length === 0) return void 0;
|
|
26175
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26176
|
+
})
|
|
26177
|
+
);
|
|
26178
|
+
for (const re of compiled) {
|
|
26179
|
+
if (re === void 0) continue;
|
|
26138
26180
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26139
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26140
26181
|
let m;
|
|
26141
26182
|
while ((m = re.exec(text)) !== null) {
|
|
26142
26183
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26152,7 +26193,10 @@ var RegexMatcher2 = class {
|
|
|
26152
26193
|
match(text, rule) {
|
|
26153
26194
|
if (rule.matcher.type !== "regex") return [];
|
|
26154
26195
|
const { pattern, flags: flags2, captureGroup } = rule.matcher;
|
|
26155
|
-
const re =
|
|
26196
|
+
const re = memoizedRegExp(
|
|
26197
|
+
rule.matcher,
|
|
26198
|
+
() => new RegExp(pattern, flags2.includes("d") ? flags2 : `${flags2}d`)
|
|
26199
|
+
);
|
|
26156
26200
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26157
26201
|
const spans = [];
|
|
26158
26202
|
let m;
|
|
@@ -26295,7 +26339,7 @@ function applyCategoryPosture(posture, repo, mode = "fill-gaps") {
|
|
|
26295
26339
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
26296
26340
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
26297
26341
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
26298
|
-
import { basename as basename5, join as join12
|
|
26342
|
+
import { basename as basename5, join as join12 } from "path";
|
|
26299
26343
|
|
|
26300
26344
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
26301
26345
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
package/scripts/post-tool-use.js
CHANGED
|
@@ -26077,6 +26077,40 @@ function escapeRegExp2(value) {
|
|
|
26077
26077
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26078
26078
|
}
|
|
26079
26079
|
|
|
26080
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26081
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26082
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26083
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26084
|
+
function listCache(kind) {
|
|
26085
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26086
|
+
}
|
|
26087
|
+
function memoizedRegExp(owner, build) {
|
|
26088
|
+
const cached2 = singles.get(owner);
|
|
26089
|
+
if (cached2 !== void 0) {
|
|
26090
|
+
cached2.lastIndex = 0;
|
|
26091
|
+
return cached2;
|
|
26092
|
+
}
|
|
26093
|
+
const compiled = build();
|
|
26094
|
+
singles.set(owner, compiled);
|
|
26095
|
+
return compiled;
|
|
26096
|
+
}
|
|
26097
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26098
|
+
const cache = listCache(kind);
|
|
26099
|
+
const cached2 = cache.get(owner);
|
|
26100
|
+
if (cached2 !== void 0) {
|
|
26101
|
+
if (cached2.stateful) {
|
|
26102
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26103
|
+
}
|
|
26104
|
+
return cached2.entries;
|
|
26105
|
+
}
|
|
26106
|
+
const entries = build();
|
|
26107
|
+
cache.set(owner, {
|
|
26108
|
+
entries,
|
|
26109
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26110
|
+
});
|
|
26111
|
+
return entries;
|
|
26112
|
+
}
|
|
26113
|
+
|
|
26080
26114
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26081
26115
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26082
26116
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26087,10 +26121,17 @@ var KeywordMatcher2 = class {
|
|
|
26087
26121
|
if (rule.matcher.type !== "keyword") return [];
|
|
26088
26122
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26089
26123
|
const spans = [];
|
|
26090
|
-
|
|
26091
|
-
|
|
26124
|
+
const compiled = memoizedRegExpList(
|
|
26125
|
+
"keyword",
|
|
26126
|
+
rule.matcher,
|
|
26127
|
+
() => keywords.map((kw) => {
|
|
26128
|
+
if (kw.length === 0) return void 0;
|
|
26129
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26130
|
+
})
|
|
26131
|
+
);
|
|
26132
|
+
for (const re of compiled) {
|
|
26133
|
+
if (re === void 0) continue;
|
|
26092
26134
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26093
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26094
26135
|
let m;
|
|
26095
26136
|
while ((m = re.exec(text)) !== null) {
|
|
26096
26137
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26106,7 +26147,10 @@ var RegexMatcher2 = class {
|
|
|
26106
26147
|
match(text, rule) {
|
|
26107
26148
|
if (rule.matcher.type !== "regex") return [];
|
|
26108
26149
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26109
|
-
const re =
|
|
26150
|
+
const re = memoizedRegExp(
|
|
26151
|
+
rule.matcher,
|
|
26152
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26153
|
+
);
|
|
26110
26154
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26111
26155
|
const spans = [];
|
|
26112
26156
|
let m;
|
|
@@ -26214,11 +26258,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
26214
26258
|
const labels = req.labels;
|
|
26215
26259
|
if (labels && labels.length > 0) {
|
|
26216
26260
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
26217
|
-
for (const
|
|
26218
|
-
|
|
26219
|
-
|
|
26220
|
-
|
|
26221
|
-
|
|
26261
|
+
for (const re of memoizedRegExpList(
|
|
26262
|
+
"label",
|
|
26263
|
+
req,
|
|
26264
|
+
() => labels.map((label) => {
|
|
26265
|
+
const trimmed = label.trim();
|
|
26266
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
26267
|
+
})
|
|
26268
|
+
)) {
|
|
26269
|
+
if (re?.test(haystack)) return true;
|
|
26222
26270
|
}
|
|
26223
26271
|
}
|
|
26224
26272
|
return false;
|
|
@@ -26486,13 +26534,14 @@ function probesFor(rule) {
|
|
|
26486
26534
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
26487
26535
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
26488
26536
|
}
|
|
26489
|
-
|
|
26537
|
+
var wallClock = () => performance.now();
|
|
26538
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
26490
26539
|
let ms = 0;
|
|
26491
26540
|
let probe = "";
|
|
26492
26541
|
for (const text of probesFor(rule)) {
|
|
26493
|
-
const start =
|
|
26542
|
+
const start = now();
|
|
26494
26543
|
scan(text, [rule]);
|
|
26495
|
-
const elapsed =
|
|
26544
|
+
const elapsed = now() - start;
|
|
26496
26545
|
if (elapsed > ms) {
|
|
26497
26546
|
ms = elapsed;
|
|
26498
26547
|
probe = text;
|
|
@@ -29113,7 +29162,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
29113
29162
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29114
29163
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29115
29164
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29116
|
-
import { basename as basename5, join as join12
|
|
29165
|
+
import { basename as basename5, join as join12 } from "path";
|
|
29117
29166
|
|
|
29118
29167
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
29119
29168
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
package/scripts/pre-tool-use.js
CHANGED
|
@@ -26077,6 +26077,40 @@ function escapeRegExp2(value) {
|
|
|
26077
26077
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26078
26078
|
}
|
|
26079
26079
|
|
|
26080
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26081
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26082
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26083
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26084
|
+
function listCache(kind) {
|
|
26085
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26086
|
+
}
|
|
26087
|
+
function memoizedRegExp(owner, build) {
|
|
26088
|
+
const cached2 = singles.get(owner);
|
|
26089
|
+
if (cached2 !== void 0) {
|
|
26090
|
+
cached2.lastIndex = 0;
|
|
26091
|
+
return cached2;
|
|
26092
|
+
}
|
|
26093
|
+
const compiled = build();
|
|
26094
|
+
singles.set(owner, compiled);
|
|
26095
|
+
return compiled;
|
|
26096
|
+
}
|
|
26097
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26098
|
+
const cache = listCache(kind);
|
|
26099
|
+
const cached2 = cache.get(owner);
|
|
26100
|
+
if (cached2 !== void 0) {
|
|
26101
|
+
if (cached2.stateful) {
|
|
26102
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26103
|
+
}
|
|
26104
|
+
return cached2.entries;
|
|
26105
|
+
}
|
|
26106
|
+
const entries = build();
|
|
26107
|
+
cache.set(owner, {
|
|
26108
|
+
entries,
|
|
26109
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26110
|
+
});
|
|
26111
|
+
return entries;
|
|
26112
|
+
}
|
|
26113
|
+
|
|
26080
26114
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26081
26115
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26082
26116
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26087,10 +26121,17 @@ var KeywordMatcher2 = class {
|
|
|
26087
26121
|
if (rule.matcher.type !== "keyword") return [];
|
|
26088
26122
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26089
26123
|
const spans = [];
|
|
26090
|
-
|
|
26091
|
-
|
|
26124
|
+
const compiled = memoizedRegExpList(
|
|
26125
|
+
"keyword",
|
|
26126
|
+
rule.matcher,
|
|
26127
|
+
() => keywords.map((kw) => {
|
|
26128
|
+
if (kw.length === 0) return void 0;
|
|
26129
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26130
|
+
})
|
|
26131
|
+
);
|
|
26132
|
+
for (const re of compiled) {
|
|
26133
|
+
if (re === void 0) continue;
|
|
26092
26134
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26093
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26094
26135
|
let m;
|
|
26095
26136
|
while ((m = re.exec(text)) !== null) {
|
|
26096
26137
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26106,7 +26147,10 @@ var RegexMatcher2 = class {
|
|
|
26106
26147
|
match(text, rule) {
|
|
26107
26148
|
if (rule.matcher.type !== "regex") return [];
|
|
26108
26149
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26109
|
-
const re =
|
|
26150
|
+
const re = memoizedRegExp(
|
|
26151
|
+
rule.matcher,
|
|
26152
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26153
|
+
);
|
|
26110
26154
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26111
26155
|
const spans = [];
|
|
26112
26156
|
let m;
|
|
@@ -26214,11 +26258,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
26214
26258
|
const labels = req.labels;
|
|
26215
26259
|
if (labels && labels.length > 0) {
|
|
26216
26260
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
26217
|
-
for (const
|
|
26218
|
-
|
|
26219
|
-
|
|
26220
|
-
|
|
26221
|
-
|
|
26261
|
+
for (const re of memoizedRegExpList(
|
|
26262
|
+
"label",
|
|
26263
|
+
req,
|
|
26264
|
+
() => labels.map((label) => {
|
|
26265
|
+
const trimmed = label.trim();
|
|
26266
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
26267
|
+
})
|
|
26268
|
+
)) {
|
|
26269
|
+
if (re?.test(haystack)) return true;
|
|
26222
26270
|
}
|
|
26223
26271
|
}
|
|
26224
26272
|
return false;
|
|
@@ -26486,13 +26534,14 @@ function probesFor(rule) {
|
|
|
26486
26534
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
26487
26535
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
26488
26536
|
}
|
|
26489
|
-
|
|
26537
|
+
var wallClock = () => performance.now();
|
|
26538
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
26490
26539
|
let ms = 0;
|
|
26491
26540
|
let probe = "";
|
|
26492
26541
|
for (const text of probesFor(rule)) {
|
|
26493
|
-
const start =
|
|
26542
|
+
const start = now();
|
|
26494
26543
|
scan(text, [rule]);
|
|
26495
|
-
const elapsed =
|
|
26544
|
+
const elapsed = now() - start;
|
|
26496
26545
|
if (elapsed > ms) {
|
|
26497
26546
|
ms = elapsed;
|
|
26498
26547
|
probe = text;
|
|
@@ -29110,7 +29159,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
29110
29159
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29111
29160
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29112
29161
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29113
|
-
import { basename as basename5, join as join12
|
|
29162
|
+
import { basename as basename5, join as join12 } from "path";
|
|
29114
29163
|
|
|
29115
29164
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
29116
29165
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
package/scripts/query.js
CHANGED
|
@@ -25986,6 +25986,40 @@ function escapeRegExp2(value) {
|
|
|
25986
25986
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25987
25987
|
}
|
|
25988
25988
|
|
|
25989
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
25990
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
25991
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
25992
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
25993
|
+
function listCache(kind) {
|
|
25994
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
25995
|
+
}
|
|
25996
|
+
function memoizedRegExp(owner, build) {
|
|
25997
|
+
const cached2 = singles.get(owner);
|
|
25998
|
+
if (cached2 !== void 0) {
|
|
25999
|
+
cached2.lastIndex = 0;
|
|
26000
|
+
return cached2;
|
|
26001
|
+
}
|
|
26002
|
+
const compiled = build();
|
|
26003
|
+
singles.set(owner, compiled);
|
|
26004
|
+
return compiled;
|
|
26005
|
+
}
|
|
26006
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26007
|
+
const cache = listCache(kind);
|
|
26008
|
+
const cached2 = cache.get(owner);
|
|
26009
|
+
if (cached2 !== void 0) {
|
|
26010
|
+
if (cached2.stateful) {
|
|
26011
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26012
|
+
}
|
|
26013
|
+
return cached2.entries;
|
|
26014
|
+
}
|
|
26015
|
+
const entries = build();
|
|
26016
|
+
cache.set(owner, {
|
|
26017
|
+
entries,
|
|
26018
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26019
|
+
});
|
|
26020
|
+
return entries;
|
|
26021
|
+
}
|
|
26022
|
+
|
|
25989
26023
|
// ../../packages/detections/src/matchers/limits.ts
|
|
25990
26024
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
25991
26025
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -25996,10 +26030,17 @@ var KeywordMatcher2 = class {
|
|
|
25996
26030
|
if (rule.matcher.type !== "keyword") return [];
|
|
25997
26031
|
const { keywords, caseSensitive } = rule.matcher;
|
|
25998
26032
|
const spans = [];
|
|
25999
|
-
|
|
26000
|
-
|
|
26033
|
+
const compiled = memoizedRegExpList(
|
|
26034
|
+
"keyword",
|
|
26035
|
+
rule.matcher,
|
|
26036
|
+
() => keywords.map((kw) => {
|
|
26037
|
+
if (kw.length === 0) return void 0;
|
|
26038
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26039
|
+
})
|
|
26040
|
+
);
|
|
26041
|
+
for (const re of compiled) {
|
|
26042
|
+
if (re === void 0) continue;
|
|
26001
26043
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26002
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26003
26044
|
let m;
|
|
26004
26045
|
while ((m = re.exec(text)) !== null) {
|
|
26005
26046
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26015,7 +26056,10 @@ var RegexMatcher2 = class {
|
|
|
26015
26056
|
match(text, rule) {
|
|
26016
26057
|
if (rule.matcher.type !== "regex") return [];
|
|
26017
26058
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26018
|
-
const re =
|
|
26059
|
+
const re = memoizedRegExp(
|
|
26060
|
+
rule.matcher,
|
|
26061
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26062
|
+
);
|
|
26019
26063
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26020
26064
|
const spans = [];
|
|
26021
26065
|
let m;
|
|
@@ -28173,7 +28217,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
28173
28217
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
28174
28218
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
28175
28219
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
28176
|
-
import { basename as basename5, join as join12
|
|
28220
|
+
import { basename as basename5, join as join12 } from "path";
|
|
28177
28221
|
|
|
28178
28222
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
28179
28223
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -28624,8 +28668,8 @@ function table(headers, rows, opts = {}) {
|
|
|
28624
28668
|
const widths = headers.map(
|
|
28625
28669
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
28626
28670
|
);
|
|
28627
|
-
const
|
|
28628
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
28671
|
+
const sep4 = " ".repeat(gap);
|
|
28672
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep4);
|
|
28629
28673
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
28630
28674
|
if (opts.rowSep === true) {
|
|
28631
28675
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -28637,7 +28681,7 @@ function table(headers, rows, opts = {}) {
|
|
|
28637
28681
|
});
|
|
28638
28682
|
return [headerLine, rule, ...body].join("\n");
|
|
28639
28683
|
}
|
|
28640
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
28684
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep4);
|
|
28641
28685
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
28642
28686
|
}
|
|
28643
28687
|
function fenced(body) {
|
|
@@ -28779,14 +28823,14 @@ function renderStatusBar(s, opts = {}) {
|
|
|
28779
28823
|
const unreviewed = `unreviewed ${SHADE.full}${String(u.critical)} ${SHADE.dark}${String(u.high)} ${SHADE.medium}${String(u.medium)} ${SHADE.light}${String(u.low)}`;
|
|
28780
28824
|
return `\u25B8\u25B8 AKA health ${String(s.score)}/100 ${unreviewed} \u2691 ${String(s.openFindings)} open findings`;
|
|
28781
28825
|
}
|
|
28782
|
-
const
|
|
28826
|
+
const sep4 = ` ${paint.dim("\u2502")} `;
|
|
28783
28827
|
const sq = "\u25A0";
|
|
28784
28828
|
const dot = s.score >= 80 ? paint.ok("\u25CF") : s.score >= 50 ? paint.high("\u25CF") : paint.critical("\u25CF");
|
|
28785
28829
|
const score = `${dot} health ${paint.bold(String(s.score))}${paint.dim("/100")}`;
|
|
28786
28830
|
const tally = `${paint.dim("unreviewed")} ${paint.critical(sq)}${String(u.critical)} ${paint.high(sq)}${String(u.high)} ${paint.medium(sq)}${String(u.medium)} ${paint.low(sq)}${String(u.low)}`;
|
|
28787
28831
|
const flag = s.openFindings > 0 ? paint.critical("\u2691") : paint.dim("\u2691");
|
|
28788
28832
|
const open2 = `${flag} ${String(s.openFindings)} open findings`;
|
|
28789
|
-
return `${paint.brand("\u25B8\u25B8 AKA")}${
|
|
28833
|
+
return `${paint.brand("\u25B8\u25B8 AKA")}${sep4}${score}${sep4}${tally}${sep4}${open2}`;
|
|
28790
28834
|
}
|
|
28791
28835
|
function findingStatus(summary) {
|
|
28792
28836
|
return {
|
package/scripts/reconcile.js
CHANGED
|
@@ -25932,6 +25932,40 @@ function escapeRegExp2(value) {
|
|
|
25932
25932
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25933
25933
|
}
|
|
25934
25934
|
|
|
25935
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
25936
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
25937
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
25938
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
25939
|
+
function listCache(kind) {
|
|
25940
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
25941
|
+
}
|
|
25942
|
+
function memoizedRegExp(owner, build) {
|
|
25943
|
+
const cached2 = singles.get(owner);
|
|
25944
|
+
if (cached2 !== void 0) {
|
|
25945
|
+
cached2.lastIndex = 0;
|
|
25946
|
+
return cached2;
|
|
25947
|
+
}
|
|
25948
|
+
const compiled = build();
|
|
25949
|
+
singles.set(owner, compiled);
|
|
25950
|
+
return compiled;
|
|
25951
|
+
}
|
|
25952
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
25953
|
+
const cache = listCache(kind);
|
|
25954
|
+
const cached2 = cache.get(owner);
|
|
25955
|
+
if (cached2 !== void 0) {
|
|
25956
|
+
if (cached2.stateful) {
|
|
25957
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
25958
|
+
}
|
|
25959
|
+
return cached2.entries;
|
|
25960
|
+
}
|
|
25961
|
+
const entries = build();
|
|
25962
|
+
cache.set(owner, {
|
|
25963
|
+
entries,
|
|
25964
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
25965
|
+
});
|
|
25966
|
+
return entries;
|
|
25967
|
+
}
|
|
25968
|
+
|
|
25935
25969
|
// ../../packages/detections/src/matchers/limits.ts
|
|
25936
25970
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
25937
25971
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -25942,10 +25976,17 @@ var KeywordMatcher2 = class {
|
|
|
25942
25976
|
if (rule.matcher.type !== "keyword") return [];
|
|
25943
25977
|
const { keywords, caseSensitive } = rule.matcher;
|
|
25944
25978
|
const spans = [];
|
|
25945
|
-
|
|
25946
|
-
|
|
25979
|
+
const compiled = memoizedRegExpList(
|
|
25980
|
+
"keyword",
|
|
25981
|
+
rule.matcher,
|
|
25982
|
+
() => keywords.map((kw) => {
|
|
25983
|
+
if (kw.length === 0) return void 0;
|
|
25984
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
25985
|
+
})
|
|
25986
|
+
);
|
|
25987
|
+
for (const re of compiled) {
|
|
25988
|
+
if (re === void 0) continue;
|
|
25947
25989
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
25948
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
25949
25990
|
let m;
|
|
25950
25991
|
while ((m = re.exec(text)) !== null) {
|
|
25951
25992
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -25961,7 +26002,10 @@ var RegexMatcher2 = class {
|
|
|
25961
26002
|
match(text, rule) {
|
|
25962
26003
|
if (rule.matcher.type !== "regex") return [];
|
|
25963
26004
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
25964
|
-
const re =
|
|
26005
|
+
const re = memoizedRegExp(
|
|
26006
|
+
rule.matcher,
|
|
26007
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26008
|
+
);
|
|
25965
26009
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
25966
26010
|
const spans = [];
|
|
25967
26011
|
let m;
|
|
@@ -26069,11 +26113,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
26069
26113
|
const labels = req.labels;
|
|
26070
26114
|
if (labels && labels.length > 0) {
|
|
26071
26115
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
26072
|
-
for (const
|
|
26073
|
-
|
|
26074
|
-
|
|
26075
|
-
|
|
26076
|
-
|
|
26116
|
+
for (const re of memoizedRegExpList(
|
|
26117
|
+
"label",
|
|
26118
|
+
req,
|
|
26119
|
+
() => labels.map((label) => {
|
|
26120
|
+
const trimmed = label.trim();
|
|
26121
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
26122
|
+
})
|
|
26123
|
+
)) {
|
|
26124
|
+
if (re?.test(haystack)) return true;
|
|
26077
26125
|
}
|
|
26078
26126
|
}
|
|
26079
26127
|
return false;
|
|
@@ -28492,7 +28540,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
28492
28540
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
28493
28541
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
28494
28542
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
28495
|
-
import { basename as basename5, join as join12
|
|
28543
|
+
import { basename as basename5, join as join12 } from "path";
|
|
28496
28544
|
|
|
28497
28545
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
28498
28546
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|