@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/filescan.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 table2 of KEY_VERSION_TABLES) {
|
|
23752
|
+
try {
|
|
23753
|
+
const row = getRow(
|
|
23754
|
+
db.prepare(`SELECT MAX(key_version) AS v FROM ${table2}`)
|
|
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);
|
|
@@ -27711,7 +27803,7 @@ function bundledDetections() {
|
|
|
27711
27803
|
}
|
|
27712
27804
|
|
|
27713
27805
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
27714
|
-
import { existsSync as
|
|
27806
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3, statSync } from "fs";
|
|
27715
27807
|
import { basename, dirname, isAbsolute, join as join7, sep as sep2 } from "path";
|
|
27716
27808
|
function resolveRepoIdentity(cwd) {
|
|
27717
27809
|
try {
|
|
@@ -27741,7 +27833,7 @@ function resolveWorktreeRoot(cwd) {
|
|
|
27741
27833
|
function findGitRoot(start) {
|
|
27742
27834
|
let dir = start;
|
|
27743
27835
|
for (; ; ) {
|
|
27744
|
-
if (
|
|
27836
|
+
if (existsSync5(join7(dir, ".git"))) return dir;
|
|
27745
27837
|
const parent = dirname(dir);
|
|
27746
27838
|
if (parent === dir) return void 0;
|
|
27747
27839
|
dir = parent;
|
|
@@ -27759,7 +27851,7 @@ function resolveGitContext(root) {
|
|
|
27759
27851
|
const target = /^gitdir:\s*(.+?)\s*$/m.exec(safeRead(dotGit) ?? "")?.[1];
|
|
27760
27852
|
if (!target) return void 0;
|
|
27761
27853
|
const gitdir = isAbsolute(target) ? target : join7(root, target);
|
|
27762
|
-
if (
|
|
27854
|
+
if (existsSync5(join7(gitdir, "config"))) {
|
|
27763
27855
|
return { configPath: join7(gitdir, "config"), headRoot: root };
|
|
27764
27856
|
}
|
|
27765
27857
|
const commonRaw = safeRead(join7(gitdir, "commondir"))?.trim();
|
|
@@ -27873,7 +27965,7 @@ function resolveNonGitProject(startDir, recognizeMarker) {
|
|
|
27873
27965
|
|
|
27874
27966
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
27875
27967
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
27876
|
-
import { existsSync as
|
|
27968
|
+
import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "fs";
|
|
27877
27969
|
import { basename as basename4, join as join10, relative, sep as sep4 } from "path";
|
|
27878
27970
|
|
|
27879
27971
|
// ../../packages/plugin-sdk/src/rule-quarantine.ts
|
|
@@ -28377,7 +28469,7 @@ function renderMultiRepoSummary(summary, opts = {}) {
|
|
|
28377
28469
|
}
|
|
28378
28470
|
|
|
28379
28471
|
// ../../packages/scanner/src/scan.ts
|
|
28380
|
-
import { existsSync as
|
|
28472
|
+
import { existsSync as existsSync7, readFileSync as readFileSync8 } from "fs";
|
|
28381
28473
|
import { extname as extname2, isAbsolute as isAbsolute2, relative as relative4 } from "path";
|
|
28382
28474
|
|
|
28383
28475
|
// ../../packages/plugin-runtime/src/standalone-gateway.ts
|
|
@@ -28943,7 +29035,7 @@ function isUnderRoot(path, rootDir) {
|
|
|
28943
29035
|
async function sweepDeletedFiles(gateway, rootDir, previous) {
|
|
28944
29036
|
const deleted = [];
|
|
28945
29037
|
for (const path of previous.keys()) {
|
|
28946
|
-
if (!isUnderRoot(path, rootDir) ||
|
|
29038
|
+
if (!isUnderRoot(path, rootDir) || existsSync7(path)) continue;
|
|
28947
29039
|
deleted.push(path);
|
|
28948
29040
|
await resolveRemovedFindings(gateway, path, [], { deleted: true });
|
|
28949
29041
|
}
|
package/scripts/firstrun.js
CHANGED
|
@@ -23368,11 +23368,22 @@ function purgeSampleData(db) {
|
|
|
23368
23368
|
function linkHost(input, hostId) {
|
|
23369
23369
|
return hostId ? { ...input, hostId } : input;
|
|
23370
23370
|
}
|
|
23371
|
+
function closeQuietly(db) {
|
|
23372
|
+
try {
|
|
23373
|
+
db.close();
|
|
23374
|
+
} catch {
|
|
23375
|
+
}
|
|
23376
|
+
}
|
|
23371
23377
|
function openWithPragmas(file2) {
|
|
23372
23378
|
const db = new DatabaseSync(file2);
|
|
23373
|
-
|
|
23374
|
-
|
|
23375
|
-
|
|
23379
|
+
try {
|
|
23380
|
+
db.exec("PRAGMA journal_mode = WAL");
|
|
23381
|
+
db.exec("PRAGMA busy_timeout = 2000");
|
|
23382
|
+
db.exec("PRAGMA foreign_keys = ON");
|
|
23383
|
+
} catch (err) {
|
|
23384
|
+
closeQuietly(db);
|
|
23385
|
+
throw err;
|
|
23386
|
+
}
|
|
23376
23387
|
return db;
|
|
23377
23388
|
}
|
|
23378
23389
|
function backupLegacyStore(file2) {
|
|
@@ -23384,43 +23395,80 @@ function backupLegacyStore(file2) {
|
|
|
23384
23395
|
}
|
|
23385
23396
|
return backup;
|
|
23386
23397
|
}
|
|
23398
|
+
function openAndInitialize(file2) {
|
|
23399
|
+
let db = openWithPragmas(file2);
|
|
23400
|
+
try {
|
|
23401
|
+
if (isForeignSqliteLineage(db)) {
|
|
23402
|
+
db.close();
|
|
23403
|
+
const backup = backupLegacyStore(file2);
|
|
23404
|
+
db = openWithPragmas(file2);
|
|
23405
|
+
akaWarn(
|
|
23406
|
+
`Detected an older, incompatible (tenant-bearing) ${DB_FILENAME}; backed it up to ${backup} and created a fresh store.`
|
|
23407
|
+
);
|
|
23408
|
+
}
|
|
23409
|
+
applyMigrations(db, file2);
|
|
23410
|
+
tightenPerms(file2);
|
|
23411
|
+
const policies = new SqlitePoliciesRepository(db);
|
|
23412
|
+
const installedPacks = new SqliteInstalledPacksRepository(db);
|
|
23413
|
+
const repositories = {
|
|
23414
|
+
events: new SqliteEventsRepository(db),
|
|
23415
|
+
findings: new SqliteFindingsRepository(db),
|
|
23416
|
+
policies,
|
|
23417
|
+
installedPacks,
|
|
23418
|
+
scanLedger: new SqliteScanLedgerRepository(db),
|
|
23419
|
+
exceptions: new SqliteExceptionsRepository(db),
|
|
23420
|
+
resolutions: new SqliteResolutionsRepository(db),
|
|
23421
|
+
ruleProbeCache: new SqliteRuleProbeCacheRepository(db),
|
|
23422
|
+
security: new SqliteSecurityRepository(db),
|
|
23423
|
+
detections: new SqliteDetectionsRepository(db),
|
|
23424
|
+
shares: new SqliteSharesRepository(db),
|
|
23425
|
+
policyCatalog: new SqlitePolicyCatalogRepository(installedPacks),
|
|
23426
|
+
inventory: new SqliteInventoryRepository(db),
|
|
23427
|
+
inventoryAssets: new SqliteInventoryAssetsRepository(db),
|
|
23428
|
+
projectFiles: new SqliteProjectFilesRepository(db),
|
|
23429
|
+
activity: new SqliteActivityRepository(db),
|
|
23430
|
+
sourceProject: new SqliteSourceProjectRepository(db),
|
|
23431
|
+
auditEvents: new SqliteAuditEventsRepository(db),
|
|
23432
|
+
classifiedData: new SqliteClassifiedDataRepository(db),
|
|
23433
|
+
inspectionDefinitions: new SqliteInspectionDefinitionsRepository(db),
|
|
23434
|
+
inspectionFindings: new SqliteInspectionFindingsRepository(db),
|
|
23435
|
+
configInventory: new SqliteConfigInventoryRepository(db)
|
|
23436
|
+
};
|
|
23437
|
+
policies.seedDefaults();
|
|
23438
|
+
return { db, ...repositories };
|
|
23439
|
+
} catch (err) {
|
|
23440
|
+
closeQuietly(db);
|
|
23441
|
+
throw err;
|
|
23442
|
+
}
|
|
23443
|
+
}
|
|
23387
23444
|
function openLocalDatabase(dir) {
|
|
23388
23445
|
ensureDataDirSync(dir);
|
|
23389
23446
|
const file2 = join(dir, DB_FILENAME);
|
|
23390
|
-
|
|
23391
|
-
|
|
23392
|
-
|
|
23393
|
-
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
|
|
23397
|
-
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23401
|
-
|
|
23402
|
-
|
|
23403
|
-
|
|
23404
|
-
|
|
23405
|
-
|
|
23406
|
-
|
|
23407
|
-
|
|
23408
|
-
|
|
23409
|
-
|
|
23410
|
-
|
|
23411
|
-
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
const projectFiles = new SqliteProjectFilesRepository(db);
|
|
23416
|
-
const activity = new SqliteActivityRepository(db);
|
|
23417
|
-
const sourceProject = new SqliteSourceProjectRepository(db);
|
|
23418
|
-
const auditEvents = new SqliteAuditEventsRepository(db);
|
|
23419
|
-
const classifiedData = new SqliteClassifiedDataRepository(db);
|
|
23420
|
-
const inspectionDefinitions = new SqliteInspectionDefinitionsRepository(db);
|
|
23421
|
-
const inspectionFindings = new SqliteInspectionFindingsRepository(db);
|
|
23422
|
-
const configInventory = new SqliteConfigInventoryRepository(db);
|
|
23423
|
-
policies.seedDefaults();
|
|
23447
|
+
const {
|
|
23448
|
+
db,
|
|
23449
|
+
events,
|
|
23450
|
+
findings,
|
|
23451
|
+
policies,
|
|
23452
|
+
installedPacks,
|
|
23453
|
+
scanLedger,
|
|
23454
|
+
exceptions,
|
|
23455
|
+
resolutions,
|
|
23456
|
+
ruleProbeCache,
|
|
23457
|
+
security,
|
|
23458
|
+
detections,
|
|
23459
|
+
shares,
|
|
23460
|
+
policyCatalog,
|
|
23461
|
+
inventory,
|
|
23462
|
+
inventoryAssets,
|
|
23463
|
+
projectFiles,
|
|
23464
|
+
activity,
|
|
23465
|
+
sourceProject,
|
|
23466
|
+
auditEvents,
|
|
23467
|
+
classifiedData,
|
|
23468
|
+
inspectionDefinitions,
|
|
23469
|
+
inspectionFindings,
|
|
23470
|
+
configInventory
|
|
23471
|
+
} = openAndInitialize(file2);
|
|
23424
23472
|
function recordCapture(event, detected) {
|
|
23425
23473
|
failOpenTransaction(db, () => {
|
|
23426
23474
|
const sessionId = event.metadata?.sessionId;
|
|
@@ -23625,8 +23673,9 @@ import { createHash as createHash3 } from "crypto";
|
|
|
23625
23673
|
|
|
23626
23674
|
// ../../packages/persistence/src/fingerprint.ts
|
|
23627
23675
|
import { createHmac, randomBytes } from "crypto";
|
|
23628
|
-
import { readFileSync } from "fs";
|
|
23676
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
23629
23677
|
import { join as join2 } from "path";
|
|
23678
|
+
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
23630
23679
|
var KEY_FILENAME = "exception.key";
|
|
23631
23680
|
var KEY_MATERIAL_BYTES = 32;
|
|
23632
23681
|
function keyFilePath(dataDir2) {
|
|
@@ -23720,13 +23769,13 @@ function readJson(file2) {
|
|
|
23720
23769
|
}
|
|
23721
23770
|
|
|
23722
23771
|
// ../../packages/persistence/src/warn-era-cap.ts
|
|
23723
|
-
import { existsSync as
|
|
23772
|
+
import { existsSync as existsSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
23724
23773
|
import { join as join5 } from "path";
|
|
23725
23774
|
var MARKER = "warn-era-capped";
|
|
23726
23775
|
function capWarnEraEnforcementOnce(db, policyMode, dataDir2) {
|
|
23727
23776
|
if (policyMode !== "warn") return { capped: 0, skipped: "not-warn" };
|
|
23728
23777
|
const marker = join5(dataDir2, MARKER);
|
|
23729
|
-
if (
|
|
23778
|
+
if (existsSync3(marker)) return { capped: 0, skipped: "already-run" };
|
|
23730
23779
|
const capped = db.policies.capCategoryActions();
|
|
23731
23780
|
writeFileSync2(marker, `${new Date(Date.now()).toISOString()}
|
|
23732
23781
|
`, { mode: DATA_FILE_MODE });
|
|
@@ -23734,7 +23783,7 @@ function capWarnEraEnforcementOnce(db, policyMode, dataDir2) {
|
|
|
23734
23783
|
}
|
|
23735
23784
|
|
|
23736
23785
|
// ../../packages/plugin-sdk/src/config.ts
|
|
23737
|
-
import { existsSync as
|
|
23786
|
+
import { existsSync as existsSync4 } from "fs";
|
|
23738
23787
|
import { join as join6 } from "path";
|
|
23739
23788
|
|
|
23740
23789
|
// ../../packages/plugin-sdk/src/provider-env.ts
|
|
@@ -23790,7 +23839,7 @@ function loadConfig(base = defaultDataDir()) {
|
|
|
23790
23839
|
try {
|
|
23791
23840
|
ensureLayoutDirSync(base);
|
|
23792
23841
|
const settingsFile = join6(settingsDir(base), "settings.json");
|
|
23793
|
-
if (
|
|
23842
|
+
if (existsSync4(settingsFile)) tightenFile(settingsFile);
|
|
23794
23843
|
} catch {
|
|
23795
23844
|
}
|
|
23796
23845
|
migrateLegacyLayout(base);
|
|
@@ -26551,7 +26600,7 @@ function bundledDetections() {
|
|
|
26551
26600
|
}
|
|
26552
26601
|
|
|
26553
26602
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
26554
|
-
import { existsSync as
|
|
26603
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3, statSync } from "fs";
|
|
26555
26604
|
import { basename, dirname, isAbsolute, join as join7, sep as sep2 } from "path";
|
|
26556
26605
|
|
|
26557
26606
|
// ../../packages/plugin-sdk/src/events.ts
|
|
@@ -26570,7 +26619,7 @@ import { basename as basename3, dirname as dirname2, sep as sep3 } from "path";
|
|
|
26570
26619
|
|
|
26571
26620
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
26572
26621
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
26573
|
-
import { existsSync as
|
|
26622
|
+
import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "fs";
|
|
26574
26623
|
import { basename as basename4, join as join10, relative, sep as sep4 } from "path";
|
|
26575
26624
|
|
|
26576
26625
|
// ../../packages/plugin-sdk/src/runtime.ts
|
package/scripts/intro.js
CHANGED
|
@@ -17205,7 +17205,7 @@ import { execFileSync } from "child_process";
|
|
|
17205
17205
|
var USE_SHELL = process.platform === "win32";
|
|
17206
17206
|
|
|
17207
17207
|
// ../../packages/plugin-sdk/src/config.ts
|
|
17208
|
-
import { existsSync as
|
|
17208
|
+
import { existsSync as existsSync4 } from "fs";
|
|
17209
17209
|
import { join as join6 } from "path";
|
|
17210
17210
|
|
|
17211
17211
|
// ../../packages/persistence/src/database.ts
|
|
@@ -17253,8 +17253,9 @@ import { createHash as createHash3 } from "crypto";
|
|
|
17253
17253
|
|
|
17254
17254
|
// ../../packages/persistence/src/fingerprint.ts
|
|
17255
17255
|
import { createHmac, randomBytes } from "crypto";
|
|
17256
|
-
import { readFileSync } from "fs";
|
|
17256
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
17257
17257
|
import { join as join2 } from "path";
|
|
17258
|
+
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
17258
17259
|
|
|
17259
17260
|
// ../../packages/persistence/src/local-layout.ts
|
|
17260
17261
|
import { renameSync as renameSync3 } from "fs";
|
|
@@ -17267,7 +17268,7 @@ import { readFileSync as readFileSync2 } from "fs";
|
|
|
17267
17268
|
import { join as join4 } from "path";
|
|
17268
17269
|
|
|
17269
17270
|
// ../../packages/persistence/src/warn-era-cap.ts
|
|
17270
|
-
import { existsSync as
|
|
17271
|
+
import { existsSync as existsSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
17271
17272
|
import { join as join5 } from "path";
|
|
17272
17273
|
|
|
17273
17274
|
// ../../packages/plugin-sdk/src/provider-env.ts
|
|
@@ -18002,7 +18003,7 @@ var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].m
|
|
|
18002
18003
|
);
|
|
18003
18004
|
|
|
18004
18005
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
18005
|
-
import { existsSync as
|
|
18006
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3, statSync } from "fs";
|
|
18006
18007
|
import { basename, dirname, isAbsolute, join as join7, sep as sep2 } from "path";
|
|
18007
18008
|
|
|
18008
18009
|
// ../../packages/plugin-sdk/src/events.ts
|
|
@@ -18021,7 +18022,7 @@ import { basename as basename3, dirname as dirname2, sep as sep3 } from "path";
|
|
|
18021
18022
|
|
|
18022
18023
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18023
18024
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
18024
|
-
import { existsSync as
|
|
18025
|
+
import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "fs";
|
|
18025
18026
|
import { basename as basename4, join as join10, relative, sep as sep4 } from "path";
|
|
18026
18027
|
|
|
18027
18028
|
// ../../packages/plugin-sdk/src/runtime.ts
|