@akasecurity/ai-tc-codex 0.9.17-beta.1 → 0.9.17
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 -11
- package/scripts/backfill.js +162 -25
- package/scripts/content-retention.js +20 -1
- package/scripts/filescan.js +162 -25
- package/scripts/firstrun.js +62 -11
- package/scripts/history-sync.js +27 -1
- package/scripts/intro.js +18 -1
- package/scripts/onboard.js +61 -11
- package/scripts/post-tool-use.js +211 -33
- package/scripts/pre-tool-use.js +193 -26
- package/scripts/query.js +62 -11
- package/scripts/reconcile.js +62 -11
- package/scripts/remediate.js +162 -25
- package/scripts/scan-worker.js +50 -1
- package/scripts/session-start.js +84 -19
- package/scripts/start-light.js +50 -1
- package/scripts/stop.js +51 -1
- package/scripts/sync.js +162 -25
- package/scripts/user-prompt-submit.js +254 -86
package/scripts/session-start.js
CHANGED
|
@@ -22554,6 +22554,11 @@ var CaptureAttributes = external_exports.object({
|
|
|
22554
22554
|
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
22555
22555
|
// repeated rather than referenced because a store reader opens this file.
|
|
22556
22556
|
redact_degraded_to: ActionTaken.optional(),
|
|
22557
|
+
// Why a capture has no content and no findings: its field was refused
|
|
22558
|
+
// because its bounded scan did not finish (see EventMetadata.scanIncomplete,
|
|
22559
|
+
// whose value this is). Absent on every capture that was scanned, so a
|
|
22560
|
+
// reader can tell a refused row from an empty clean one.
|
|
22561
|
+
scan_incomplete: external_exports.enum(["timeout", "unavailable"]).optional(),
|
|
22557
22562
|
// The scope key this capture was stamped with: the canonical repository
|
|
22558
22563
|
// (`host/owner/repo`) of the path the capture names (a relative path is read
|
|
22559
22564
|
// against its working directory), else of its own working directory, or a
|
|
@@ -24009,7 +24014,19 @@ var EventMetadata = external_exports.object({
|
|
|
24009
24014
|
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
24010
24015
|
// Closing either means moving the reason onto the finding row, which
|
|
24011
24016
|
// already carries its own action.
|
|
24012
|
-
redactDegradedTo: ActionTaken.optional()
|
|
24017
|
+
redactDegradedTo: ActionTaken.optional(),
|
|
24018
|
+
// Set when this capture's field was REFUSED rather than scanned: a hook
|
|
24019
|
+
// bounds the scan of a large field (see `LargeInputScanOptions` in
|
|
24020
|
+
// @akasecurity/plugin-sdk), and a scan that did not finish blocks the
|
|
24021
|
+
// field instead of letting it through unscanned.
|
|
24022
|
+
//
|
|
24023
|
+
// - 'timeout': the bounded scan ran out of time.
|
|
24024
|
+
// - 'unavailable': no worker could run it.
|
|
24025
|
+
//
|
|
24026
|
+
// A refused row stores '' as its content and has no findings, which is
|
|
24027
|
+
// exactly what a clean, empty capture looks like — this marker is the only
|
|
24028
|
+
// thing that tells the two apart. Absent on every capture that was scanned.
|
|
24029
|
+
scanIncomplete: external_exports.enum(["timeout", "unavailable"]).optional()
|
|
24013
24030
|
}).meta({ id: "EventMetadata" });
|
|
24014
24031
|
var Event = external_exports.object({
|
|
24015
24032
|
id: external_exports.guid(),
|
|
@@ -25829,6 +25846,7 @@ function toCaptureAttributes(event) {
|
|
|
25829
25846
|
...metadata?.exceptionIds !== void 0 ? { exception_ids: metadata.exceptionIds } : {},
|
|
25830
25847
|
...metadata?.inspectionMs !== void 0 ? { inspection_ms: metadata.inspectionMs } : {},
|
|
25831
25848
|
...metadata?.redactDegradedTo !== void 0 ? { redact_degraded_to: metadata.redactDegradedTo } : {},
|
|
25849
|
+
...metadata?.scanIncomplete !== void 0 ? { scan_incomplete: metadata.scanIncomplete } : {},
|
|
25832
25850
|
// `model`/`turnIndex` have no dedicated CaptureAttributes field (no writer
|
|
25833
25851
|
// has ever populated either), but every legacy metadata key still rides
|
|
25834
25852
|
// the bag rather than being silently dropped — CaptureAttributes'
|
|
@@ -37817,6 +37835,38 @@ function worstProbeMs(rule, now = wallClock, corroborate) {
|
|
|
37817
37835
|
}
|
|
37818
37836
|
var CPU_CORROBORATION_SHARE = 0.2;
|
|
37819
37837
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
37838
|
+
function repeatTo(unit, length) {
|
|
37839
|
+
return unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
|
|
37840
|
+
}
|
|
37841
|
+
function joinTo(length, open3, close, item) {
|
|
37842
|
+
const parts = [];
|
|
37843
|
+
let size = open3.length;
|
|
37844
|
+
for (let i = 0; size < length; i++) {
|
|
37845
|
+
const next = (i === 0 ? "" : ",") + item(i);
|
|
37846
|
+
parts.push(next);
|
|
37847
|
+
size += next.length;
|
|
37848
|
+
}
|
|
37849
|
+
return (open3 + parts.join("") + close).slice(0, length);
|
|
37850
|
+
}
|
|
37851
|
+
var SQL_WORDS = ["select", "insert", "update", "delete", "drop", "where"];
|
|
37852
|
+
var GROWTH_CORPORA = [
|
|
37853
|
+
{
|
|
37854
|
+
name: "one-line JSON dictionary",
|
|
37855
|
+
build: (length) => joinTo(length, "{", "}", (i) => `"id-${String(i)}":"label ${String(i)}"`)
|
|
37856
|
+
},
|
|
37857
|
+
{
|
|
37858
|
+
name: "JSON array of quoted SQL keywords",
|
|
37859
|
+
build: (length) => joinTo(length, "[", "]", (i) => `"${SQL_WORDS[i % SQL_WORDS.length] ?? ""} ${String(i)}"`)
|
|
37860
|
+
},
|
|
37861
|
+
{ name: "single-quoted keyword run ('where)", build: (length) => repeatTo("'where", length) },
|
|
37862
|
+
{ name: "double-quote run", build: (length) => repeatTo('"', length) },
|
|
37863
|
+
{ name: "space run", build: (length) => repeatTo(" ", length) },
|
|
37864
|
+
{ name: "newline run", build: (length) => repeatTo("\n", length) },
|
|
37865
|
+
...["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map((unit) => ({
|
|
37866
|
+
name: `unit run ${JSON.stringify(unit)}`,
|
|
37867
|
+
build: (length) => repeatTo(unit, length)
|
|
37868
|
+
}))
|
|
37869
|
+
];
|
|
37820
37870
|
function checkRuleTiming(rule, corroborate) {
|
|
37821
37871
|
const { ms, probe, corroboratedMs } = worstProbeMs(rule, wallClock, corroborate);
|
|
37822
37872
|
const work = corroboratedMs ?? 0;
|
|
@@ -38118,7 +38168,7 @@ var auth_jwt_no_verify_default = {
|
|
|
38118
38168
|
severity: "critical",
|
|
38119
38169
|
matcher: {
|
|
38120
38170
|
type: "regex",
|
|
38121
|
-
pattern: "(verify\\s*=\\s*false|verify_signature
|
|
38171
|
+
pattern: "(verify\\s*=\\s*false|verify_signature(?:(?!verify_signature).)*false|algorithms\\s*=\\s*\\[\\])",
|
|
38122
38172
|
flags: "gi"
|
|
38123
38173
|
},
|
|
38124
38174
|
requiresNearby: {
|
|
@@ -38206,7 +38256,7 @@ var cmd_inject_shell_default = {
|
|
|
38206
38256
|
severity: "critical",
|
|
38207
38257
|
matcher: {
|
|
38208
38258
|
type: "regex",
|
|
38209
|
-
pattern: "subprocess\\.(run|Popen|call|check_output)\\s*\\([^)]*shell\\s*=\\s*True",
|
|
38259
|
+
pattern: "subprocess\\.(run|Popen|call|check_output)\\s*\\((?:(?!subprocess\\.(?:run|Popen|call|check_output)\\s*\\()[^)])*shell\\s*=\\s*True",
|
|
38210
38260
|
flags: "gi"
|
|
38211
38261
|
},
|
|
38212
38262
|
requiresNearby: {
|
|
@@ -38335,7 +38385,7 @@ var deser_yaml_unsafe_default = {
|
|
|
38335
38385
|
severity: "high",
|
|
38336
38386
|
matcher: {
|
|
38337
38387
|
type: "regex",
|
|
38338
|
-
pattern: "\\byaml\\.load\\s*\\((?![^)]
|
|
38388
|
+
pattern: "\\byaml\\.load\\s*\\((?!(?:(?!yaml\\.load\\s*\\()[^)])*?(?:SafeLoader|safe_load))",
|
|
38339
38389
|
flags: "gi"
|
|
38340
38390
|
},
|
|
38341
38391
|
examples: ["data = yaml.load(user_input)", "config = yaml.load(f)"],
|
|
@@ -38552,7 +38602,7 @@ var sql_inject_concat_dot_default = {
|
|
|
38552
38602
|
severity: "high",
|
|
38553
38603
|
matcher: {
|
|
38554
38604
|
type: "regex",
|
|
38555
|
-
pattern: `["'][
|
|
38605
|
+
pattern: `["'](?=([^"'\\n]*?(?:select|insert|update|delete|drop|where)))\\1(?:(?!["'][^"'\\n]*?(?:select|insert|update|delete|drop|where))[^\\n])*?["']\\s*\\.`,
|
|
38556
38606
|
flags: "gi"
|
|
38557
38607
|
},
|
|
38558
38608
|
appliesTo: {
|
|
@@ -38570,7 +38620,7 @@ var sql_inject_concat_default = {
|
|
|
38570
38620
|
severity: "high",
|
|
38571
38621
|
matcher: {
|
|
38572
38622
|
type: "regex",
|
|
38573
|
-
pattern: `["']\\s*(?:select\\b[^\\n]*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b[^\\n]*?=)[^\\n]*?["']\\s*\\+`,
|
|
38623
|
+
pattern: `(["'])\\s*(?=(select\\b(?:(?!\\1\\s*(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b))[^\\n])*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b(?:(?!\\1\\s*(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b))[^\\n])*?=))\\2(?:(?!\\1\\s*(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b))[^\\n])*?["']\\s*\\+`,
|
|
38574
38624
|
flags: "gi"
|
|
38575
38625
|
},
|
|
38576
38626
|
examples: ['"SELECT * FROM users WHERE id = " + userId']
|
|
@@ -38585,7 +38635,7 @@ var sql_inject_format_default = {
|
|
|
38585
38635
|
severity: "high",
|
|
38586
38636
|
matcher: {
|
|
38587
38637
|
type: "regex",
|
|
38588
|
-
pattern: "\\b(?:select\\b[^\\n]*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b[^\\n]*?=)[^\\n]*?(?:[%][sd]|\\{[^}]+\\})",
|
|
38638
|
+
pattern: "\\b(?=(select\\b(?:(?!\\b(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))[^\\n])*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))\\1(?:(?!\\b(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})|\\b(?=(where\\b(?:(?!\\bwhere\\b)[^\\n])*?=))\\2(?:(?!\\bwhere\\b)[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})",
|
|
38589
38639
|
flags: "gi"
|
|
38590
38640
|
},
|
|
38591
38641
|
examples: [
|
|
@@ -38603,7 +38653,7 @@ var sql_inject_interp_default = {
|
|
|
38603
38653
|
severity: "high",
|
|
38604
38654
|
matcher: {
|
|
38605
38655
|
type: "regex",
|
|
38606
|
-
pattern: "(select|insert|update|delete|where)[^\\n]*?(#\\{|\\$[a-z_])",
|
|
38656
|
+
pattern: "(select|insert|update|delete|where)(?:(?!(?:select|insert|update|delete|where))[^\\n])*?(#\\{|\\$[a-z_])",
|
|
38607
38657
|
flags: "gi"
|
|
38608
38658
|
},
|
|
38609
38659
|
examples: [
|
|
@@ -38978,7 +39028,7 @@ var stack_trace_default = {
|
|
|
38978
39028
|
severity: "low",
|
|
38979
39029
|
matcher: {
|
|
38980
39030
|
type: "regex",
|
|
38981
|
-
pattern: "(
|
|
39031
|
+
pattern: "(?:^|(?<!\\s)\\s+)at\\s+[A-Za-z0-9._$<>]+\\.[A-Za-z0-9_$]+\\s*\\([A-Za-z0-9._\\-/:]+:\\d+:\\d+\\)",
|
|
38982
39032
|
flags: "g"
|
|
38983
39033
|
},
|
|
38984
39034
|
examples: ["at com.example.service.UserService.findUser(UserService.java:42:13)"]
|
|
@@ -40136,7 +40186,7 @@ var BUNDLED_PACKS = [
|
|
|
40136
40186
|
{
|
|
40137
40187
|
packId: "code-flaws",
|
|
40138
40188
|
name: "Code Security Flaws",
|
|
40139
|
-
version: "0.1.
|
|
40189
|
+
version: "0.1.1",
|
|
40140
40190
|
rawRules: [
|
|
40141
40191
|
sql_inject_concat_default,
|
|
40142
40192
|
sql_inject_concat_dot_default,
|
|
@@ -40186,7 +40236,7 @@ var BUNDLED_PACKS = [
|
|
|
40186
40236
|
{
|
|
40187
40237
|
packId: "core-code-context",
|
|
40188
40238
|
name: "Code Context",
|
|
40189
|
-
version: "0.2.
|
|
40239
|
+
version: "0.2.2",
|
|
40190
40240
|
rawRules: [
|
|
40191
40241
|
internal_ip_default,
|
|
40192
40242
|
localhost_ref_default,
|
|
@@ -41204,9 +41254,10 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41204
41254
|
if (job.timer !== void 0) return;
|
|
41205
41255
|
job.startedAt = performance.now();
|
|
41206
41256
|
job.progressAt = job.startedAt;
|
|
41257
|
+
const budget = job.deadlineAt === void 0 ? job.budgetMs : Math.max(0, Math.min(job.budgetMs, job.deadlineAt - job.startedAt));
|
|
41207
41258
|
job.timer = setTimeout(() => {
|
|
41208
41259
|
onDeadline(job);
|
|
41209
|
-
},
|
|
41260
|
+
}, budget);
|
|
41210
41261
|
}
|
|
41211
41262
|
function runOne(spec, fail) {
|
|
41212
41263
|
if (closed) {
|
|
@@ -41217,6 +41268,12 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41217
41268
|
fail({ status: "unavailable", reason: `the scan worker crashed: ${broken}` });
|
|
41218
41269
|
return;
|
|
41219
41270
|
}
|
|
41271
|
+
const now = performance.now();
|
|
41272
|
+
const deadlineAt = spec.deadlineAt;
|
|
41273
|
+
if (deadlineAt !== void 0 && deadlineAt <= now) {
|
|
41274
|
+
fail({ status: "timeout", culpritIndex: void 0, elapsedMs: 0 });
|
|
41275
|
+
return;
|
|
41276
|
+
}
|
|
41220
41277
|
const started = ensureWorker();
|
|
41221
41278
|
if (!(started instanceof Worker)) {
|
|
41222
41279
|
broken = started.error;
|
|
@@ -41224,11 +41281,11 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41224
41281
|
return;
|
|
41225
41282
|
}
|
|
41226
41283
|
const id = nextJobId++;
|
|
41227
|
-
const now = performance.now();
|
|
41228
41284
|
const job = {
|
|
41229
41285
|
id,
|
|
41230
41286
|
worker: started,
|
|
41231
41287
|
budgetMs: spec.budgetMs,
|
|
41288
|
+
deadlineAt,
|
|
41232
41289
|
startedAt: now,
|
|
41233
41290
|
progressIndex: -1,
|
|
41234
41291
|
progressAt: now,
|
|
@@ -41242,14 +41299,19 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41242
41299
|
if (readyWorker === started) {
|
|
41243
41300
|
beginDeadline(job);
|
|
41244
41301
|
} else {
|
|
41302
|
+
const startBudget = spec.startBudgetMs ?? startBudgetMs;
|
|
41303
|
+
const callerLimited = deadlineAt !== void 0 && deadlineAt - now < startBudget;
|
|
41304
|
+
const startWaitMs = callerLimited ? deadlineAt - now : startBudget;
|
|
41245
41305
|
job.startupTimer = setTimeout(() => {
|
|
41246
41306
|
if (pending !== job) return;
|
|
41247
41307
|
kill(job.worker);
|
|
41248
|
-
failPending(
|
|
41249
|
-
status: "
|
|
41250
|
-
|
|
41251
|
-
|
|
41252
|
-
|
|
41308
|
+
failPending(
|
|
41309
|
+
callerLimited ? { status: "timeout", culpritIndex: void 0, elapsedMs: performance.now() - now } : {
|
|
41310
|
+
status: "unavailable",
|
|
41311
|
+
reason: `the scan worker did not start within ${String(startBudget)}ms`
|
|
41312
|
+
}
|
|
41313
|
+
);
|
|
41314
|
+
}, startWaitMs);
|
|
41253
41315
|
}
|
|
41254
41316
|
try {
|
|
41255
41317
|
started.postMessage(spec.build(id));
|
|
@@ -41278,7 +41340,9 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41278
41340
|
return enqueue((resolve3) => {
|
|
41279
41341
|
runOne(
|
|
41280
41342
|
{
|
|
41281
|
-
budgetMs,
|
|
41343
|
+
budgetMs: scanOpts?.budgetMs ?? budgetMs,
|
|
41344
|
+
startBudgetMs: scanOpts?.startBudgetMs,
|
|
41345
|
+
deadlineAt: scanOpts?.deadlineAt,
|
|
41282
41346
|
build: (id) => ({
|
|
41283
41347
|
kind: "scan",
|
|
41284
41348
|
id,
|
|
@@ -43245,6 +43309,7 @@ var CORRELATION_ID = EventMetadata.shape.correlationId;
|
|
|
43245
43309
|
var TRACE_ID = EventMetadata.shape.traceId;
|
|
43246
43310
|
var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
|
|
43247
43311
|
var REDACT_DEGRADED_TO = EventMetadata.shape.redactDegradedTo.unwrap();
|
|
43312
|
+
var SCAN_INCOMPLETE = EventMetadata.shape.scanIncomplete.unwrap();
|
|
43248
43313
|
|
|
43249
43314
|
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
43250
43315
|
var CAPTURE_BATCH_BYTES = 1024 * 1024;
|
package/scripts/start-light.js
CHANGED
|
@@ -21262,6 +21262,11 @@ var CaptureAttributes = external_exports.object({
|
|
|
21262
21262
|
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
21263
21263
|
// repeated rather than referenced because a store reader opens this file.
|
|
21264
21264
|
redact_degraded_to: ActionTaken.optional(),
|
|
21265
|
+
// Why a capture has no content and no findings: its field was refused
|
|
21266
|
+
// because its bounded scan did not finish (see EventMetadata.scanIncomplete,
|
|
21267
|
+
// whose value this is). Absent on every capture that was scanned, so a
|
|
21268
|
+
// reader can tell a refused row from an empty clean one.
|
|
21269
|
+
scan_incomplete: external_exports.enum(["timeout", "unavailable"]).optional(),
|
|
21265
21270
|
// The scope key this capture was stamped with: the canonical repository
|
|
21266
21271
|
// (`host/owner/repo`) of the path the capture names (a relative path is read
|
|
21267
21272
|
// against its working directory), else of its own working directory, or a
|
|
@@ -22572,7 +22577,19 @@ var EventMetadata = external_exports.object({
|
|
|
22572
22577
|
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
22573
22578
|
// Closing either means moving the reason onto the finding row, which
|
|
22574
22579
|
// already carries its own action.
|
|
22575
|
-
redactDegradedTo: ActionTaken.optional()
|
|
22580
|
+
redactDegradedTo: ActionTaken.optional(),
|
|
22581
|
+
// Set when this capture's field was REFUSED rather than scanned: a hook
|
|
22582
|
+
// bounds the scan of a large field (see `LargeInputScanOptions` in
|
|
22583
|
+
// @akasecurity/plugin-sdk), and a scan that did not finish blocks the
|
|
22584
|
+
// field instead of letting it through unscanned.
|
|
22585
|
+
//
|
|
22586
|
+
// - 'timeout': the bounded scan ran out of time.
|
|
22587
|
+
// - 'unavailable': no worker could run it.
|
|
22588
|
+
//
|
|
22589
|
+
// A refused row stores '' as its content and has no findings, which is
|
|
22590
|
+
// exactly what a clean, empty capture looks like — this marker is the only
|
|
22591
|
+
// thing that tells the two apart. Absent on every capture that was scanned.
|
|
22592
|
+
scanIncomplete: external_exports.enum(["timeout", "unavailable"]).optional()
|
|
22576
22593
|
}).meta({ id: "EventMetadata" });
|
|
22577
22594
|
var Event = external_exports.object({
|
|
22578
22595
|
id: external_exports.guid(),
|
|
@@ -25057,6 +25074,38 @@ var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].m
|
|
|
25057
25074
|
);
|
|
25058
25075
|
var CPU_CORROBORATION_SHARE = 0.2;
|
|
25059
25076
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
25077
|
+
function repeatTo(unit, length) {
|
|
25078
|
+
return unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
|
|
25079
|
+
}
|
|
25080
|
+
function joinTo(length, open2, close, item) {
|
|
25081
|
+
const parts = [];
|
|
25082
|
+
let size = open2.length;
|
|
25083
|
+
for (let i = 0; size < length; i++) {
|
|
25084
|
+
const next = (i === 0 ? "" : ",") + item(i);
|
|
25085
|
+
parts.push(next);
|
|
25086
|
+
size += next.length;
|
|
25087
|
+
}
|
|
25088
|
+
return (open2 + parts.join("") + close).slice(0, length);
|
|
25089
|
+
}
|
|
25090
|
+
var SQL_WORDS = ["select", "insert", "update", "delete", "drop", "where"];
|
|
25091
|
+
var GROWTH_CORPORA = [
|
|
25092
|
+
{
|
|
25093
|
+
name: "one-line JSON dictionary",
|
|
25094
|
+
build: (length) => joinTo(length, "{", "}", (i) => `"id-${String(i)}":"label ${String(i)}"`)
|
|
25095
|
+
},
|
|
25096
|
+
{
|
|
25097
|
+
name: "JSON array of quoted SQL keywords",
|
|
25098
|
+
build: (length) => joinTo(length, "[", "]", (i) => `"${SQL_WORDS[i % SQL_WORDS.length] ?? ""} ${String(i)}"`)
|
|
25099
|
+
},
|
|
25100
|
+
{ name: "single-quoted keyword run ('where)", build: (length) => repeatTo("'where", length) },
|
|
25101
|
+
{ name: "double-quote run", build: (length) => repeatTo('"', length) },
|
|
25102
|
+
{ name: "space run", build: (length) => repeatTo(" ", length) },
|
|
25103
|
+
{ name: "newline run", build: (length) => repeatTo("\n", length) },
|
|
25104
|
+
...["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map((unit) => ({
|
|
25105
|
+
name: `unit run ${JSON.stringify(unit)}`,
|
|
25106
|
+
build: (length) => repeatTo(unit, length)
|
|
25107
|
+
}))
|
|
25108
|
+
];
|
|
25060
25109
|
|
|
25061
25110
|
// ../../packages/setup-wizard/src/onboard-posture.ts
|
|
25062
25111
|
function parsePosture(json2) {
|
package/scripts/stop.js
CHANGED
|
@@ -21274,6 +21274,11 @@ var CaptureAttributes = external_exports.object({
|
|
|
21274
21274
|
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
21275
21275
|
// repeated rather than referenced because a store reader opens this file.
|
|
21276
21276
|
redact_degraded_to: ActionTaken.optional(),
|
|
21277
|
+
// Why a capture has no content and no findings: its field was refused
|
|
21278
|
+
// because its bounded scan did not finish (see EventMetadata.scanIncomplete,
|
|
21279
|
+
// whose value this is). Absent on every capture that was scanned, so a
|
|
21280
|
+
// reader can tell a refused row from an empty clean one.
|
|
21281
|
+
scan_incomplete: external_exports.enum(["timeout", "unavailable"]).optional(),
|
|
21277
21282
|
// The scope key this capture was stamped with: the canonical repository
|
|
21278
21283
|
// (`host/owner/repo`) of the path the capture names (a relative path is read
|
|
21279
21284
|
// against its working directory), else of its own working directory, or a
|
|
@@ -22584,7 +22589,19 @@ var EventMetadata = external_exports.object({
|
|
|
22584
22589
|
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
22585
22590
|
// Closing either means moving the reason onto the finding row, which
|
|
22586
22591
|
// already carries its own action.
|
|
22587
|
-
redactDegradedTo: ActionTaken.optional()
|
|
22592
|
+
redactDegradedTo: ActionTaken.optional(),
|
|
22593
|
+
// Set when this capture's field was REFUSED rather than scanned: a hook
|
|
22594
|
+
// bounds the scan of a large field (see `LargeInputScanOptions` in
|
|
22595
|
+
// @akasecurity/plugin-sdk), and a scan that did not finish blocks the
|
|
22596
|
+
// field instead of letting it through unscanned.
|
|
22597
|
+
//
|
|
22598
|
+
// - 'timeout': the bounded scan ran out of time.
|
|
22599
|
+
// - 'unavailable': no worker could run it.
|
|
22600
|
+
//
|
|
22601
|
+
// A refused row stores '' as its content and has no findings, which is
|
|
22602
|
+
// exactly what a clean, empty capture looks like — this marker is the only
|
|
22603
|
+
// thing that tells the two apart. Absent on every capture that was scanned.
|
|
22604
|
+
scanIncomplete: external_exports.enum(["timeout", "unavailable"]).optional()
|
|
22588
22605
|
}).meta({ id: "EventMetadata" });
|
|
22589
22606
|
var Event = external_exports.object({
|
|
22590
22607
|
id: external_exports.guid(),
|
|
@@ -25714,6 +25731,38 @@ var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].m
|
|
|
25714
25731
|
);
|
|
25715
25732
|
var CPU_CORROBORATION_SHARE = 0.2;
|
|
25716
25733
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
25734
|
+
function repeatTo(unit, length) {
|
|
25735
|
+
return unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
|
|
25736
|
+
}
|
|
25737
|
+
function joinTo(length, open3, close, item) {
|
|
25738
|
+
const parts = [];
|
|
25739
|
+
let size = open3.length;
|
|
25740
|
+
for (let i = 0; size < length; i++) {
|
|
25741
|
+
const next = (i === 0 ? "" : ",") + item(i);
|
|
25742
|
+
parts.push(next);
|
|
25743
|
+
size += next.length;
|
|
25744
|
+
}
|
|
25745
|
+
return (open3 + parts.join("") + close).slice(0, length);
|
|
25746
|
+
}
|
|
25747
|
+
var SQL_WORDS = ["select", "insert", "update", "delete", "drop", "where"];
|
|
25748
|
+
var GROWTH_CORPORA = [
|
|
25749
|
+
{
|
|
25750
|
+
name: "one-line JSON dictionary",
|
|
25751
|
+
build: (length) => joinTo(length, "{", "}", (i) => `"id-${String(i)}":"label ${String(i)}"`)
|
|
25752
|
+
},
|
|
25753
|
+
{
|
|
25754
|
+
name: "JSON array of quoted SQL keywords",
|
|
25755
|
+
build: (length) => joinTo(length, "[", "]", (i) => `"${SQL_WORDS[i % SQL_WORDS.length] ?? ""} ${String(i)}"`)
|
|
25756
|
+
},
|
|
25757
|
+
{ name: "single-quoted keyword run ('where)", build: (length) => repeatTo("'where", length) },
|
|
25758
|
+
{ name: "double-quote run", build: (length) => repeatTo('"', length) },
|
|
25759
|
+
{ name: "space run", build: (length) => repeatTo(" ", length) },
|
|
25760
|
+
{ name: "newline run", build: (length) => repeatTo("\n", length) },
|
|
25761
|
+
...["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map((unit) => ({
|
|
25762
|
+
name: `unit run ${JSON.stringify(unit)}`,
|
|
25763
|
+
build: (length) => repeatTo(unit, length)
|
|
25764
|
+
}))
|
|
25765
|
+
];
|
|
25717
25766
|
|
|
25718
25767
|
// ../../packages/plugin-sdk/src/hook-fail-opens.ts
|
|
25719
25768
|
import { readFileSync as readFileSync11 } from "fs";
|
|
@@ -25971,6 +26020,7 @@ var CORRELATION_ID = EventMetadata.shape.correlationId;
|
|
|
25971
26020
|
var TRACE_ID = EventMetadata.shape.traceId;
|
|
25972
26021
|
var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
|
|
25973
26022
|
var REDACT_DEGRADED_TO = EventMetadata.shape.redactDegradedTo.unwrap();
|
|
26023
|
+
var SCAN_INCOMPLETE = EventMetadata.shape.scanIncomplete.unwrap();
|
|
25974
26024
|
|
|
25975
26025
|
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
25976
26026
|
var CAPTURE_BATCH_BYTES = 1024 * 1024;
|