@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/stop.js
CHANGED
|
@@ -8777,7 +8777,11 @@ var ListFindingTypesQuery = object({
|
|
|
8777
8777
|
// and so is not bounded by what any page happens to hold.
|
|
8778
8778
|
includeId: string2().optional(),
|
|
8779
8779
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
8780
|
-
cursor: string2().optional()
|
|
8780
|
+
cursor: string2().optional(),
|
|
8781
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8782
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8783
|
+
// from wherever it lands.
|
|
8784
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8781
8785
|
});
|
|
8782
8786
|
var ListFindingTypesResponse = object({
|
|
8783
8787
|
totals: object({
|
|
@@ -8858,7 +8862,11 @@ var ListFindingInstancesQuery = object({
|
|
|
8858
8862
|
sessionId: string2().optional(),
|
|
8859
8863
|
from: iso_exports.datetime().optional(),
|
|
8860
8864
|
limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
8861
|
-
cursor: string2().optional()
|
|
8865
|
+
cursor: string2().optional(),
|
|
8866
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8867
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8868
|
+
// from wherever it lands.
|
|
8869
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8862
8870
|
});
|
|
8863
8871
|
var ListFindingInstancesResponse = object({
|
|
8864
8872
|
// Instances matching the filters across the whole scope, not just this
|
|
@@ -8930,7 +8938,11 @@ var ListFindingLocationsQuery = object({
|
|
|
8930
8938
|
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
8931
8939
|
includeId: string2().optional(),
|
|
8932
8940
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
8933
|
-
cursor: string2().optional()
|
|
8941
|
+
cursor: string2().optional(),
|
|
8942
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8943
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8944
|
+
// from wherever it lands.
|
|
8945
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8934
8946
|
});
|
|
8935
8947
|
var ListFindingLocationsResponse = object({
|
|
8936
8948
|
totals: object({
|
|
@@ -11562,7 +11574,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
11562
11574
|
var ListVaultInventoryQuery = object({
|
|
11563
11575
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11564
11576
|
// Opaque; names the last row of the page just served.
|
|
11565
|
-
cursor: string2().optional()
|
|
11577
|
+
cursor: string2().optional(),
|
|
11578
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11579
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11580
|
+
// from wherever it lands.
|
|
11581
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11566
11582
|
});
|
|
11567
11583
|
var ListVaultInventoryResponse = object({
|
|
11568
11584
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -11574,7 +11590,11 @@ var ListVaultInventoryResponse = object({
|
|
|
11574
11590
|
});
|
|
11575
11591
|
var ListVaultReuseQuery = object({
|
|
11576
11592
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11577
|
-
cursor: string2().optional()
|
|
11593
|
+
cursor: string2().optional(),
|
|
11594
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11595
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11596
|
+
// from wherever it lands.
|
|
11597
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11578
11598
|
});
|
|
11579
11599
|
var ListVaultReuseResponse = object({
|
|
11580
11600
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -11590,9 +11610,15 @@ var ListVaultDerefsQuery = object({
|
|
|
11590
11610
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
11591
11611
|
includeBatched: boolean2().optional(),
|
|
11592
11612
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11593
|
-
cursor: string2().optional()
|
|
11613
|
+
cursor: string2().optional(),
|
|
11614
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11615
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11616
|
+
// from wherever it lands.
|
|
11617
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11594
11618
|
});
|
|
11595
11619
|
var ListVaultDerefsResponse = object({
|
|
11620
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
11621
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
11596
11622
|
items: array(VaultDeref),
|
|
11597
11623
|
nextCursor: string2().nullable(),
|
|
11598
11624
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -15104,6 +15130,21 @@ function passesPostValidators(rule, value) {
|
|
|
15104
15130
|
function getLoadedRules() {
|
|
15105
15131
|
return [...packs.values()].flatMap((p) => p.rules);
|
|
15106
15132
|
}
|
|
15133
|
+
function outsideWrittenRegions(candidates, context) {
|
|
15134
|
+
const regions = context?.writtenRegions;
|
|
15135
|
+
if (!regions || regions.length === 0 || context.eventKind !== "tool_use") return candidates;
|
|
15136
|
+
return candidates.filter((c) => {
|
|
15137
|
+
if (c.rule.category !== "code_flaw") return true;
|
|
15138
|
+
const { start, end } = c.match.span;
|
|
15139
|
+
return !regions.some(
|
|
15140
|
+
(r) => r.start <= start && end <= r.end && ruleApplies(
|
|
15141
|
+
c.rule,
|
|
15142
|
+
r.filePath === void 0 ? void 0 : extensionOf(r.filePath),
|
|
15143
|
+
"code_change"
|
|
15144
|
+
)
|
|
15145
|
+
);
|
|
15146
|
+
});
|
|
15147
|
+
}
|
|
15107
15148
|
function spansOverlap(a, b) {
|
|
15108
15149
|
return a.start < b.end && a.end > b.start;
|
|
15109
15150
|
}
|
|
@@ -15291,17 +15332,20 @@ function scanEncoded(text2, ruleset, context) {
|
|
|
15291
15332
|
function scanText(text2, ruleset, context) {
|
|
15292
15333
|
const extension = context?.filePath ? extensionOf(context.filePath) : void 0;
|
|
15293
15334
|
const normalization = normalizeFormatChars(text2);
|
|
15294
|
-
const originalCandidates =
|
|
15335
|
+
const originalCandidates = outsideWrittenRegions(
|
|
15336
|
+
buildCandidates(text2, ruleset, extension, context?.eventKind),
|
|
15337
|
+
context
|
|
15338
|
+
);
|
|
15295
15339
|
if (!normalization) return gate(originalCandidates, text2, void 0);
|
|
15296
15340
|
const pooledOriginal = originalCandidates.map(
|
|
15297
15341
|
(candidate) => withNormalizedSpan(candidate, normalization)
|
|
15298
15342
|
);
|
|
15299
|
-
const normalizedCandidates =
|
|
15300
|
-
normalization.normalized,
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
context
|
|
15304
|
-
)
|
|
15343
|
+
const normalizedCandidates = outsideWrittenRegions(
|
|
15344
|
+
buildCandidates(normalization.normalized, ruleset, extension, context?.eventKind).map(
|
|
15345
|
+
(candidate) => mapCandidateToOriginal(candidate, normalization, text2)
|
|
15346
|
+
),
|
|
15347
|
+
context
|
|
15348
|
+
);
|
|
15305
15349
|
const findings = gate([...pooledOriginal, ...normalizedCandidates], text2, normalization);
|
|
15306
15350
|
return mergeOverlappingSameRule(findings, text2);
|
|
15307
15351
|
}
|
|
@@ -16192,7 +16236,7 @@ var sql_inject_concat_dot_default = {
|
|
|
16192
16236
|
severity: "high",
|
|
16193
16237
|
matcher: {
|
|
16194
16238
|
type: "regex",
|
|
16195
|
-
pattern:
|
|
16239
|
+
pattern: "([\"'])(?=((?:(?!\\1)[^\\n])*?\\b(?:select\\b(?:(?!\\1|\\bselect\\b)[^\\n])*?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\s+[\\w.`\\[\\]${}]+(?:\\s*(?:!=|[=<>])|\\s+(?:in\\s*\\(|like\\s*(?!\\1)['\"%]|between\\b)))))\\2(?:(?!\\1(?:(?!\\1)[^\\n])*?\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\b))[^\\n])*?[\"']\\s*\\.",
|
|
16196
16240
|
flags: "gi"
|
|
16197
16241
|
},
|
|
16198
16242
|
appliesTo: {
|
|
@@ -16210,7 +16254,7 @@ var sql_inject_concat_default = {
|
|
|
16210
16254
|
severity: "high",
|
|
16211
16255
|
matcher: {
|
|
16212
16256
|
type: "regex",
|
|
16213
|
-
pattern:
|
|
16257
|
+
pattern: "([\"'])\\s*(?=(select\\b(?:(?!\\1\\s*(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\b))[^\\n])*?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\s+[\\w.`\\[\\]${}]+(?:\\s*(?:!=|[=<>])|\\s+(?:in\\s*\\(|like\\s*(?!\\1)['\"%]|between\\b))))\\2(?:(?!\\1\\s*(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\b))[^\\n])*?[\"']\\s*\\+",
|
|
16214
16258
|
flags: "gi"
|
|
16215
16259
|
},
|
|
16216
16260
|
examples: ['"SELECT * FROM users WHERE id = " + userId']
|
|
@@ -16225,7 +16269,7 @@ var sql_inject_format_default = {
|
|
|
16225
16269
|
severity: "high",
|
|
16226
16270
|
matcher: {
|
|
16227
16271
|
type: "regex",
|
|
16228
|
-
pattern:
|
|
16272
|
+
pattern: "([\"'`])\\s*(?=((?:select\\b(?:(?!\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b)|\\1)[^\\n])*?\\bfrom\\b)|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b))\\2(?:(?!\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b)|\\1)[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})|([\"'`])\\s*(?=((?:(?!\\3)[^\\n])*?\\bwhere\\s+[\\w.`\\[\\]${}]+(?:\\s*(?:!=|[=<>])|\\s+(?:in\\s*\\(|like\\s*(?=(?!\\3)['\"%])|between\\b))))\\4(?:(?!\\bwhere\\b|\\3)[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})|(?<=^|\\n)[ \\t]*(?=(select\\b(?:(?!\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b))[^\\n])*?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b))\\5(?:(?!\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b))[^\\n])*?(?:=\\s*['\"]?\\s*(?:%[sd]|\\{[^{}\\n]+\\})|[#$]\\{[^{}\\n]+\\})",
|
|
16229
16273
|
flags: "gi"
|
|
16230
16274
|
},
|
|
16231
16275
|
examples: [
|
|
@@ -16234,6 +16278,24 @@ var sql_inject_format_default = {
|
|
|
16234
16278
|
]
|
|
16235
16279
|
};
|
|
16236
16280
|
|
|
16281
|
+
// ../../rules/code-flaws/sql-inject-interp-multiline.json
|
|
16282
|
+
var sql_inject_interp_multiline_default = {
|
|
16283
|
+
specVersion: 1,
|
|
16284
|
+
id: "code-flaws/sql-inject-interp-multiline",
|
|
16285
|
+
name: "SQL injection via Ruby string interpolation or PHP variable (statement on its own line, e.g. a heredoc)",
|
|
16286
|
+
category: "code_flaw",
|
|
16287
|
+
severity: "high",
|
|
16288
|
+
matcher: {
|
|
16289
|
+
type: "regex",
|
|
16290
|
+
pattern: '(?<=^|\\n)[ \\t]*(?=(?:select\\b(?:[^\\n]*\\n){0,3}?[^\\n]*?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+\\w+)\\s+){0,2}into\\b|update\\s+(?:(?:low_priority|ignore|or\\s+\\w+)\\s+){0,2}(?:only\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+(?:\\s+(?:as\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+)?(?:\\s*,\\s*(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+(?:\\s+(?:as\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+)?){0,7}\\s+set(?:\\s+|(?=`))(?:(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+\\s*=|#\\{|\\{\\$|\\$[a-z_]\\w*(?:\\[[^\\]\\n]{1,200}\\])*(?=\\s*(?:["\'`;),]|\\n|$|(?:where|order|limit)\\b)))|delete\\s+(?:(?:low_priority|quick|ignore)\\s+){0,3}(?:from\\b|[\\w.`]+(?:\\s*,\\s*[\\w.`]+)*\\s+from\\s+[\\w.`]+(?:\\s+(?:as\\s+)?\\w+)?\\s+(?:(?:inner|cross|(?:left|right)(?:\\s+outer)?)\\s+)?(?:join|using|where)\\b)|where\\s+(?:(?:not\\s+)?(?:\\(\\s*)*(?:#\\{|\\{\\$|\\$[a-z_]\\w*(?:\\[[^\\]\\n]{1,200}\\])*(?=\\s*(?:["\'`;)]|\\n|$|(?:and|or|order|group|limit)\\b)))|(?:not\\s+)?exists\\s*\\(|(?:not\\s+)?(?:\\(\\s*)*(?:[\\w.`$"]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\[[^\\]\\n]{1,200}\\]|\'[^\'\\n]{0,200}\')+(?:\\s*\\((?:[^()\\n]|\\((?:[^()\\n]|\\([^()\\n]{0,200}\\))*\\))*\\))?(?:\\s*,\\s*(?:[\\w.`$"]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\[[^\\]\\n]{1,200}\\]|\'[^\'\\n]{0,200}\')+(?:\\s*\\((?:[^()\\n]|\\((?:[^()\\n]|\\([^()\\n]{0,200}\\))*\\))*\\))?){0,4}\\s*(?:\\)\\s*)?(?:[=<>!~@|&:%^*/+-]+|\\b(?:is|in|not|i?like|regexp|rlike|similar\\s+to|glob|between|against|match|exists|and|or)\\b))))(?:select|insert|update|delete|where)\\s[^\\n]*?(?:#\\{|\\$[a-z_])',
|
|
16291
|
+
flags: "gi"
|
|
16292
|
+
},
|
|
16293
|
+
examples: ["sql = <<~SQL\n SELECT * FROM users WHERE id = #{params[:id]}\nSQL"],
|
|
16294
|
+
appliesTo: {
|
|
16295
|
+
extensions: [".rb", ".php"]
|
|
16296
|
+
}
|
|
16297
|
+
};
|
|
16298
|
+
|
|
16237
16299
|
// ../../rules/code-flaws/sql-inject-interp.json
|
|
16238
16300
|
var sql_inject_interp_default = {
|
|
16239
16301
|
specVersion: 1,
|
|
@@ -16243,7 +16305,7 @@ var sql_inject_interp_default = {
|
|
|
16243
16305
|
severity: "high",
|
|
16244
16306
|
matcher: {
|
|
16245
16307
|
type: "regex",
|
|
16246
|
-
pattern: "([\
|
|
16308
|
+
pattern: '(?<![\\w\'"`})\\]])(["\'`])[ \\t]*(?=(?:select\\b(?:#\\{(?:[^{}\\n]|\\{(?:[^{}\\n]|\\{[^{}\\n]{0,100}\\}){0,100}\\}){0,200}\\}|\\{\\$[^}\\n]{0,200}\\}|\\\\(?!\\1[ \\t]*(?:select|insert|update|delete|where)\\b).|(?!\\1)(?!#\\{|\\{\\$|\\\\)[\\s\\S]){0,1000}?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+\\w+)\\s+){0,2}(?:into\\b|[\\w.`]+\\s*\\()|update\\s+(?:(?:low_priority|ignore|or\\s+\\w+)\\s+){0,2}(?:only\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+(?:\\s+(?:as\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+)?(?:\\s*,\\s*(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+(?:\\s+(?:as\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+)?){0,7}(?:(?:\\s+\\w+){0,2}\\s+join\\b(?:(?!\\bset\\b)(?!\\1)[^\\n]){1,300})?\\s+set(?:\\s+|(?=`))(?:(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+\\s*=|#\\{|\\{\\$|\\$[a-z_]\\w*(?:\\[[^\\]\\n]{1,200}\\])*(?=\\s*(?:["\'`;),]|\\n|$|(?:where|order|limit)\\b)))|delete\\s+(?:(?:low_priority|quick|ignore)\\s+){0,3}(?:from\\b|[\\w.`]+(?:\\s*,\\s*[\\w.`]+)*\\s+from\\s+[\\w.`]+(?:\\s+(?:as\\s+)?\\w+)?\\s+(?:(?:inner|cross|(?:left|right)(?:\\s+outer)?)\\s+)?(?:join|using|where)\\b)|where\\s+(?:(?:not\\s+)?(?:\\(\\s*)*(?:#\\{|\\{\\$|\\$[a-z_]\\w*(?:\\[[^\\]\\n]{1,200}\\])*(?=\\s*(?:["\'`;)]|\\n|$|(?:and|or|order|group|limit)\\b)))|(?:not\\s+)?exists\\s*\\(|(?:not\\s+)?(?:\\(\\s*)*(?:[\\w.`$"]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\[[^\\]\\n]{1,200}\\]|\'[^\'\\n]{0,200}\')+(?:\\s*\\((?:[^()\\n]|\\((?:[^()\\n]|\\([^()\\n]{0,200}\\))*\\))*\\))?(?:\\s*,\\s*(?:[\\w.`$"]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\[[^\\]\\n]{1,200}\\]|\'[^\'\\n]{0,200}\')+(?:\\s*\\((?:[^()\\n]|\\((?:[^()\\n]|\\([^()\\n]{0,200}\\))*\\))*\\))?){0,4}\\s*(?:\\)\\s*)?(?:[=<>!~@|&:%^*/+-]+|\\b(?:is|in|not|i?like|regexp|rlike|similar\\s+to|glob|between|against|match|exists|and|or)\\b))))\\b(?:select|insert|update|delete|where)\\b(?:(?!\\1)[^\\n])*?(?:#\\{|\\$[a-z_])',
|
|
16247
16309
|
flags: "gi"
|
|
16248
16310
|
},
|
|
16249
16311
|
examples: [
|
|
@@ -17971,12 +18033,13 @@ var BUNDLED_PACKS = [
|
|
|
17971
18033
|
{
|
|
17972
18034
|
packId: "code-flaws",
|
|
17973
18035
|
name: "Code Security Flaws",
|
|
17974
|
-
version: "0.1.
|
|
18036
|
+
version: "0.1.6",
|
|
17975
18037
|
rawRules: [
|
|
17976
18038
|
sql_inject_concat_default,
|
|
17977
18039
|
sql_inject_concat_dot_default,
|
|
17978
18040
|
sql_inject_format_default,
|
|
17979
18041
|
sql_inject_interp_default,
|
|
18042
|
+
sql_inject_interp_multiline_default,
|
|
17980
18043
|
cmd_inject_shell_default,
|
|
17981
18044
|
cmd_inject_exec_default,
|
|
17982
18045
|
cmd_inject_node_exec_default,
|
|
@@ -18008,6 +18071,7 @@ var BUNDLED_PACKS = [
|
|
|
18008
18071
|
"code-flaws/sql-inject-concat-dot": "SQL injection (PHP)",
|
|
18009
18072
|
"code-flaws/sql-inject-format": "SQL injection (format string)",
|
|
18010
18073
|
"code-flaws/sql-inject-interp": "SQL injection (interpolation)",
|
|
18074
|
+
"code-flaws/sql-inject-interp-multiline": "SQL injection (interpolation)",
|
|
18011
18075
|
"code-flaws/cmd-inject-shell": "Command injection (shell)",
|
|
18012
18076
|
"code-flaws/cmd-inject-exec": "Command injection (Java exec)",
|
|
18013
18077
|
"code-flaws/cmd-inject-node-exec": "Command injection (Node exec)",
|
|
@@ -24800,7 +24864,7 @@ var SqliteFindingsRepository = class {
|
|
|
24800
24864
|
};
|
|
24801
24865
|
const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
|
|
24802
24866
|
const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
|
|
24803
|
-
const start = cursor === null ? 0 : firstAfter(sorted, cursor);
|
|
24867
|
+
const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
|
|
24804
24868
|
const page = sorted.slice(start, start + limit);
|
|
24805
24869
|
const lastOnPage = page.at(-1);
|
|
24806
24870
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
|
|
@@ -24894,7 +24958,7 @@ var SqliteFindingsRepository = class {
|
|
|
24894
24958
|
accumulator.add(row);
|
|
24895
24959
|
if (!matchesInstanceFilters(row, opts)) continue;
|
|
24896
24960
|
total += 1;
|
|
24897
|
-
if (!isPastCursor(row)) continue;
|
|
24961
|
+
if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
|
|
24898
24962
|
if (items.length < limit) {
|
|
24899
24963
|
items.push(toInstanceDetail(row));
|
|
24900
24964
|
last = row;
|
|
@@ -24983,7 +25047,7 @@ var SqliteFindingsRepository = class {
|
|
|
24983
25047
|
}
|
|
24984
25048
|
}
|
|
24985
25049
|
sorted.sort(compareLocationOrder);
|
|
24986
|
-
const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
|
|
25050
|
+
const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
|
|
24987
25051
|
const page = sorted.slice(start, start + limit);
|
|
24988
25052
|
const lastOnPage = page.at(-1);
|
|
24989
25053
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
|
|
@@ -27611,6 +27675,9 @@ function pageLimit(requested, fallback) {
|
|
|
27611
27675
|
if (requested === void 0) return fallback;
|
|
27612
27676
|
return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
|
|
27613
27677
|
}
|
|
27678
|
+
function pageOffset(requested) {
|
|
27679
|
+
return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
|
|
27680
|
+
}
|
|
27614
27681
|
function encodeReuseCursor(payload) {
|
|
27615
27682
|
return Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
27616
27683
|
}
|
|
@@ -27958,7 +28025,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
27958
28025
|
*/
|
|
27959
28026
|
listInventory(query = {}, now = Date.now()) {
|
|
27960
28027
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
27961
|
-
const
|
|
28028
|
+
const offset = pageOffset(query.offset);
|
|
28029
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
27962
28030
|
const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
|
|
27963
28031
|
const rows = allRows(
|
|
27964
28032
|
this.db.prepare(
|
|
@@ -27972,11 +28040,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
27972
28040
|
FROM secret_vault v
|
|
27973
28041
|
${where}
|
|
27974
28042
|
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
27975
|
-
LIMIT :limit`
|
|
28043
|
+
LIMIT :limit OFFSET :offset`
|
|
27976
28044
|
),
|
|
27977
28045
|
bindParams({
|
|
27978
28046
|
now,
|
|
27979
28047
|
limit: limit + 1,
|
|
28048
|
+
offset,
|
|
27980
28049
|
...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
|
|
27981
28050
|
})
|
|
27982
28051
|
);
|
|
@@ -28000,7 +28069,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
28000
28069
|
*/
|
|
28001
28070
|
listReuse(query = {}, now = Date.now()) {
|
|
28002
28071
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
28003
|
-
const
|
|
28072
|
+
const offset = pageOffset(query.offset);
|
|
28073
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
|
|
28004
28074
|
const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
|
|
28005
28075
|
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
|
|
28006
28076
|
const rows = allRows(
|
|
@@ -28015,11 +28085,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
28015
28085
|
FROM secret_vault v
|
|
28016
28086
|
WHERE ${REUSED_PREDICATE} ${after}
|
|
28017
28087
|
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
28018
|
-
LIMIT :limit`
|
|
28088
|
+
LIMIT :limit OFFSET :offset`
|
|
28019
28089
|
),
|
|
28020
28090
|
bindParams({
|
|
28021
28091
|
now,
|
|
28022
28092
|
limit: limit + 1,
|
|
28093
|
+
offset,
|
|
28023
28094
|
...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
|
|
28024
28095
|
})
|
|
28025
28096
|
);
|
|
@@ -28044,7 +28115,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
28044
28115
|
*/
|
|
28045
28116
|
listDerefs(query = {}) {
|
|
28046
28117
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
|
|
28047
|
-
const
|
|
28118
|
+
const offset = pageOffset(query.offset);
|
|
28119
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
28048
28120
|
const conditions = [];
|
|
28049
28121
|
if (query.includeBatched !== true) {
|
|
28050
28122
|
conditions.push(`reason NOT IN ('display', 'view-render')`);
|
|
@@ -28057,21 +28129,28 @@ var SqliteSecretVaultRepository = class {
|
|
|
28057
28129
|
this.db.prepare(
|
|
28058
28130
|
`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
28059
28131
|
FROM secret_vault_deref ${where}
|
|
28060
|
-
ORDER BY at DESC, id DESC LIMIT :limit`
|
|
28132
|
+
ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
|
|
28061
28133
|
),
|
|
28062
28134
|
bindParams({
|
|
28063
28135
|
limit: limit + 1,
|
|
28136
|
+
offset,
|
|
28064
28137
|
...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
|
|
28065
28138
|
})
|
|
28066
28139
|
);
|
|
28067
28140
|
const hasMore = rows.length > limit;
|
|
28068
28141
|
const page = hasMore ? rows.slice(0, limit) : rows;
|
|
28069
28142
|
const last = page[page.length - 1];
|
|
28070
|
-
const
|
|
28071
|
-
this.db
|
|
28072
|
-
|
|
28073
|
-
|
|
28143
|
+
const counts = getRow(
|
|
28144
|
+
this.db.prepare(
|
|
28145
|
+
`SELECT count(*) AS total,
|
|
28146
|
+
count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
|
|
28147
|
+
FROM secret_vault_deref`
|
|
28148
|
+
)
|
|
28149
|
+
) ?? { total: 0, hidden: 0 };
|
|
28150
|
+
const includeBatched = query.includeBatched === true;
|
|
28151
|
+
const hiddenBatched = includeBatched ? 0 : counts.hidden;
|
|
28074
28152
|
return {
|
|
28153
|
+
totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
|
|
28075
28154
|
items: page.map((r) => ({
|
|
28076
28155
|
id: r.id,
|
|
28077
28156
|
pointerId: r.pointer_id,
|
|
@@ -28096,6 +28175,43 @@ var SqliteSecretVaultRepository = class {
|
|
|
28096
28175
|
`SELECT COUNT(*) AS n FROM secret_vault v WHERE ${REUSED_PREDICATE}`
|
|
28097
28176
|
);
|
|
28098
28177
|
}
|
|
28178
|
+
/**
|
|
28179
|
+
* Every entry held, and how many of them are NOT under `currentVersion` — the
|
|
28180
|
+
* standing record of a fingerprint-key rotation whose re-key did not reach
|
|
28181
|
+
* every row.
|
|
28182
|
+
*
|
|
28183
|
+
* This is the durable form of what `SecretVault.refreshFingerprints` reports
|
|
28184
|
+
* once. That count is an event, gone the moment it is printed; this is the
|
|
28185
|
+
* condition, and it stays true until some later rotation re-keys the rows. It
|
|
28186
|
+
* is therefore the one that can answer "is a shortfall still outstanding?" —
|
|
28187
|
+
* including for a rotation run from the CLI, which no dashboard render saw.
|
|
28188
|
+
*
|
|
28189
|
+
* `<>` rather than `<`: a row ahead of the current version is equally
|
|
28190
|
+
* unmatchable, and that is reachable — a key file restored from a backup, or
|
|
28191
|
+
* replaced after being lost, leaves rows stamped higher than the key is.
|
|
28192
|
+
*
|
|
28193
|
+
* Both numbers come from ONE statement, which is why this returns a pair
|
|
28194
|
+
* instead of offering two counts to call. Read separately, a purge landing
|
|
28195
|
+
* between them hands back a `stale` counted over rows the later `total` no
|
|
28196
|
+
* longer includes, and a disclosure built from that pair states a fraction
|
|
28197
|
+
* true of no state of the table — "1 of 0 stored values", or a negative
|
|
28198
|
+
* remainder. Same reasoning as `purgeVault`'s count, which comes from the
|
|
28199
|
+
* delete rather than from a `countEntries` standing beside it.
|
|
28200
|
+
*/
|
|
28201
|
+
countFingerprintEpochs(currentVersion) {
|
|
28202
|
+
const row = getRow(
|
|
28203
|
+
this.db.prepare(
|
|
28204
|
+
`SELECT COUNT(*) AS total,
|
|
28205
|
+
COALESCE(
|
|
28206
|
+
SUM(CASE WHEN fingerprint_key_version <> :currentVersion THEN 1 ELSE 0 END),
|
|
28207
|
+
0
|
|
28208
|
+
) AS stale
|
|
28209
|
+
FROM secret_vault`
|
|
28210
|
+
),
|
|
28211
|
+
{ currentVersion }
|
|
28212
|
+
) ?? { stale: 0, total: 0 };
|
|
28213
|
+
return { stale: row.stale, total: row.total };
|
|
28214
|
+
}
|
|
28099
28215
|
};
|
|
28100
28216
|
|
|
28101
28217
|
// ../../packages/persistence/src/repositories/security.ts
|
|
@@ -29865,13 +29981,22 @@ var SecretVault = class {
|
|
|
29865
29981
|
* fingerprint collides with a row already refreshed, is skipped rather than
|
|
29866
29982
|
* aborting the pass — one damaged entry must not strand the re-key of every
|
|
29867
29983
|
* other. A skipped row keeps resolving under its old fingerprint epoch.
|
|
29984
|
+
*
|
|
29985
|
+
* Every skip is COUNTED, because best-effort and silent are different things:
|
|
29986
|
+
* the loss above is invisible at the moment it happens and only shows up later
|
|
29987
|
+
* as a duplicate pointer, so the pass owes its caller a denominator rather
|
|
29988
|
+
* than a bare success count.
|
|
29868
29989
|
*/
|
|
29869
29990
|
async refreshFingerprints(next) {
|
|
29870
29991
|
let refreshed = 0;
|
|
29992
|
+
let skipped = 0;
|
|
29871
29993
|
for (const row of this.#repo.listAll()) {
|
|
29872
29994
|
try {
|
|
29873
29995
|
const raw = await this.#openRow(row);
|
|
29874
|
-
if (raw === null)
|
|
29996
|
+
if (raw === null) {
|
|
29997
|
+
skipped += 1;
|
|
29998
|
+
continue;
|
|
29999
|
+
}
|
|
29875
30000
|
this.#repo.refreshFingerprint(row.pointerId, {
|
|
29876
30001
|
valueFingerprint: exactFingerprintValue(next, raw),
|
|
29877
30002
|
valueIdentityFingerprint: fingerprintValue(next, raw),
|
|
@@ -29879,10 +30004,10 @@ var SecretVault = class {
|
|
|
29879
30004
|
});
|
|
29880
30005
|
refreshed += 1;
|
|
29881
30006
|
} catch {
|
|
29882
|
-
|
|
30007
|
+
skipped += 1;
|
|
29883
30008
|
}
|
|
29884
30009
|
}
|
|
29885
|
-
return refreshed;
|
|
30010
|
+
return { refreshed, skipped };
|
|
29886
30011
|
}
|
|
29887
30012
|
/**
|
|
29888
30013
|
* Destroy every entry, making all outstanding pointers permanently
|
|
@@ -30090,7 +30215,7 @@ function shippedRegexMatchers() {
|
|
|
30090
30215
|
}
|
|
30091
30216
|
|
|
30092
30217
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
30093
|
-
import { existsSync as existsSync9,
|
|
30218
|
+
import { existsSync as existsSync9, statSync as statSync7 } from "fs";
|
|
30094
30219
|
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute3, join as join24, sep as sep4 } from "path";
|
|
30095
30220
|
function remoteWithoutCredentials(remote) {
|
|
30096
30221
|
const withoutInfo = withoutUserinfo(remote);
|
|
@@ -30124,6 +30249,7 @@ function unparsedWithoutCredentials(remote) {
|
|
|
30124
30249
|
return `${scheme}${tail.split(/[?#]/, 1)[0] ?? ""}`;
|
|
30125
30250
|
}
|
|
30126
30251
|
var NO_ATTRIBUTION = Object.freeze({});
|
|
30252
|
+
var MAX_GIT_METADATA_BYTES = 1024 * 1024;
|
|
30127
30253
|
|
|
30128
30254
|
// ../../packages/plugin-sdk/src/events.ts
|
|
30129
30255
|
import { createHash as createHash9, randomUUID as randomUUID14 } from "crypto";
|
|
@@ -30376,6 +30502,7 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
30376
30502
|
text: text2,
|
|
30377
30503
|
filePath: context?.filePath,
|
|
30378
30504
|
eventKind: context?.eventKind,
|
|
30505
|
+
writtenRegions: context?.writtenRegions,
|
|
30379
30506
|
attribute: scanOpts?.attribute === true
|
|
30380
30507
|
}),
|
|
30381
30508
|
reply: (message) => {
|
|
@@ -30570,7 +30697,7 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
30570
30697
|
}
|
|
30571
30698
|
|
|
30572
30699
|
// ../../packages/plugin-sdk/src/hook-fail-opens.ts
|
|
30573
|
-
import { readFileSync as
|
|
30700
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
30574
30701
|
import { join as join25 } from "path";
|
|
30575
30702
|
var HOOK_FAIL_OPENS_FILENAME = "hook-fail-opens.json";
|
|
30576
30703
|
function hookFailOpensPath(dataDir2) {
|
|
@@ -30593,7 +30720,7 @@ function recordHookFailOpen(dataDir2, nowMs) {
|
|
|
30593
30720
|
}
|
|
30594
30721
|
function readHookFailOpens(dataDir2) {
|
|
30595
30722
|
try {
|
|
30596
|
-
const parsed2 = JSON.parse(
|
|
30723
|
+
const parsed2 = JSON.parse(readFileSync16(hookFailOpensPath(dataDir2), "utf8"));
|
|
30597
30724
|
if (typeof parsed2 !== "object" || parsed2 === null) return null;
|
|
30598
30725
|
const record2 = parsed2;
|
|
30599
30726
|
if (!isPositiveSafeInteger(record2.failOpens)) return null;
|
|
@@ -30613,7 +30740,7 @@ import {
|
|
|
30613
30740
|
fstatSync,
|
|
30614
30741
|
mkdirSync as mkdirSync2,
|
|
30615
30742
|
openSync as openSync2,
|
|
30616
|
-
readFileSync as
|
|
30743
|
+
readFileSync as readFileSync17,
|
|
30617
30744
|
readSync,
|
|
30618
30745
|
writeFileSync as writeFileSync5
|
|
30619
30746
|
} from "fs";
|
|
@@ -30639,7 +30766,7 @@ function readTail(path) {
|
|
|
30639
30766
|
const fd = openSync2(path, "r");
|
|
30640
30767
|
try {
|
|
30641
30768
|
const { size } = fstatSync(fd);
|
|
30642
|
-
if (size <= TAIL_BYTES) return { text:
|
|
30769
|
+
if (size <= TAIL_BYTES) return { text: readFileSync17(fd, "utf8"), truncated: false };
|
|
30643
30770
|
const buffer = Buffer.allocUnsafe(TAIL_BYTES);
|
|
30644
30771
|
let filled = 0;
|
|
30645
30772
|
while (filled < TAIL_BYTES) {
|
|
@@ -30937,7 +31064,7 @@ import {
|
|
|
30937
31064
|
fstatSync as fstatSync2,
|
|
30938
31065
|
mkdirSync as mkdirSync4,
|
|
30939
31066
|
openSync as openSync3,
|
|
30940
|
-
readFileSync as
|
|
31067
|
+
readFileSync as readFileSync18,
|
|
30941
31068
|
readSync as readSync2,
|
|
30942
31069
|
writeFileSync as writeFileSync7
|
|
30943
31070
|
} from "fs";
|
|
@@ -32039,7 +32166,7 @@ function sessionToolIsKeyed(tool) {
|
|
|
32039
32166
|
|
|
32040
32167
|
// ../../packages/plugin-runtime/src/attached/config-inventory-sync.ts
|
|
32041
32168
|
import { createHash as createHash12 } from "crypto";
|
|
32042
|
-
import { readFileSync as
|
|
32169
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
32043
32170
|
import { join as join33 } from "path";
|
|
32044
32171
|
|
|
32045
32172
|
// ../../packages/plugin-runtime/src/attached/config-inventory-wire.ts
|
|
@@ -32139,7 +32266,7 @@ async function publishByRename(tmp, file, move = rename2) {
|
|
|
32139
32266
|
|
|
32140
32267
|
// ../../packages/plugin-runtime/src/attached/capture-settings.ts
|
|
32141
32268
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
32142
|
-
import { readFileSync as
|
|
32269
|
+
import { readFileSync as readFileSync19 } from "fs";
|
|
32143
32270
|
import { rm, writeFile as writeFile2 } from "fs/promises";
|
|
32144
32271
|
import { join as join31 } from "path";
|
|
32145
32272
|
var HookCaptureSettingsSchema = CaptureSettings.pick({
|
|
@@ -32527,7 +32654,7 @@ function reportKey(request) {
|
|
|
32527
32654
|
function readStagedEntries(dataDir2) {
|
|
32528
32655
|
let parsed2;
|
|
32529
32656
|
try {
|
|
32530
|
-
parsed2 = JSON.parse(
|
|
32657
|
+
parsed2 = JSON.parse(readFileSync20(stagedConfigInventoryPath(dataDir2), "utf8"));
|
|
32531
32658
|
} catch {
|
|
32532
32659
|
return [];
|
|
32533
32660
|
}
|
|
@@ -32551,7 +32678,7 @@ function isTimestamp(value) {
|
|
|
32551
32678
|
}
|
|
32552
32679
|
|
|
32553
32680
|
// ../../packages/plugin-runtime/src/attached/forward-drops.ts
|
|
32554
|
-
import { readFileSync as
|
|
32681
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
32555
32682
|
import { join as join34 } from "path";
|
|
32556
32683
|
var FORWARD_DROPS_FILENAME = ATTACHED_FORWARD_DROPS_FILENAME;
|
|
32557
32684
|
function forwardDropsPath(dataDir2) {
|
|
@@ -32573,7 +32700,7 @@ function recordForwardDrops(dataDir2, count, nowMs) {
|
|
|
32573
32700
|
}
|
|
32574
32701
|
function readForwardDrops(dataDir2) {
|
|
32575
32702
|
try {
|
|
32576
|
-
const parsed2 = JSON.parse(
|
|
32703
|
+
const parsed2 = JSON.parse(readFileSync21(forwardDropsPath(dataDir2), "utf8"));
|
|
32577
32704
|
if (typeof parsed2 !== "object" || parsed2 === null) return null;
|
|
32578
32705
|
const record2 = parsed2;
|
|
32579
32706
|
if (typeof record2.droppedForwards !== "number" || !Number.isFinite(record2.droppedForwards)) {
|
|
@@ -33677,7 +33804,7 @@ function toWireInspection(insp, nameKey) {
|
|
|
33677
33804
|
}
|
|
33678
33805
|
|
|
33679
33806
|
// ../../packages/plugin-runtime/src/attached/plugin-block.ts
|
|
33680
|
-
import { readFileSync as
|
|
33807
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
33681
33808
|
|
|
33682
33809
|
// ../../packages/plugin-runtime/src/attached/install-record.ts
|
|
33683
33810
|
import { readFile as readFile3, stat } from "fs/promises";
|
|
@@ -33750,7 +33877,7 @@ async function readInstalledVersionBounded(installRoot) {
|
|
|
33750
33877
|
}
|
|
33751
33878
|
|
|
33752
33879
|
// ../../packages/plugin-runtime/src/attached/posture-report-state.ts
|
|
33753
|
-
import { readFileSync as
|
|
33880
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
33754
33881
|
import { join as join36 } from "path";
|
|
33755
33882
|
var POSTURE_REPORT_STATE_FILENAME = ATTACHED_POSTURE_REPORT_FILENAME;
|
|
33756
33883
|
var OUTCOME_KEYS = {
|
|
@@ -34698,11 +34825,11 @@ function codexHookAccount(input) {
|
|
|
34698
34825
|
}
|
|
34699
34826
|
|
|
34700
34827
|
// ../../packages/plugin-runtime/src/attached/label-drops.ts
|
|
34701
|
-
import { readFileSync as
|
|
34828
|
+
import { readFileSync as readFileSync24 } from "fs";
|
|
34702
34829
|
import { join as join41 } from "path";
|
|
34703
34830
|
|
|
34704
34831
|
// ../../packages/plugin-runtime/src/attached/sync-state.ts
|
|
34705
|
-
import { readFileSync as
|
|
34832
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
34706
34833
|
import { join as join42 } from "path";
|
|
34707
34834
|
|
|
34708
34835
|
// ../../packages/plugin-runtime/src/attached/status.ts
|
|
@@ -35029,7 +35156,7 @@ function parseStopPayload(input) {
|
|
|
35029
35156
|
}
|
|
35030
35157
|
|
|
35031
35158
|
// src/hooks/store-health.ts
|
|
35032
|
-
import { mkdirSync as mkdirSync6, readFileSync as
|
|
35159
|
+
import { mkdirSync as mkdirSync6, readFileSync as readFileSync26, writeFileSync as writeFileSync8 } from "fs";
|
|
35033
35160
|
import { dirname as dirname11, join as join44 } from "path";
|
|
35034
35161
|
var STORE_REDIRECT_MARKER = "store-redirect-last-session";
|
|
35035
35162
|
var RECENT_SESSIONS = 32;
|
|
@@ -35049,7 +35176,7 @@ function alreadyClaimed(dirs, marker, sessionId) {
|
|
|
35049
35176
|
}
|
|
35050
35177
|
function readRecent(dir, marker) {
|
|
35051
35178
|
try {
|
|
35052
|
-
return
|
|
35179
|
+
return readFileSync26(join44(dir, marker), "utf8").split("\n").filter(Boolean);
|
|
35053
35180
|
} catch {
|
|
35054
35181
|
return [];
|
|
35055
35182
|
}
|