@akasecurity/ai-tc-claude-code 0.9.2 → 0.9.3
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/.claude-plugin/plugin.json +1 -1
- package/package.json +3 -3
- package/scripts/apply-suppressions.js +94 -45
- package/scripts/backfill.js +139 -47
- package/scripts/filescan.js +141 -49
- package/scripts/firstrun.js +93 -44
- package/scripts/intro.js +6 -5
- package/scripts/onboard.js +93 -44
- package/scripts/post-tool-use.js +139 -47
- package/scripts/pre-tool-use.js +139 -47
- package/scripts/query.js +93 -44
- package/scripts/reconcile.js +95 -46
- package/scripts/remediate.js +139 -47
- package/scripts/session-start.js +96 -47
- package/scripts/start-light.js +6 -5
- package/scripts/statusline.js +93 -44
- package/scripts/stop.js +7 -6
- package/scripts/user-prompt-submit.js +139 -47
package/scripts/pre-tool-use.js
CHANGED
|
@@ -492,7 +492,7 @@ var require_ignore = __commonJS({
|
|
|
492
492
|
});
|
|
493
493
|
|
|
494
494
|
// ../../packages/plugin-sdk/src/config.ts
|
|
495
|
-
import { existsSync as
|
|
495
|
+
import { existsSync as existsSync4 } from "fs";
|
|
496
496
|
import { join as join6 } from "path";
|
|
497
497
|
|
|
498
498
|
// ../../packages/persistence/src/database.ts
|
|
@@ -23389,11 +23389,22 @@ function purgeSampleData(db) {
|
|
|
23389
23389
|
function linkHost(input, hostId) {
|
|
23390
23390
|
return hostId ? { ...input, hostId } : input;
|
|
23391
23391
|
}
|
|
23392
|
+
function closeQuietly(db) {
|
|
23393
|
+
try {
|
|
23394
|
+
db.close();
|
|
23395
|
+
} catch {
|
|
23396
|
+
}
|
|
23397
|
+
}
|
|
23392
23398
|
function openWithPragmas(file2) {
|
|
23393
23399
|
const db = new DatabaseSync(file2);
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
|
|
23400
|
+
try {
|
|
23401
|
+
db.exec("PRAGMA journal_mode = WAL");
|
|
23402
|
+
db.exec("PRAGMA busy_timeout = 2000");
|
|
23403
|
+
db.exec("PRAGMA foreign_keys = ON");
|
|
23404
|
+
} catch (err) {
|
|
23405
|
+
closeQuietly(db);
|
|
23406
|
+
throw err;
|
|
23407
|
+
}
|
|
23397
23408
|
return db;
|
|
23398
23409
|
}
|
|
23399
23410
|
function backupLegacyStore(file2) {
|
|
@@ -23405,43 +23416,80 @@ function backupLegacyStore(file2) {
|
|
|
23405
23416
|
}
|
|
23406
23417
|
return backup;
|
|
23407
23418
|
}
|
|
23419
|
+
function openAndInitialize(file2) {
|
|
23420
|
+
let db = openWithPragmas(file2);
|
|
23421
|
+
try {
|
|
23422
|
+
if (isForeignSqliteLineage(db)) {
|
|
23423
|
+
db.close();
|
|
23424
|
+
const backup = backupLegacyStore(file2);
|
|
23425
|
+
db = openWithPragmas(file2);
|
|
23426
|
+
akaWarn(
|
|
23427
|
+
`Detected an older, incompatible (tenant-bearing) ${DB_FILENAME}; backed it up to ${backup} and created a fresh store.`
|
|
23428
|
+
);
|
|
23429
|
+
}
|
|
23430
|
+
applyMigrations(db, file2);
|
|
23431
|
+
tightenPerms(file2);
|
|
23432
|
+
const policies = new SqlitePoliciesRepository(db);
|
|
23433
|
+
const installedPacks = new SqliteInstalledPacksRepository(db);
|
|
23434
|
+
const repositories = {
|
|
23435
|
+
events: new SqliteEventsRepository(db),
|
|
23436
|
+
findings: new SqliteFindingsRepository(db),
|
|
23437
|
+
policies,
|
|
23438
|
+
installedPacks,
|
|
23439
|
+
scanLedger: new SqliteScanLedgerRepository(db),
|
|
23440
|
+
exceptions: new SqliteExceptionsRepository(db),
|
|
23441
|
+
resolutions: new SqliteResolutionsRepository(db),
|
|
23442
|
+
ruleProbeCache: new SqliteRuleProbeCacheRepository(db),
|
|
23443
|
+
security: new SqliteSecurityRepository(db),
|
|
23444
|
+
detections: new SqliteDetectionsRepository(db),
|
|
23445
|
+
shares: new SqliteSharesRepository(db),
|
|
23446
|
+
policyCatalog: new SqlitePolicyCatalogRepository(installedPacks),
|
|
23447
|
+
inventory: new SqliteInventoryRepository(db),
|
|
23448
|
+
inventoryAssets: new SqliteInventoryAssetsRepository(db),
|
|
23449
|
+
projectFiles: new SqliteProjectFilesRepository(db),
|
|
23450
|
+
activity: new SqliteActivityRepository(db),
|
|
23451
|
+
sourceProject: new SqliteSourceProjectRepository(db),
|
|
23452
|
+
auditEvents: new SqliteAuditEventsRepository(db),
|
|
23453
|
+
classifiedData: new SqliteClassifiedDataRepository(db),
|
|
23454
|
+
inspectionDefinitions: new SqliteInspectionDefinitionsRepository(db),
|
|
23455
|
+
inspectionFindings: new SqliteInspectionFindingsRepository(db),
|
|
23456
|
+
configInventory: new SqliteConfigInventoryRepository(db)
|
|
23457
|
+
};
|
|
23458
|
+
policies.seedDefaults();
|
|
23459
|
+
return { db, ...repositories };
|
|
23460
|
+
} catch (err) {
|
|
23461
|
+
closeQuietly(db);
|
|
23462
|
+
throw err;
|
|
23463
|
+
}
|
|
23464
|
+
}
|
|
23408
23465
|
function openLocalDatabase(dir) {
|
|
23409
23466
|
ensureDataDirSync(dir);
|
|
23410
23467
|
const file2 = join(dir, DB_FILENAME);
|
|
23411
|
-
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
|
|
23420
|
-
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
|
|
23424
|
-
|
|
23425
|
-
|
|
23426
|
-
|
|
23427
|
-
|
|
23428
|
-
|
|
23429
|
-
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
|
|
23434
|
-
|
|
23435
|
-
|
|
23436
|
-
const projectFiles = new SqliteProjectFilesRepository(db);
|
|
23437
|
-
const activity = new SqliteActivityRepository(db);
|
|
23438
|
-
const sourceProject = new SqliteSourceProjectRepository(db);
|
|
23439
|
-
const auditEvents = new SqliteAuditEventsRepository(db);
|
|
23440
|
-
const classifiedData = new SqliteClassifiedDataRepository(db);
|
|
23441
|
-
const inspectionDefinitions = new SqliteInspectionDefinitionsRepository(db);
|
|
23442
|
-
const inspectionFindings = new SqliteInspectionFindingsRepository(db);
|
|
23443
|
-
const configInventory = new SqliteConfigInventoryRepository(db);
|
|
23444
|
-
policies.seedDefaults();
|
|
23468
|
+
const {
|
|
23469
|
+
db,
|
|
23470
|
+
events,
|
|
23471
|
+
findings,
|
|
23472
|
+
policies,
|
|
23473
|
+
installedPacks,
|
|
23474
|
+
scanLedger,
|
|
23475
|
+
exceptions,
|
|
23476
|
+
resolutions,
|
|
23477
|
+
ruleProbeCache,
|
|
23478
|
+
security,
|
|
23479
|
+
detections,
|
|
23480
|
+
shares,
|
|
23481
|
+
policyCatalog,
|
|
23482
|
+
inventory,
|
|
23483
|
+
inventoryAssets,
|
|
23484
|
+
projectFiles,
|
|
23485
|
+
activity,
|
|
23486
|
+
sourceProject,
|
|
23487
|
+
auditEvents,
|
|
23488
|
+
classifiedData,
|
|
23489
|
+
inspectionDefinitions,
|
|
23490
|
+
inspectionFindings,
|
|
23491
|
+
configInventory
|
|
23492
|
+
} = openAndInitialize(file2);
|
|
23445
23493
|
function recordCapture(event, detected) {
|
|
23446
23494
|
failOpenTransaction(db, () => {
|
|
23447
23495
|
const sessionId = event.metadata?.sessionId;
|
|
@@ -23653,8 +23701,9 @@ function computeFindingKey(input) {
|
|
|
23653
23701
|
|
|
23654
23702
|
// ../../packages/persistence/src/fingerprint.ts
|
|
23655
23703
|
import { createHmac, randomBytes } from "crypto";
|
|
23656
|
-
import { readFileSync } from "fs";
|
|
23704
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
23657
23705
|
import { join as join2 } from "path";
|
|
23706
|
+
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
23658
23707
|
var KEY_FILENAME = "exception.key";
|
|
23659
23708
|
var KEY_MATERIAL_BYTES = 32;
|
|
23660
23709
|
function keyFilePath(dataDir2) {
|
|
@@ -23678,6 +23727,46 @@ function parseKeyFile(raw) {
|
|
|
23678
23727
|
}
|
|
23679
23728
|
return { version: version2, material: bytes };
|
|
23680
23729
|
}
|
|
23730
|
+
var KEY_VERSION_TABLES = ["exceptions", "blocked_detections"];
|
|
23731
|
+
var SQLITE_ERROR = 1;
|
|
23732
|
+
var FLOOR_BUSY_TIMEOUT_MS = 250;
|
|
23733
|
+
var FloorUnreadableError = class extends Error {
|
|
23734
|
+
code = "floor-unreadable";
|
|
23735
|
+
constructor(cause) {
|
|
23736
|
+
super(
|
|
23737
|
+
`cannot read the stored fingerprint key versions: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
23738
|
+
{ cause }
|
|
23739
|
+
);
|
|
23740
|
+
this.name = "FloorUnreadableError";
|
|
23741
|
+
}
|
|
23742
|
+
};
|
|
23743
|
+
function storedKeyVersionFloor(dataDir2) {
|
|
23744
|
+
const file2 = join2(dataDir2, DB_FILENAME);
|
|
23745
|
+
if (!existsSync2(file2)) return 0;
|
|
23746
|
+
let db;
|
|
23747
|
+
try {
|
|
23748
|
+
db = new DatabaseSync2(file2, { readOnly: true });
|
|
23749
|
+
db.exec(`PRAGMA busy_timeout = ${String(FLOOR_BUSY_TIMEOUT_MS)}`);
|
|
23750
|
+
let floor = 0;
|
|
23751
|
+
for (const table of KEY_VERSION_TABLES) {
|
|
23752
|
+
try {
|
|
23753
|
+
const row = getRow(
|
|
23754
|
+
db.prepare(`SELECT MAX(key_version) AS v FROM ${table}`)
|
|
23755
|
+
);
|
|
23756
|
+
floor = Math.max(floor, row?.v ?? 0);
|
|
23757
|
+
} catch (err) {
|
|
23758
|
+
if (err.errcode !== SQLITE_ERROR) {
|
|
23759
|
+
throw new FloorUnreadableError(err);
|
|
23760
|
+
}
|
|
23761
|
+
}
|
|
23762
|
+
}
|
|
23763
|
+
return floor;
|
|
23764
|
+
} catch (err) {
|
|
23765
|
+
throw err instanceof FloorUnreadableError ? err : new FloorUnreadableError(err);
|
|
23766
|
+
} finally {
|
|
23767
|
+
db?.close();
|
|
23768
|
+
}
|
|
23769
|
+
}
|
|
23681
23770
|
function writeKeyFile(dataDir2, key) {
|
|
23682
23771
|
ensureDataDirSync(dataDir2);
|
|
23683
23772
|
const file2 = keyFilePath(dataDir2);
|
|
@@ -23702,7 +23791,10 @@ function loadOrCreateFingerprintKey(dataDir2) {
|
|
|
23702
23791
|
tightenFile(keyFilePath(dataDir2));
|
|
23703
23792
|
return existing;
|
|
23704
23793
|
}
|
|
23705
|
-
return writeKeyFile(dataDir2, {
|
|
23794
|
+
return writeKeyFile(dataDir2, {
|
|
23795
|
+
version: storedKeyVersionFloor(dataDir2) + 1,
|
|
23796
|
+
material: randomBytes(KEY_MATERIAL_BYTES)
|
|
23797
|
+
});
|
|
23706
23798
|
}
|
|
23707
23799
|
function fingerprintValue(key, raw) {
|
|
23708
23800
|
return createHmac("sha256", key.material).update(raw, "utf8").digest("hex");
|
|
@@ -23767,13 +23859,13 @@ function readJson(file2) {
|
|
|
23767
23859
|
}
|
|
23768
23860
|
|
|
23769
23861
|
// ../../packages/persistence/src/warn-era-cap.ts
|
|
23770
|
-
import { existsSync as
|
|
23862
|
+
import { existsSync as existsSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
23771
23863
|
import { join as join5 } from "path";
|
|
23772
23864
|
var MARKER = "warn-era-capped";
|
|
23773
23865
|
function capWarnEraEnforcementOnce(db, policyMode, dataDir2) {
|
|
23774
23866
|
if (policyMode !== "warn") return { capped: 0, skipped: "not-warn" };
|
|
23775
23867
|
const marker = join5(dataDir2, MARKER);
|
|
23776
|
-
if (
|
|
23868
|
+
if (existsSync3(marker)) return { capped: 0, skipped: "already-run" };
|
|
23777
23869
|
const capped = db.policies.capCategoryActions();
|
|
23778
23870
|
writeFileSync2(marker, `${new Date(Date.now()).toISOString()}
|
|
23779
23871
|
`, { mode: DATA_FILE_MODE });
|
|
@@ -23833,7 +23925,7 @@ function loadConfig(base = defaultDataDir()) {
|
|
|
23833
23925
|
try {
|
|
23834
23926
|
ensureLayoutDirSync(base);
|
|
23835
23927
|
const settingsFile = join6(settingsDir(base), "settings.json");
|
|
23836
|
-
if (
|
|
23928
|
+
if (existsSync4(settingsFile)) tightenFile(settingsFile);
|
|
23837
23929
|
} catch {
|
|
23838
23930
|
}
|
|
23839
23931
|
migrateLegacyLayout(base);
|
|
@@ -26876,7 +26968,7 @@ function bundledDetections() {
|
|
|
26876
26968
|
}
|
|
26877
26969
|
|
|
26878
26970
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
26879
|
-
import { existsSync as
|
|
26971
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3, statSync } from "fs";
|
|
26880
26972
|
import { basename, dirname, isAbsolute, join as join7, sep as sep2 } from "path";
|
|
26881
26973
|
function resolveRepo(cwd) {
|
|
26882
26974
|
try {
|
|
@@ -26892,7 +26984,7 @@ function resolveRepo(cwd) {
|
|
|
26892
26984
|
function findGitRoot(start) {
|
|
26893
26985
|
let dir = start;
|
|
26894
26986
|
for (; ; ) {
|
|
26895
|
-
if (
|
|
26987
|
+
if (existsSync5(join7(dir, ".git"))) return dir;
|
|
26896
26988
|
const parent = dirname(dir);
|
|
26897
26989
|
if (parent === dir) return void 0;
|
|
26898
26990
|
dir = parent;
|
|
@@ -26910,7 +27002,7 @@ function resolveGitContext(root) {
|
|
|
26910
27002
|
const target = /^gitdir:\s*(.+?)\s*$/m.exec(safeRead(dotGit) ?? "")?.[1];
|
|
26911
27003
|
if (!target) return void 0;
|
|
26912
27004
|
const gitdir = isAbsolute(target) ? target : join7(root, target);
|
|
26913
|
-
if (
|
|
27005
|
+
if (existsSync5(join7(gitdir, "config"))) {
|
|
26914
27006
|
return { configPath: join7(gitdir, "config"), headRoot: root };
|
|
26915
27007
|
}
|
|
26916
27008
|
const commonRaw = safeRead(join7(gitdir, "commondir"))?.trim();
|
|
@@ -26994,7 +27086,7 @@ import { basename as basename3, dirname as dirname2, sep as sep3 } from "path";
|
|
|
26994
27086
|
|
|
26995
27087
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
26996
27088
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
26997
|
-
import { existsSync as
|
|
27089
|
+
import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "fs";
|
|
26998
27090
|
import { basename as basename4, join as join10, relative, sep as sep4 } from "path";
|
|
26999
27091
|
|
|
27000
27092
|
// ../../packages/plugin-sdk/src/rule-quarantine.ts
|
package/scripts/query.js
CHANGED
|
@@ -23428,11 +23428,22 @@ function purgeSampleData(db) {
|
|
|
23428
23428
|
function linkHost(input, hostId) {
|
|
23429
23429
|
return hostId ? { ...input, hostId } : input;
|
|
23430
23430
|
}
|
|
23431
|
+
function closeQuietly(db) {
|
|
23432
|
+
try {
|
|
23433
|
+
db.close();
|
|
23434
|
+
} catch {
|
|
23435
|
+
}
|
|
23436
|
+
}
|
|
23431
23437
|
function openWithPragmas(file2) {
|
|
23432
23438
|
const db = new DatabaseSync(file2);
|
|
23433
|
-
|
|
23434
|
-
|
|
23435
|
-
|
|
23439
|
+
try {
|
|
23440
|
+
db.exec("PRAGMA journal_mode = WAL");
|
|
23441
|
+
db.exec("PRAGMA busy_timeout = 2000");
|
|
23442
|
+
db.exec("PRAGMA foreign_keys = ON");
|
|
23443
|
+
} catch (err) {
|
|
23444
|
+
closeQuietly(db);
|
|
23445
|
+
throw err;
|
|
23446
|
+
}
|
|
23436
23447
|
return db;
|
|
23437
23448
|
}
|
|
23438
23449
|
function backupLegacyStore(file2) {
|
|
@@ -23444,43 +23455,80 @@ function backupLegacyStore(file2) {
|
|
|
23444
23455
|
}
|
|
23445
23456
|
return backup;
|
|
23446
23457
|
}
|
|
23458
|
+
function openAndInitialize(file2) {
|
|
23459
|
+
let db = openWithPragmas(file2);
|
|
23460
|
+
try {
|
|
23461
|
+
if (isForeignSqliteLineage(db)) {
|
|
23462
|
+
db.close();
|
|
23463
|
+
const backup = backupLegacyStore(file2);
|
|
23464
|
+
db = openWithPragmas(file2);
|
|
23465
|
+
akaWarn(
|
|
23466
|
+
`Detected an older, incompatible (tenant-bearing) ${DB_FILENAME}; backed it up to ${backup} and created a fresh store.`
|
|
23467
|
+
);
|
|
23468
|
+
}
|
|
23469
|
+
applyMigrations(db, file2);
|
|
23470
|
+
tightenPerms(file2);
|
|
23471
|
+
const policies = new SqlitePoliciesRepository(db);
|
|
23472
|
+
const installedPacks = new SqliteInstalledPacksRepository(db);
|
|
23473
|
+
const repositories = {
|
|
23474
|
+
events: new SqliteEventsRepository(db),
|
|
23475
|
+
findings: new SqliteFindingsRepository(db),
|
|
23476
|
+
policies,
|
|
23477
|
+
installedPacks,
|
|
23478
|
+
scanLedger: new SqliteScanLedgerRepository(db),
|
|
23479
|
+
exceptions: new SqliteExceptionsRepository(db),
|
|
23480
|
+
resolutions: new SqliteResolutionsRepository(db),
|
|
23481
|
+
ruleProbeCache: new SqliteRuleProbeCacheRepository(db),
|
|
23482
|
+
security: new SqliteSecurityRepository(db),
|
|
23483
|
+
detections: new SqliteDetectionsRepository(db),
|
|
23484
|
+
shares: new SqliteSharesRepository(db),
|
|
23485
|
+
policyCatalog: new SqlitePolicyCatalogRepository(installedPacks),
|
|
23486
|
+
inventory: new SqliteInventoryRepository(db),
|
|
23487
|
+
inventoryAssets: new SqliteInventoryAssetsRepository(db),
|
|
23488
|
+
projectFiles: new SqliteProjectFilesRepository(db),
|
|
23489
|
+
activity: new SqliteActivityRepository(db),
|
|
23490
|
+
sourceProject: new SqliteSourceProjectRepository(db),
|
|
23491
|
+
auditEvents: new SqliteAuditEventsRepository(db),
|
|
23492
|
+
classifiedData: new SqliteClassifiedDataRepository(db),
|
|
23493
|
+
inspectionDefinitions: new SqliteInspectionDefinitionsRepository(db),
|
|
23494
|
+
inspectionFindings: new SqliteInspectionFindingsRepository(db),
|
|
23495
|
+
configInventory: new SqliteConfigInventoryRepository(db)
|
|
23496
|
+
};
|
|
23497
|
+
policies.seedDefaults();
|
|
23498
|
+
return { db, ...repositories };
|
|
23499
|
+
} catch (err) {
|
|
23500
|
+
closeQuietly(db);
|
|
23501
|
+
throw err;
|
|
23502
|
+
}
|
|
23503
|
+
}
|
|
23447
23504
|
function openLocalDatabase(dir) {
|
|
23448
23505
|
ensureDataDirSync(dir);
|
|
23449
23506
|
const file2 = join(dir, DB_FILENAME);
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
|
|
23454
|
-
|
|
23455
|
-
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
|
|
23461
|
-
|
|
23462
|
-
|
|
23463
|
-
|
|
23464
|
-
|
|
23465
|
-
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
|
|
23469
|
-
|
|
23470
|
-
|
|
23471
|
-
|
|
23472
|
-
|
|
23473
|
-
|
|
23474
|
-
|
|
23475
|
-
const projectFiles = new SqliteProjectFilesRepository(db);
|
|
23476
|
-
const activity = new SqliteActivityRepository(db);
|
|
23477
|
-
const sourceProject = new SqliteSourceProjectRepository(db);
|
|
23478
|
-
const auditEvents = new SqliteAuditEventsRepository(db);
|
|
23479
|
-
const classifiedData = new SqliteClassifiedDataRepository(db);
|
|
23480
|
-
const inspectionDefinitions = new SqliteInspectionDefinitionsRepository(db);
|
|
23481
|
-
const inspectionFindings = new SqliteInspectionFindingsRepository(db);
|
|
23482
|
-
const configInventory = new SqliteConfigInventoryRepository(db);
|
|
23483
|
-
policies.seedDefaults();
|
|
23507
|
+
const {
|
|
23508
|
+
db,
|
|
23509
|
+
events,
|
|
23510
|
+
findings,
|
|
23511
|
+
policies,
|
|
23512
|
+
installedPacks,
|
|
23513
|
+
scanLedger,
|
|
23514
|
+
exceptions,
|
|
23515
|
+
resolutions,
|
|
23516
|
+
ruleProbeCache,
|
|
23517
|
+
security,
|
|
23518
|
+
detections,
|
|
23519
|
+
shares,
|
|
23520
|
+
policyCatalog,
|
|
23521
|
+
inventory,
|
|
23522
|
+
inventoryAssets,
|
|
23523
|
+
projectFiles,
|
|
23524
|
+
activity,
|
|
23525
|
+
sourceProject,
|
|
23526
|
+
auditEvents,
|
|
23527
|
+
classifiedData,
|
|
23528
|
+
inspectionDefinitions,
|
|
23529
|
+
inspectionFindings,
|
|
23530
|
+
configInventory
|
|
23531
|
+
} = openAndInitialize(file2);
|
|
23484
23532
|
function recordCapture(event, detected) {
|
|
23485
23533
|
failOpenTransaction(db, () => {
|
|
23486
23534
|
const sessionId = event.metadata?.sessionId;
|
|
@@ -23685,8 +23733,9 @@ import { createHash as createHash3 } from "crypto";
|
|
|
23685
23733
|
|
|
23686
23734
|
// ../../packages/persistence/src/fingerprint.ts
|
|
23687
23735
|
import { createHmac, randomBytes } from "crypto";
|
|
23688
|
-
import { readFileSync } from "fs";
|
|
23736
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
23689
23737
|
import { join as join2 } from "path";
|
|
23738
|
+
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
23690
23739
|
var KEY_FILENAME = "exception.key";
|
|
23691
23740
|
var KEY_MATERIAL_BYTES = 32;
|
|
23692
23741
|
function keyFilePath(dataDir2) {
|
|
@@ -23780,13 +23829,13 @@ function readJson(file2) {
|
|
|
23780
23829
|
}
|
|
23781
23830
|
|
|
23782
23831
|
// ../../packages/persistence/src/warn-era-cap.ts
|
|
23783
|
-
import { existsSync as
|
|
23832
|
+
import { existsSync as existsSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
23784
23833
|
import { join as join5 } from "path";
|
|
23785
23834
|
var MARKER = "warn-era-capped";
|
|
23786
23835
|
function capWarnEraEnforcementOnce(db, policyMode, dataDir2) {
|
|
23787
23836
|
if (policyMode !== "warn") return { capped: 0, skipped: "not-warn" };
|
|
23788
23837
|
const marker = join5(dataDir2, MARKER);
|
|
23789
|
-
if (
|
|
23838
|
+
if (existsSync3(marker)) return { capped: 0, skipped: "already-run" };
|
|
23790
23839
|
const capped = db.policies.capCategoryActions();
|
|
23791
23840
|
writeFileSync2(marker, `${new Date(Date.now()).toISOString()}
|
|
23792
23841
|
`, { mode: DATA_FILE_MODE });
|
|
@@ -23794,7 +23843,7 @@ function capWarnEraEnforcementOnce(db, policyMode, dataDir2) {
|
|
|
23794
23843
|
}
|
|
23795
23844
|
|
|
23796
23845
|
// ../../packages/plugin-sdk/src/config.ts
|
|
23797
|
-
import { existsSync as
|
|
23846
|
+
import { existsSync as existsSync4 } from "fs";
|
|
23798
23847
|
import { join as join6 } from "path";
|
|
23799
23848
|
|
|
23800
23849
|
// ../../packages/plugin-sdk/src/provider-env.ts
|
|
@@ -23850,7 +23899,7 @@ function loadConfig(base = defaultDataDir()) {
|
|
|
23850
23899
|
try {
|
|
23851
23900
|
ensureLayoutDirSync(base);
|
|
23852
23901
|
const settingsFile = join6(settingsDir(base), "settings.json");
|
|
23853
|
-
if (
|
|
23902
|
+
if (existsSync4(settingsFile)) tightenFile(settingsFile);
|
|
23854
23903
|
} catch {
|
|
23855
23904
|
}
|
|
23856
23905
|
migrateLegacyLayout(base);
|
|
@@ -26611,7 +26660,7 @@ function bundledDetections() {
|
|
|
26611
26660
|
}
|
|
26612
26661
|
|
|
26613
26662
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
26614
|
-
import { existsSync as
|
|
26663
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3, statSync } from "fs";
|
|
26615
26664
|
import { basename, dirname, isAbsolute, join as join7, sep as sep2 } from "path";
|
|
26616
26665
|
|
|
26617
26666
|
// ../../packages/plugin-sdk/src/events.ts
|
|
@@ -26630,7 +26679,7 @@ import { basename as basename3, dirname as dirname2, sep as sep3 } from "path";
|
|
|
26630
26679
|
|
|
26631
26680
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
26632
26681
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
26633
|
-
import { existsSync as
|
|
26682
|
+
import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "fs";
|
|
26634
26683
|
import { basename as basename4, join as join10, relative, sep as sep4 } from "path";
|
|
26635
26684
|
|
|
26636
26685
|
// ../../packages/plugin-sdk/src/runtime.ts
|