@akasecurity/ai-tc-antigravity 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/package.json +4 -4
- package/plugin.json +1 -1
- 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 +49 -5
- package/scripts/pre-invocation.js +86 -32
- 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/start-light.js +52 -8
- package/scripts/stop.js +49 -5
- package/skills/setup/SKILL.md +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akasecurity/ai-tc-antigravity",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "AI Traffic Control — inspect and govern AI prompts in Antigravity CLI",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"tsup": "^8.0.0",
|
|
27
27
|
"typescript": "^5.8.0",
|
|
28
28
|
"vitest": "^4.1.10",
|
|
29
|
+
"@akasecurity/persistence": "0.8.0",
|
|
29
30
|
"@akasecurity/eslint-config": "0.8.0",
|
|
30
31
|
"@akasecurity/plugin-runtime": "0.8.0",
|
|
31
|
-
"@akasecurity/scanner": "0.8.0",
|
|
32
|
-
"@akasecurity/schema": "0.8.0",
|
|
33
32
|
"@akasecurity/plugin-sdk": "0.8.0",
|
|
34
|
-
"@akasecurity/
|
|
33
|
+
"@akasecurity/schema": "0.8.0",
|
|
34
|
+
"@akasecurity/scanner": "0.8.0",
|
|
35
35
|
"@akasecurity/setup-wizard": "0.8.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://antigravity.google/schemas/v1/plugin.json",
|
|
3
3
|
"name": "aka-antigravity",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.6",
|
|
5
5
|
"description": "AI Traffic Control — inspect and govern AI prompts in Antigravity. Detection runs locally; events are recorded to a local SQLite store on your machine.",
|
|
6
6
|
"hooks": "./hooks.json",
|
|
7
7
|
"skills": "./skills",
|
|
@@ -25890,6 +25890,40 @@ function escapeRegExp2(value) {
|
|
|
25890
25890
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25891
25891
|
}
|
|
25892
25892
|
|
|
25893
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
25894
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
25895
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
25896
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
25897
|
+
function listCache(kind) {
|
|
25898
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
25899
|
+
}
|
|
25900
|
+
function memoizedRegExp(owner, build) {
|
|
25901
|
+
const cached2 = singles.get(owner);
|
|
25902
|
+
if (cached2 !== void 0) {
|
|
25903
|
+
cached2.lastIndex = 0;
|
|
25904
|
+
return cached2;
|
|
25905
|
+
}
|
|
25906
|
+
const compiled = build();
|
|
25907
|
+
singles.set(owner, compiled);
|
|
25908
|
+
return compiled;
|
|
25909
|
+
}
|
|
25910
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
25911
|
+
const cache = listCache(kind);
|
|
25912
|
+
const cached2 = cache.get(owner);
|
|
25913
|
+
if (cached2 !== void 0) {
|
|
25914
|
+
if (cached2.stateful) {
|
|
25915
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
25916
|
+
}
|
|
25917
|
+
return cached2.entries;
|
|
25918
|
+
}
|
|
25919
|
+
const entries = build();
|
|
25920
|
+
cache.set(owner, {
|
|
25921
|
+
entries,
|
|
25922
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
25923
|
+
});
|
|
25924
|
+
return entries;
|
|
25925
|
+
}
|
|
25926
|
+
|
|
25893
25927
|
// ../../packages/detections/src/matchers/limits.ts
|
|
25894
25928
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
25895
25929
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -25900,10 +25934,17 @@ var KeywordMatcher2 = class {
|
|
|
25900
25934
|
if (rule.matcher.type !== "keyword") return [];
|
|
25901
25935
|
const { keywords, caseSensitive } = rule.matcher;
|
|
25902
25936
|
const spans = [];
|
|
25903
|
-
|
|
25904
|
-
|
|
25937
|
+
const compiled = memoizedRegExpList(
|
|
25938
|
+
"keyword",
|
|
25939
|
+
rule.matcher,
|
|
25940
|
+
() => keywords.map((kw) => {
|
|
25941
|
+
if (kw.length === 0) return void 0;
|
|
25942
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
25943
|
+
})
|
|
25944
|
+
);
|
|
25945
|
+
for (const re of compiled) {
|
|
25946
|
+
if (re === void 0) continue;
|
|
25905
25947
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
25906
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
25907
25948
|
let m;
|
|
25908
25949
|
while ((m = re.exec(text)) !== null) {
|
|
25909
25950
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -25919,7 +25960,10 @@ var RegexMatcher2 = class {
|
|
|
25919
25960
|
match(text, rule) {
|
|
25920
25961
|
if (rule.matcher.type !== "regex") return [];
|
|
25921
25962
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
25922
|
-
const re =
|
|
25963
|
+
const re = memoizedRegExp(
|
|
25964
|
+
rule.matcher,
|
|
25965
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
25966
|
+
);
|
|
25923
25967
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
25924
25968
|
const spans = [];
|
|
25925
25969
|
let m;
|
|
@@ -26027,11 +26071,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
26027
26071
|
const labels = req.labels;
|
|
26028
26072
|
if (labels && labels.length > 0) {
|
|
26029
26073
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
26030
|
-
for (const
|
|
26031
|
-
|
|
26032
|
-
|
|
26033
|
-
|
|
26034
|
-
|
|
26074
|
+
for (const re of memoizedRegExpList(
|
|
26075
|
+
"label",
|
|
26076
|
+
req,
|
|
26077
|
+
() => labels.map((label) => {
|
|
26078
|
+
const trimmed = label.trim();
|
|
26079
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
26080
|
+
})
|
|
26081
|
+
)) {
|
|
26082
|
+
if (re?.test(haystack)) return true;
|
|
26035
26083
|
}
|
|
26036
26084
|
}
|
|
26037
26085
|
return false;
|
|
@@ -28339,7 +28387,7 @@ function applyCategoryPosture(posture, repo, mode = "fill-gaps") {
|
|
|
28339
28387
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
28340
28388
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
28341
28389
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
28342
|
-
import { basename as basename5, join as join12
|
|
28390
|
+
import { basename as basename5, join as join12 } from "path";
|
|
28343
28391
|
|
|
28344
28392
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
28345
28393
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -29453,8 +29501,8 @@ function table(headers, rows, opts = {}) {
|
|
|
29453
29501
|
const widths = headers.map(
|
|
29454
29502
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
29455
29503
|
);
|
|
29456
|
-
const
|
|
29457
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
29504
|
+
const sep4 = " ".repeat(gap);
|
|
29505
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep4);
|
|
29458
29506
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
29459
29507
|
if (opts.rowSep === true) {
|
|
29460
29508
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -29466,7 +29514,7 @@ function table(headers, rows, opts = {}) {
|
|
|
29466
29514
|
});
|
|
29467
29515
|
return [headerLine, rule, ...body].join("\n");
|
|
29468
29516
|
}
|
|
29469
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
29517
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep4);
|
|
29470
29518
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
29471
29519
|
}
|
|
29472
29520
|
function fenced(body) {
|
package/scripts/backfill.js
CHANGED
|
@@ -26083,6 +26083,40 @@ function escapeRegExp2(value) {
|
|
|
26083
26083
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26084
26084
|
}
|
|
26085
26085
|
|
|
26086
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26087
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26088
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26089
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26090
|
+
function listCache(kind) {
|
|
26091
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26092
|
+
}
|
|
26093
|
+
function memoizedRegExp(owner, build) {
|
|
26094
|
+
const cached2 = singles.get(owner);
|
|
26095
|
+
if (cached2 !== void 0) {
|
|
26096
|
+
cached2.lastIndex = 0;
|
|
26097
|
+
return cached2;
|
|
26098
|
+
}
|
|
26099
|
+
const compiled = build();
|
|
26100
|
+
singles.set(owner, compiled);
|
|
26101
|
+
return compiled;
|
|
26102
|
+
}
|
|
26103
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26104
|
+
const cache = listCache(kind);
|
|
26105
|
+
const cached2 = cache.get(owner);
|
|
26106
|
+
if (cached2 !== void 0) {
|
|
26107
|
+
if (cached2.stateful) {
|
|
26108
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26109
|
+
}
|
|
26110
|
+
return cached2.entries;
|
|
26111
|
+
}
|
|
26112
|
+
const entries = build();
|
|
26113
|
+
cache.set(owner, {
|
|
26114
|
+
entries,
|
|
26115
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26116
|
+
});
|
|
26117
|
+
return entries;
|
|
26118
|
+
}
|
|
26119
|
+
|
|
26086
26120
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26087
26121
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26088
26122
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26093,10 +26127,17 @@ var KeywordMatcher2 = class {
|
|
|
26093
26127
|
if (rule.matcher.type !== "keyword") return [];
|
|
26094
26128
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26095
26129
|
const spans = [];
|
|
26096
|
-
|
|
26097
|
-
|
|
26130
|
+
const compiled = memoizedRegExpList(
|
|
26131
|
+
"keyword",
|
|
26132
|
+
rule.matcher,
|
|
26133
|
+
() => keywords.map((kw) => {
|
|
26134
|
+
if (kw.length === 0) return void 0;
|
|
26135
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26136
|
+
})
|
|
26137
|
+
);
|
|
26138
|
+
for (const re of compiled) {
|
|
26139
|
+
if (re === void 0) continue;
|
|
26098
26140
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26099
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26100
26141
|
let m;
|
|
26101
26142
|
while ((m = re.exec(text)) !== null) {
|
|
26102
26143
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26112,7 +26153,10 @@ var RegexMatcher2 = class {
|
|
|
26112
26153
|
match(text, rule) {
|
|
26113
26154
|
if (rule.matcher.type !== "regex") return [];
|
|
26114
26155
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26115
|
-
const re =
|
|
26156
|
+
const re = memoizedRegExp(
|
|
26157
|
+
rule.matcher,
|
|
26158
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26159
|
+
);
|
|
26116
26160
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26117
26161
|
const spans = [];
|
|
26118
26162
|
let m;
|
|
@@ -26220,11 +26264,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
26220
26264
|
const labels = req.labels;
|
|
26221
26265
|
if (labels && labels.length > 0) {
|
|
26222
26266
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
26223
|
-
for (const
|
|
26224
|
-
|
|
26225
|
-
|
|
26226
|
-
|
|
26227
|
-
|
|
26267
|
+
for (const re of memoizedRegExpList(
|
|
26268
|
+
"label",
|
|
26269
|
+
req,
|
|
26270
|
+
() => labels.map((label) => {
|
|
26271
|
+
const trimmed = label.trim();
|
|
26272
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
26273
|
+
})
|
|
26274
|
+
)) {
|
|
26275
|
+
if (re?.test(haystack)) return true;
|
|
26228
26276
|
}
|
|
26229
26277
|
}
|
|
26230
26278
|
return false;
|
|
@@ -26492,13 +26540,14 @@ function probesFor(rule) {
|
|
|
26492
26540
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
26493
26541
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
26494
26542
|
}
|
|
26495
|
-
|
|
26543
|
+
var wallClock = () => performance.now();
|
|
26544
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
26496
26545
|
let ms = 0;
|
|
26497
26546
|
let probe = "";
|
|
26498
26547
|
for (const text of probesFor(rule)) {
|
|
26499
|
-
const start =
|
|
26548
|
+
const start = now();
|
|
26500
26549
|
scan(text, [rule]);
|
|
26501
|
-
const elapsed =
|
|
26550
|
+
const elapsed = now() - start;
|
|
26502
26551
|
if (elapsed > ms) {
|
|
26503
26552
|
ms = elapsed;
|
|
26504
26553
|
probe = text;
|
|
@@ -29191,7 +29240,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
29191
29240
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29192
29241
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29193
29242
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29194
|
-
import { basename as basename5, join as join12
|
|
29243
|
+
import { basename as basename5, join as join12 } from "path";
|
|
29195
29244
|
|
|
29196
29245
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
29197
29246
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
package/scripts/filescan.js
CHANGED
|
@@ -26912,6 +26912,40 @@ function escapeRegExp2(value) {
|
|
|
26912
26912
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26913
26913
|
}
|
|
26914
26914
|
|
|
26915
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26916
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26917
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26918
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26919
|
+
function listCache(kind) {
|
|
26920
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26921
|
+
}
|
|
26922
|
+
function memoizedRegExp(owner, build) {
|
|
26923
|
+
const cached2 = singles.get(owner);
|
|
26924
|
+
if (cached2 !== void 0) {
|
|
26925
|
+
cached2.lastIndex = 0;
|
|
26926
|
+
return cached2;
|
|
26927
|
+
}
|
|
26928
|
+
const compiled = build();
|
|
26929
|
+
singles.set(owner, compiled);
|
|
26930
|
+
return compiled;
|
|
26931
|
+
}
|
|
26932
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26933
|
+
const cache = listCache(kind);
|
|
26934
|
+
const cached2 = cache.get(owner);
|
|
26935
|
+
if (cached2 !== void 0) {
|
|
26936
|
+
if (cached2.stateful) {
|
|
26937
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26938
|
+
}
|
|
26939
|
+
return cached2.entries;
|
|
26940
|
+
}
|
|
26941
|
+
const entries = build();
|
|
26942
|
+
cache.set(owner, {
|
|
26943
|
+
entries,
|
|
26944
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26945
|
+
});
|
|
26946
|
+
return entries;
|
|
26947
|
+
}
|
|
26948
|
+
|
|
26915
26949
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26916
26950
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26917
26951
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26922,10 +26956,17 @@ var KeywordMatcher2 = class {
|
|
|
26922
26956
|
if (rule.matcher.type !== "keyword") return [];
|
|
26923
26957
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26924
26958
|
const spans = [];
|
|
26925
|
-
|
|
26926
|
-
|
|
26959
|
+
const compiled = memoizedRegExpList(
|
|
26960
|
+
"keyword",
|
|
26961
|
+
rule.matcher,
|
|
26962
|
+
() => keywords.map((kw) => {
|
|
26963
|
+
if (kw.length === 0) return void 0;
|
|
26964
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26965
|
+
})
|
|
26966
|
+
);
|
|
26967
|
+
for (const re of compiled) {
|
|
26968
|
+
if (re === void 0) continue;
|
|
26927
26969
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26928
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26929
26970
|
let m;
|
|
26930
26971
|
while ((m = re.exec(text)) !== null) {
|
|
26931
26972
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26941,7 +26982,10 @@ var RegexMatcher2 = class {
|
|
|
26941
26982
|
match(text, rule) {
|
|
26942
26983
|
if (rule.matcher.type !== "regex") return [];
|
|
26943
26984
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26944
|
-
const re =
|
|
26985
|
+
const re = memoizedRegExp(
|
|
26986
|
+
rule.matcher,
|
|
26987
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26988
|
+
);
|
|
26945
26989
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26946
26990
|
const spans = [];
|
|
26947
26991
|
let m;
|
|
@@ -27049,11 +27093,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
27049
27093
|
const labels = req.labels;
|
|
27050
27094
|
if (labels && labels.length > 0) {
|
|
27051
27095
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
27052
|
-
for (const
|
|
27053
|
-
|
|
27054
|
-
|
|
27055
|
-
|
|
27056
|
-
|
|
27096
|
+
for (const re of memoizedRegExpList(
|
|
27097
|
+
"label",
|
|
27098
|
+
req,
|
|
27099
|
+
() => labels.map((label) => {
|
|
27100
|
+
const trimmed = label.trim();
|
|
27101
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
27102
|
+
})
|
|
27103
|
+
)) {
|
|
27104
|
+
if (re?.test(haystack)) return true;
|
|
27057
27105
|
}
|
|
27058
27106
|
}
|
|
27059
27107
|
return false;
|
|
@@ -27321,13 +27369,14 @@ function probesFor(rule) {
|
|
|
27321
27369
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
27322
27370
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
27323
27371
|
}
|
|
27324
|
-
|
|
27372
|
+
var wallClock = () => performance.now();
|
|
27373
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
27325
27374
|
let ms = 0;
|
|
27326
27375
|
let probe = "";
|
|
27327
27376
|
for (const text of probesFor(rule)) {
|
|
27328
|
-
const start =
|
|
27377
|
+
const start = now();
|
|
27329
27378
|
scan(text, [rule]);
|
|
27330
|
-
const elapsed =
|
|
27379
|
+
const elapsed = now() - start;
|
|
27331
27380
|
if (elapsed > ms) {
|
|
27332
27381
|
ms = elapsed;
|
|
27333
27382
|
probe = text;
|
|
@@ -29989,7 +30038,7 @@ function resolveNonGitProject(startDir, recognizeMarker) {
|
|
|
29989
30038
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29990
30039
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29991
30040
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29992
|
-
import { basename as basename5, join as join12
|
|
30041
|
+
import { basename as basename5, join as join12 } from "path";
|
|
29993
30042
|
|
|
29994
30043
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
29995
30044
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -30416,7 +30465,7 @@ function discoverGitRepos(opts) {
|
|
|
30416
30465
|
}
|
|
30417
30466
|
|
|
30418
30467
|
// ../../packages/scanner/src/render.ts
|
|
30419
|
-
import { basename as basename6, relative
|
|
30468
|
+
import { basename as basename6, relative } from "path";
|
|
30420
30469
|
var SEVERITY_ORDER3 = ["critical", "high", "medium", "low"];
|
|
30421
30470
|
var SEVERITY_GLYPH = {
|
|
30422
30471
|
critical: "\u2588",
|
|
@@ -30434,9 +30483,9 @@ function indent(text, spaces = 2) {
|
|
|
30434
30483
|
}
|
|
30435
30484
|
function table(headers, rows, gap = 3) {
|
|
30436
30485
|
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? "").length)));
|
|
30437
|
-
const
|
|
30438
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
30439
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
30486
|
+
const sep5 = " ".repeat(gap);
|
|
30487
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep5);
|
|
30488
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep5);
|
|
30440
30489
|
return [fmt(headers.map((h) => h.toUpperCase())), ruleLine, ...rows.map(fmt)].join("\n");
|
|
30441
30490
|
}
|
|
30442
30491
|
function metaBlock(rows) {
|
|
@@ -30458,7 +30507,7 @@ function followUpSection(opts) {
|
|
|
30458
30507
|
return opts.followUp !== void 0 ? ["", ` ${opts.followUp}`] : [];
|
|
30459
30508
|
}
|
|
30460
30509
|
function renderWorktreeSummary(summary, opts = {}) {
|
|
30461
|
-
const rootLabel =
|
|
30510
|
+
const rootLabel = relative(process.cwd(), summary.rootDir) || ".";
|
|
30462
30511
|
const meta3 = metaBlock([
|
|
30463
30512
|
["Root", rootLabel],
|
|
30464
30513
|
["Scanned", `${String(summary.scanned)} files`],
|
|
@@ -30510,7 +30559,7 @@ function renderMultiRepoSummary(summary, opts = {}) {
|
|
|
30510
30559
|
|
|
30511
30560
|
// ../../packages/scanner/src/scan.ts
|
|
30512
30561
|
import { existsSync as existsSync9, readFileSync as readFileSync10 } from "fs";
|
|
30513
|
-
import { extname as extname2, isAbsolute as isAbsolute2, relative as
|
|
30562
|
+
import { extname as extname2, isAbsolute as isAbsolute2, relative as relative3 } from "path";
|
|
30514
30563
|
|
|
30515
30564
|
// ../../packages/plugin-runtime/src/standalone-gateway.ts
|
|
30516
30565
|
import { randomUUID as randomUUID15 } from "crypto";
|
|
@@ -30837,7 +30886,7 @@ import { statSync as statSync8 } from "fs";
|
|
|
30837
30886
|
// ../../packages/scanner/src/walk.ts
|
|
30838
30887
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
30839
30888
|
import { readdirSync as readdirSync6, readFileSync as readFileSync9, statSync as statSync7 } from "fs";
|
|
30840
|
-
import { extname, join as join15, relative as
|
|
30889
|
+
import { extname, join as join15, relative as relative2, sep as sep4 } from "path";
|
|
30841
30890
|
var SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
30842
30891
|
".ts",
|
|
30843
30892
|
".tsx",
|
|
@@ -30878,7 +30927,7 @@ function readIgnoreLayer(dir, filename) {
|
|
|
30878
30927
|
function evaluate(layers, absPath, isDir) {
|
|
30879
30928
|
let state = "unmatched";
|
|
30880
30929
|
for (const layer of layers) {
|
|
30881
|
-
const rel =
|
|
30930
|
+
const rel = relative2(layer.base, absPath).split(sep4).join("/") + (isDir ? "/" : "");
|
|
30882
30931
|
const verdict = layer.matcher.test(rel);
|
|
30883
30932
|
if (verdict.ignored) state = "ignored";
|
|
30884
30933
|
else if (verdict.unignored) state = "unignored";
|
|
@@ -30947,7 +30996,7 @@ function* walkSourceFiles(opts = {}) {
|
|
|
30947
30996
|
// Posix-separated like every stored relative path (and the ignore
|
|
30948
30997
|
// matching inside walkTree) — native separators must not leak into the
|
|
30949
30998
|
// contract.
|
|
30950
|
-
relativePath:
|
|
30999
|
+
relativePath: relative2(rootDir, file2.path).split(sep4).join("/"),
|
|
30951
31000
|
mtime: mtime.toISOString(),
|
|
30952
31001
|
size,
|
|
30953
31002
|
gitignored: file2.gitignored
|
|
@@ -31015,7 +31064,7 @@ function resolveEgressProject(rootDir) {
|
|
|
31015
31064
|
}
|
|
31016
31065
|
}
|
|
31017
31066
|
function egressKey(root, absPath) {
|
|
31018
|
-
const rel = toPosix(
|
|
31067
|
+
const rel = toPosix(relative3(root, absPath));
|
|
31019
31068
|
return rel === "" || rel.startsWith("../") ? null : rel;
|
|
31020
31069
|
}
|
|
31021
31070
|
function startEgress(rootDir) {
|
|
@@ -31069,7 +31118,7 @@ async function reopenRedetectedFindings(gateway, path, currentKeys, evidence, re
|
|
|
31069
31118
|
}
|
|
31070
31119
|
}
|
|
31071
31120
|
function isUnderRoot(path, rootDir) {
|
|
31072
|
-
const rel =
|
|
31121
|
+
const rel = relative3(rootDir, path);
|
|
31073
31122
|
return rel !== "" && !rel.startsWith("..") && !isAbsolute2(rel);
|
|
31074
31123
|
}
|
|
31075
31124
|
async function sweepDeletedFiles(gateway, rootDir, previous) {
|
package/scripts/firstrun.js
CHANGED
|
@@ -25926,6 +25926,40 @@ function escapeRegExp2(value) {
|
|
|
25926
25926
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25927
25927
|
}
|
|
25928
25928
|
|
|
25929
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
25930
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
25931
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
25932
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
25933
|
+
function listCache(kind) {
|
|
25934
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
25935
|
+
}
|
|
25936
|
+
function memoizedRegExp(owner, build) {
|
|
25937
|
+
const cached2 = singles.get(owner);
|
|
25938
|
+
if (cached2 !== void 0) {
|
|
25939
|
+
cached2.lastIndex = 0;
|
|
25940
|
+
return cached2;
|
|
25941
|
+
}
|
|
25942
|
+
const compiled = build();
|
|
25943
|
+
singles.set(owner, compiled);
|
|
25944
|
+
return compiled;
|
|
25945
|
+
}
|
|
25946
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
25947
|
+
const cache = listCache(kind);
|
|
25948
|
+
const cached2 = cache.get(owner);
|
|
25949
|
+
if (cached2 !== void 0) {
|
|
25950
|
+
if (cached2.stateful) {
|
|
25951
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
25952
|
+
}
|
|
25953
|
+
return cached2.entries;
|
|
25954
|
+
}
|
|
25955
|
+
const entries = build();
|
|
25956
|
+
cache.set(owner, {
|
|
25957
|
+
entries,
|
|
25958
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
25959
|
+
});
|
|
25960
|
+
return entries;
|
|
25961
|
+
}
|
|
25962
|
+
|
|
25929
25963
|
// ../../packages/detections/src/matchers/limits.ts
|
|
25930
25964
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
25931
25965
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -25936,10 +25970,17 @@ var KeywordMatcher2 = class {
|
|
|
25936
25970
|
if (rule.matcher.type !== "keyword") return [];
|
|
25937
25971
|
const { keywords, caseSensitive } = rule.matcher;
|
|
25938
25972
|
const spans = [];
|
|
25939
|
-
|
|
25940
|
-
|
|
25973
|
+
const compiled = memoizedRegExpList(
|
|
25974
|
+
"keyword",
|
|
25975
|
+
rule.matcher,
|
|
25976
|
+
() => keywords.map((kw) => {
|
|
25977
|
+
if (kw.length === 0) return void 0;
|
|
25978
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
25979
|
+
})
|
|
25980
|
+
);
|
|
25981
|
+
for (const re of compiled) {
|
|
25982
|
+
if (re === void 0) continue;
|
|
25941
25983
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
25942
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
25943
25984
|
let m;
|
|
25944
25985
|
while ((m = re.exec(text)) !== null) {
|
|
25945
25986
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -25955,7 +25996,10 @@ var RegexMatcher2 = class {
|
|
|
25955
25996
|
match(text, rule) {
|
|
25956
25997
|
if (rule.matcher.type !== "regex") return [];
|
|
25957
25998
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
25958
|
-
const re =
|
|
25999
|
+
const re = memoizedRegExp(
|
|
26000
|
+
rule.matcher,
|
|
26001
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26002
|
+
);
|
|
25959
26003
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
25960
26004
|
const spans = [];
|
|
25961
26005
|
let m;
|
|
@@ -28113,7 +28157,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
28113
28157
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
28114
28158
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
28115
28159
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
28116
|
-
import { basename as basename5, join as join12
|
|
28160
|
+
import { basename as basename5, join as join12 } from "path";
|
|
28117
28161
|
|
|
28118
28162
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
28119
28163
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -28538,8 +28582,8 @@ function table(headers, rows, opts = {}) {
|
|
|
28538
28582
|
const widths = headers.map(
|
|
28539
28583
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
28540
28584
|
);
|
|
28541
|
-
const
|
|
28542
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
28585
|
+
const sep4 = " ".repeat(gap);
|
|
28586
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep4);
|
|
28543
28587
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
28544
28588
|
if (opts.rowSep === true) {
|
|
28545
28589
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -28551,7 +28595,7 @@ function table(headers, rows, opts = {}) {
|
|
|
28551
28595
|
});
|
|
28552
28596
|
return [headerLine, rule, ...body].join("\n");
|
|
28553
28597
|
}
|
|
28554
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
28598
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep4);
|
|
28555
28599
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
28556
28600
|
}
|
|
28557
28601
|
function fenced(body) {
|
package/scripts/intro.js
CHANGED
|
@@ -18305,6 +18305,40 @@ function escapeRegExp2(value) {
|
|
|
18305
18305
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18306
18306
|
}
|
|
18307
18307
|
|
|
18308
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
18309
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
18310
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
18311
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
18312
|
+
function listCache(kind) {
|
|
18313
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
18314
|
+
}
|
|
18315
|
+
function memoizedRegExp(owner, build) {
|
|
18316
|
+
const cached2 = singles.get(owner);
|
|
18317
|
+
if (cached2 !== void 0) {
|
|
18318
|
+
cached2.lastIndex = 0;
|
|
18319
|
+
return cached2;
|
|
18320
|
+
}
|
|
18321
|
+
const compiled = build();
|
|
18322
|
+
singles.set(owner, compiled);
|
|
18323
|
+
return compiled;
|
|
18324
|
+
}
|
|
18325
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
18326
|
+
const cache = listCache(kind);
|
|
18327
|
+
const cached2 = cache.get(owner);
|
|
18328
|
+
if (cached2 !== void 0) {
|
|
18329
|
+
if (cached2.stateful) {
|
|
18330
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
18331
|
+
}
|
|
18332
|
+
return cached2.entries;
|
|
18333
|
+
}
|
|
18334
|
+
const entries = build();
|
|
18335
|
+
cache.set(owner, {
|
|
18336
|
+
entries,
|
|
18337
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
18338
|
+
});
|
|
18339
|
+
return entries;
|
|
18340
|
+
}
|
|
18341
|
+
|
|
18308
18342
|
// ../../packages/detections/src/matchers/limits.ts
|
|
18309
18343
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
18310
18344
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -18315,10 +18349,17 @@ var KeywordMatcher2 = class {
|
|
|
18315
18349
|
if (rule.matcher.type !== "keyword") return [];
|
|
18316
18350
|
const { keywords, caseSensitive } = rule.matcher;
|
|
18317
18351
|
const spans = [];
|
|
18318
|
-
|
|
18319
|
-
|
|
18352
|
+
const compiled = memoizedRegExpList(
|
|
18353
|
+
"keyword",
|
|
18354
|
+
rule.matcher,
|
|
18355
|
+
() => keywords.map((kw) => {
|
|
18356
|
+
if (kw.length === 0) return void 0;
|
|
18357
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18358
|
+
})
|
|
18359
|
+
);
|
|
18360
|
+
for (const re of compiled) {
|
|
18361
|
+
if (re === void 0) continue;
|
|
18320
18362
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
18321
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18322
18363
|
let m;
|
|
18323
18364
|
while ((m = re.exec(text)) !== null) {
|
|
18324
18365
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -18334,7 +18375,10 @@ var RegexMatcher2 = class {
|
|
|
18334
18375
|
match(text, rule) {
|
|
18335
18376
|
if (rule.matcher.type !== "regex") return [];
|
|
18336
18377
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
18337
|
-
const re =
|
|
18378
|
+
const re = memoizedRegExp(
|
|
18379
|
+
rule.matcher,
|
|
18380
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
18381
|
+
);
|
|
18338
18382
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
18339
18383
|
const spans = [];
|
|
18340
18384
|
let m;
|
|
@@ -18467,7 +18511,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
18467
18511
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18468
18512
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
18469
18513
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
18470
|
-
import { basename as basename5, join as join12
|
|
18514
|
+
import { basename as basename5, join as join12 } from "path";
|
|
18471
18515
|
|
|
18472
18516
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18473
18517
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|