@code-sentinel-cli/code-sentinel-cli 4.0.12 → 4.0.13-avtest.1
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/dist/bin.js +77 -100
- package/dist/index.d.ts +10 -4
- package/dist/index.js +77 -100
- package/package.json +3 -2
package/dist/bin.js
CHANGED
|
@@ -54482,7 +54482,7 @@ var init_libsql = __esm({
|
|
|
54482
54482
|
init_session2();
|
|
54483
54483
|
}
|
|
54484
54484
|
});
|
|
54485
|
-
var __defProp2, __export2, schema_exports, reviewRuns, findings, buildCacheTable, aiCache, ruleCache, parseCache, astGraphNodes, astGraphEdges, astGraphMeta, SQLITE_BUSY_TIMEOUT_MS, isInMemory, toLibsqlUrl, createDb, DEFAULT_RETRY_DELAYS_MS, isSqliteBusyError, wait, withSqliteBusyRetry, hereDir, defaultMigrationsDir, ensureTrackingTable, listMigrations, alreadyApplied, runMigrations, RULE_EXECUTION_SKIP_REASONS, decodeSkipReasons, encodeSkipReasons, decodeRetryBacklog, decodeRetryIds, parseAiStatsJson, parseRuleResultsJson, parseFixJson, parseFindingMetadataJson, serializeAiStats, serializeRuleResults, serializeFix, serializeFindingMetadata, rowToSummary, rowToFinding, findingFingerprint, runUpsertStatement, findingInsertStatement, createReviewStore, TABLE_BY_NAMESPACE, purgeExpired, createSqliteCacheStore, AST_GRAPH_SCHEMA_VERSION, KNOWN_EDGE_KINDS, parseSymbols, rowToNode, rowToEdge, stringOrNull, createAstGraphStore, clearAstGraphForProject, migration0001, migration0002, migration0003, migration0004, migration0005, migration0006, migration0007, migration0008, migration0009, migration0010, migration0011, migration0012, migration0013, migration0014, migration0015, migration0016, migration0017, migration0018, migration0019, migration0020, migration0021, migration0022, migration0023, migration0024, migration0025, migration0026, migration0027, migration0028, migration0029, migration0030, migration0031, migration0032, migration0033, migration0034, migration0035, migration0036, migration0037, migration0038, migration0039, migration0040, migration0041, migration0042, migration0043, migration0044, migration0045, migration0046, migration0047, mutableRequestStatusPredicate, migration0048, migration0049, previousDefaultAndRetiredModels, mutableRequestPredicate, updatedAt, migration0050, migration0051, migration0052, migration0053, migration0054, migration0055, migration0056, migration0057, migration0058, migration0059, migration0060, migration0061, migration0062, migration0063, migration0064, migration0065, migration0066, migration0067, MARIADB_MIGRATIONS;
|
|
54485
|
+
var __defProp2, __export2, schema_exports, reviewRuns, findings, buildCacheTable, aiCache, ruleCache, parseCache, astGraphNodes, astGraphEdges, astGraphMeta, SQLITE_BUSY_TIMEOUT_MS, isInMemory, toLibsqlUrl, createDb, DEFAULT_RETRY_DELAYS_MS, isSqliteBusyError, wait, withSqliteBusyRetry, hereDir, defaultMigrationsDir, ensureTrackingTable, listMigrations, alreadyApplied, runMigrations, RULE_EXECUTION_SKIP_REASONS, decodeSkipReasons, encodeSkipReasons, decodeRetryBacklog, decodeRetryIds, parseAiStatsJson, parseRuleResultsJson, parseFixJson, parseFindingMetadataJson, serializeAiStats, serializeRuleResults, serializeFix, serializeFindingMetadata, rowToSummary, rowToFinding, findingFingerprint, runUpsertStatement, findingInsertStatement, createReviewStore, TABLE_BY_NAMESPACE, purgeExpired, createSqliteCacheStore, AST_GRAPH_SCHEMA_VERSION, KNOWN_EDGE_KINDS, parseSymbols, rowToNode, rowToEdge, stringOrNull, createAstGraphStore, clearAstGraphForProject, migration0001, migration0002, migration0003, migration0004, migration0005, migration0006, migration0007, migration0008, migration0009, migration0010, migration0011, migration0012, migration0013, migration0014, migration0015, migration0016, migration0017, migration0018, migration0019, migration0020, migration0021, migration0022, migration0023, migration0024, migration0025, migration0026, migration0027, migration0028, migration0029, migration0030, migration0031, migration0032, migration0033, migration0034, migration0035, migration0036, migration0037, migration0038, migration0039, migration0040, migration0041, migration0042, migration0043, migration0044, migration0045, migration0046, migration0047, mutableRequestStatusPredicate, migration0048, migration0049, previousDefaultAndRetiredModels, mutableRequestPredicate, updatedAt, migration0050, migration0051, migration0052, migration0053, migration0054, migration0055, migration0056, migration0057, migration0058, migration0059, migration0060, migration0061, migration0062, migration0063, migration0064, migration0065, migration0066, migration0067, migration0068, MARIADB_MIGRATIONS;
|
|
54486
54486
|
var init_dist9 = __esm({
|
|
54487
54487
|
"../storage/dist/index.js"() {
|
|
54488
54488
|
init_libsql();
|
|
@@ -57961,6 +57961,64 @@ var init_dist9 = __esm({
|
|
|
57961
57961
|
ADD COLUMN IF NOT EXISTS provisioning_generation INT NOT NULL DEFAULT 0`
|
|
57962
57962
|
]
|
|
57963
57963
|
};
|
|
57964
|
+
migration0068 = {
|
|
57965
|
+
version: 68,
|
|
57966
|
+
name: "sandbox-investigations",
|
|
57967
|
+
statements: [
|
|
57968
|
+
`CREATE TABLE IF NOT EXISTS pentest_sandbox_investigations (
|
|
57969
|
+
id VARCHAR(64) PRIMARY KEY,
|
|
57970
|
+
project_id VARCHAR(255) NOT NULL,
|
|
57971
|
+
request_id VARCHAR(255) NOT NULL,
|
|
57972
|
+
assessment_id VARCHAR(255) NULL,
|
|
57973
|
+
scenario_id VARCHAR(128) NOT NULL,
|
|
57974
|
+
variant_id VARCHAR(128) NOT NULL,
|
|
57975
|
+
sandbox_id VARCHAR(64) NOT NULL,
|
|
57976
|
+
runtime_generation INT NOT NULL DEFAULT 1,
|
|
57977
|
+
recipe_version INT NOT NULL DEFAULT 1,
|
|
57978
|
+
created_by_user_id VARCHAR(384) NULL,
|
|
57979
|
+
created_at BIGINT NOT NULL,
|
|
57980
|
+
updated_at BIGINT NOT NULL,
|
|
57981
|
+
FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
|
|
57982
|
+
FOREIGN KEY (created_by_user_id) REFERENCES dashboard_users(id) ON DELETE SET NULL,
|
|
57983
|
+
INDEX idx_investigations_req_scen (request_id, scenario_id),
|
|
57984
|
+
INDEX idx_investigations_sandbox (sandbox_id)
|
|
57985
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`,
|
|
57986
|
+
`CREATE TABLE IF NOT EXISTS pentest_sandbox_attempts (
|
|
57987
|
+
id VARCHAR(64) PRIMARY KEY,
|
|
57988
|
+
investigation_id VARCHAR(64) NOT NULL,
|
|
57989
|
+
runtime_generation INT NOT NULL DEFAULT 1,
|
|
57990
|
+
plan_version INT NOT NULL DEFAULT 1,
|
|
57991
|
+
fixture_version INT NOT NULL DEFAULT 1,
|
|
57992
|
+
state VARCHAR(32) NOT NULL DEFAULT 'draft',
|
|
57993
|
+
outcome VARCHAR(32) NULL,
|
|
57994
|
+
steps_json MEDIUMTEXT NOT NULL,
|
|
57995
|
+
precondition_checks_json TEXT NOT NULL,
|
|
57996
|
+
principal_labels_json TEXT NOT NULL,
|
|
57997
|
+
evidence_refs_json TEXT NOT NULL,
|
|
57998
|
+
coverage_gaps_json TEXT NOT NULL,
|
|
57999
|
+
explanation_json MEDIUMTEXT NULL,
|
|
58000
|
+
started_at BIGINT NOT NULL,
|
|
58001
|
+
finished_at BIGINT NULL,
|
|
58002
|
+
created_at BIGINT NOT NULL,
|
|
58003
|
+
updated_at BIGINT NOT NULL,
|
|
58004
|
+
FOREIGN KEY (investigation_id) REFERENCES pentest_sandbox_investigations(id) ON DELETE CASCADE,
|
|
58005
|
+
INDEX idx_attempts_investigation (investigation_id, state)
|
|
58006
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`,
|
|
58007
|
+
`CREATE TABLE IF NOT EXISTS pentest_sandbox_evidence (
|
|
58008
|
+
id VARCHAR(64) PRIMARY KEY,
|
|
58009
|
+
attempt_id VARCHAR(64) NOT NULL,
|
|
58010
|
+
step_id VARCHAR(64) NULL,
|
|
58011
|
+
source VARCHAR(128) NOT NULL,
|
|
58012
|
+
checksum VARCHAR(64) NOT NULL,
|
|
58013
|
+
type VARCHAR(32) NOT NULL,
|
|
58014
|
+
safe_content_json MEDIUMTEXT NOT NULL,
|
|
58015
|
+
retention_expires_at BIGINT NOT NULL,
|
|
58016
|
+
created_at BIGINT NOT NULL,
|
|
58017
|
+
FOREIGN KEY (attempt_id) REFERENCES pentest_sandbox_attempts(id) ON DELETE CASCADE,
|
|
58018
|
+
INDEX idx_evidence_attempt (attempt_id)
|
|
58019
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`
|
|
58020
|
+
]
|
|
58021
|
+
};
|
|
57964
58022
|
MARIADB_MIGRATIONS = [
|
|
57965
58023
|
migration0001,
|
|
57966
58024
|
migration0002,
|
|
@@ -58028,7 +58086,8 @@ var init_dist9 = __esm({
|
|
|
58028
58086
|
migration0064,
|
|
58029
58087
|
migration0065,
|
|
58030
58088
|
migration0066,
|
|
58031
|
-
migration0067
|
|
58089
|
+
migration0067,
|
|
58090
|
+
migration0068
|
|
58032
58091
|
];
|
|
58033
58092
|
MARIADB_MIGRATIONS[MARIADB_MIGRATIONS.length - 1]?.version ?? 0;
|
|
58034
58093
|
}
|
|
@@ -60062,11 +60121,11 @@ var definedBuildValue = (value, fallback) => typeof value === "string" && value.
|
|
|
60062
60121
|
var getCliBuildMetadata = (version2) => ({
|
|
60063
60122
|
version: version2,
|
|
60064
60123
|
gitSha: definedBuildValue(
|
|
60065
|
-
"
|
|
60124
|
+
"f60caa7079ae" ,
|
|
60066
60125
|
"unknown"
|
|
60067
60126
|
),
|
|
60068
60127
|
buildTimestamp: definedBuildValue(
|
|
60069
|
-
"2026-10-
|
|
60128
|
+
"2026-10-08T09:39:44.167Z" ,
|
|
60070
60129
|
"unknown"
|
|
60071
60130
|
),
|
|
60072
60131
|
configSchemaRange: definedBuildValue(
|
|
@@ -61469,109 +61528,27 @@ var LinuxSecretServiceStore = class {
|
|
|
61469
61528
|
}
|
|
61470
61529
|
}
|
|
61471
61530
|
};
|
|
61472
|
-
var
|
|
61473
|
-
|
|
61474
|
-
|
|
61475
|
-
|
|
61476
|
-
using System;
|
|
61477
|
-
using System.Runtime.InteropServices;
|
|
61478
|
-
public static class CodeSentinelCredentialNative {
|
|
61479
|
-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
|
61480
|
-
public struct CREDENTIAL {
|
|
61481
|
-
public UInt32 Flags; public UInt32 Type; public IntPtr TargetName; public IntPtr Comment;
|
|
61482
|
-
public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten;
|
|
61483
|
-
public UInt32 CredentialBlobSize; public IntPtr CredentialBlob; public Int32 Persist; public UInt32 AttributeCount;
|
|
61484
|
-
public IntPtr Attributes; public IntPtr TargetAlias; public IntPtr UserName;
|
|
61485
|
-
}
|
|
61486
|
-
[DllImport("Advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
61487
|
-
public static extern bool CredRead(string target, UInt32 type, UInt32 flags, out IntPtr credentialPtr);
|
|
61488
|
-
[DllImport("Advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
61489
|
-
public static extern bool CredWrite([In] ref CREDENTIAL credential, UInt32 flags);
|
|
61490
|
-
[DllImport("Advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
61491
|
-
public static extern bool CredDelete(string target, UInt32 type, UInt32 flags);
|
|
61492
|
-
[DllImport("Advapi32.dll", SetLastError = true)]
|
|
61493
|
-
public static extern void CredFree(IntPtr credential);
|
|
61494
|
-
}
|
|
61495
|
-
'@
|
|
61496
|
-
Add-Type -TypeDefinition $native
|
|
61497
|
-
`;
|
|
61498
|
-
var encodedPowerShell = (script) => Buffer.from(script, "utf16le").toString("base64");
|
|
61499
|
-
var powerShellTarget = (service, account) => `${service}:${account}`;
|
|
61531
|
+
var nativeWindowsEntry = async (service, account) => {
|
|
61532
|
+
const { AsyncEntry } = await import('@napi-rs/keyring');
|
|
61533
|
+
return new AsyncEntry(service, account);
|
|
61534
|
+
};
|
|
61500
61535
|
var WindowsCredentialManagerStore = class {
|
|
61501
|
-
constructor(
|
|
61502
|
-
this.
|
|
61503
|
-
}
|
|
61504
|
-
commands;
|
|
61505
|
-
run(target, body, input4) {
|
|
61506
|
-
return this.commands.run(
|
|
61507
|
-
"powershell.exe",
|
|
61508
|
-
[
|
|
61509
|
-
"-NoProfile",
|
|
61510
|
-
"-NonInteractive",
|
|
61511
|
-
"-EncodedCommand",
|
|
61512
|
-
encodedPowerShell(powershellPrelude(target) + body)
|
|
61513
|
-
],
|
|
61514
|
-
input4
|
|
61515
|
-
);
|
|
61536
|
+
constructor(entry = nativeWindowsEntry) {
|
|
61537
|
+
this.entry = entry;
|
|
61516
61538
|
}
|
|
61539
|
+
entry;
|
|
61517
61540
|
async read(service, account) {
|
|
61518
|
-
const
|
|
61519
|
-
|
|
61520
|
-
`
|
|
61521
|
-
$credentialPtr = [IntPtr]::Zero
|
|
61522
|
-
if (-not [CodeSentinelCredentialNative]::CredRead($target, 1, 0, [ref] $credentialPtr)) {
|
|
61523
|
-
if ([Runtime.InteropServices.Marshal]::GetLastWin32Error() -eq 1168) { exit 0 }
|
|
61524
|
-
throw "Credential Manager read failed: $([Runtime.InteropServices.Marshal]::GetLastWin32Error())"
|
|
61525
|
-
}
|
|
61526
|
-
try {
|
|
61527
|
-
$credential = [Runtime.InteropServices.Marshal]::PtrToStructure($credentialPtr, [type][CodeSentinelCredentialNative+CREDENTIAL])
|
|
61528
|
-
$bytes = New-Object byte[] $credential.CredentialBlobSize
|
|
61529
|
-
[Runtime.InteropServices.Marshal]::Copy($credential.CredentialBlob, $bytes, 0, $bytes.Length)
|
|
61530
|
-
[Console]::Out.WriteLine("___CS_CLI_B64_START___$([Convert]::ToBase64String($bytes))___CS_CLI_B64_END___")
|
|
61531
|
-
} finally { [CodeSentinelCredentialNative]::CredFree($credentialPtr) }
|
|
61532
|
-
`
|
|
61533
|
-
);
|
|
61534
|
-
const match = output2.match(/___CS_CLI_B64_START___(.*?)___CS_CLI_B64_END___/);
|
|
61535
|
-
if (match?.[1]) return Buffer.from(match[1], "base64").toString("utf8");
|
|
61536
|
-
return null;
|
|
61541
|
+
const bytes = await (await this.entry(service, account)).getSecret();
|
|
61542
|
+
return bytes === void 0 ? null : Buffer.from(bytes).toString("utf8");
|
|
61537
61543
|
}
|
|
61538
61544
|
async write(service, account, value) {
|
|
61539
|
-
await this.
|
|
61540
|
-
|
|
61541
|
-
|
|
61542
|
-
|
|
61543
|
-
$credential = New-Object CodeSentinelCredentialNative+CREDENTIAL
|
|
61544
|
-
$credential.Type = 1
|
|
61545
|
-
$credential.TargetName = [Runtime.InteropServices.Marshal]::StringToCoTaskMemUni($target)
|
|
61546
|
-
$credential.UserName = [Runtime.InteropServices.Marshal]::StringToCoTaskMemUni('Code Sentinel CLI')
|
|
61547
|
-
$credential.CredentialBlobSize = $bytes.Length
|
|
61548
|
-
$credential.Persist = 2
|
|
61549
|
-
$credential.CredentialBlob = [Runtime.InteropServices.Marshal]::AllocCoTaskMem($bytes.Length)
|
|
61550
|
-
try {
|
|
61551
|
-
[Runtime.InteropServices.Marshal]::Copy($bytes, 0, $credential.CredentialBlob, $bytes.Length)
|
|
61552
|
-
if (-not [CodeSentinelCredentialNative]::CredWrite([ref] $credential, 0)) {
|
|
61553
|
-
throw "Credential Manager write failed: $([Runtime.InteropServices.Marshal]::GetLastWin32Error())"
|
|
61554
|
-
}
|
|
61555
|
-
} finally {
|
|
61556
|
-
[Runtime.InteropServices.Marshal]::FreeCoTaskMem($credential.TargetName)
|
|
61557
|
-
[Runtime.InteropServices.Marshal]::FreeCoTaskMem($credential.UserName)
|
|
61558
|
-
[Runtime.InteropServices.Marshal]::FreeCoTaskMem($credential.CredentialBlob)
|
|
61559
|
-
}
|
|
61560
|
-
`,
|
|
61561
|
-
Buffer.from(value, "utf8").toString("base64")
|
|
61562
|
-
);
|
|
61545
|
+
await (await this.entry(service, account)).setSecret(Buffer.from(value, "utf8"));
|
|
61546
|
+
if (await this.read(service, account) !== value) {
|
|
61547
|
+
throw new Error("Windows Credential Manager did not persist the credential.");
|
|
61548
|
+
}
|
|
61563
61549
|
}
|
|
61564
61550
|
async remove(service, account) {
|
|
61565
|
-
await this.
|
|
61566
|
-
powerShellTarget(service, account),
|
|
61567
|
-
`
|
|
61568
|
-
if (-not [CodeSentinelCredentialNative]::CredDelete($target, 1, 0)) {
|
|
61569
|
-
if ([Runtime.InteropServices.Marshal]::GetLastWin32Error() -ne 1168) {
|
|
61570
|
-
throw "Credential Manager delete failed: $([Runtime.InteropServices.Marshal]::GetLastWin32Error())"
|
|
61571
|
-
}
|
|
61572
|
-
}
|
|
61573
|
-
`
|
|
61574
|
-
);
|
|
61551
|
+
await (await this.entry(service, account)).deleteCredential();
|
|
61575
61552
|
}
|
|
61576
61553
|
};
|
|
61577
61554
|
var createPlatformSecretStore = (platform = process.platform) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -143,11 +143,17 @@ declare class LinuxSecretServiceStore implements ISecretStore {
|
|
|
143
143
|
write(service: string, account: string, value: string): Promise<void>;
|
|
144
144
|
remove(service: string, account: string): Promise<void>;
|
|
145
145
|
}
|
|
146
|
-
/**
|
|
146
|
+
/** Byte-oriented API preserves the UTF-8 blobs written by earlier CLI releases. */
|
|
147
|
+
interface WindowsSecretEntry {
|
|
148
|
+
getSecret(): Promise<Uint8Array | undefined>;
|
|
149
|
+
setSecret(secret: Uint8Array): Promise<void>;
|
|
150
|
+
deleteCredential(): Promise<boolean>;
|
|
151
|
+
}
|
|
152
|
+
type WindowsSecretEntryFactory = (service: string, account: string) => Promise<WindowsSecretEntry>;
|
|
153
|
+
/** Calls Windows Credential Manager directly through a prebuilt Node-API binding. */
|
|
147
154
|
declare class WindowsCredentialManagerStore implements ISecretStore {
|
|
148
|
-
private readonly
|
|
149
|
-
constructor(
|
|
150
|
-
private run;
|
|
155
|
+
private readonly entry;
|
|
156
|
+
constructor(entry?: WindowsSecretEntryFactory);
|
|
151
157
|
read(service: string, account: string): Promise<string | null>;
|
|
152
158
|
write(service: string, account: string, value: string): Promise<void>;
|
|
153
159
|
remove(service: string, account: string): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -54482,7 +54482,7 @@ var init_libsql = __esm({
|
|
|
54482
54482
|
init_session2();
|
|
54483
54483
|
}
|
|
54484
54484
|
});
|
|
54485
|
-
var __defProp2, __export2, schema_exports, reviewRuns, findings, buildCacheTable, aiCache, ruleCache, parseCache, astGraphNodes, astGraphEdges, astGraphMeta, SQLITE_BUSY_TIMEOUT_MS, isInMemory, toLibsqlUrl, createDb, DEFAULT_RETRY_DELAYS_MS, isSqliteBusyError, wait, withSqliteBusyRetry, hereDir, defaultMigrationsDir, ensureTrackingTable, listMigrations, alreadyApplied, runMigrations, RULE_EXECUTION_SKIP_REASONS, decodeSkipReasons, encodeSkipReasons, decodeRetryBacklog, decodeRetryIds, parseAiStatsJson, parseRuleResultsJson, parseFixJson, parseFindingMetadataJson, serializeAiStats, serializeRuleResults, serializeFix, serializeFindingMetadata, rowToSummary, rowToFinding, findingFingerprint, runUpsertStatement, findingInsertStatement, createReviewStore, TABLE_BY_NAMESPACE, purgeExpired, createSqliteCacheStore, AST_GRAPH_SCHEMA_VERSION, KNOWN_EDGE_KINDS, parseSymbols, rowToNode, rowToEdge, stringOrNull, createAstGraphStore, clearAstGraphForProject, migration0001, migration0002, migration0003, migration0004, migration0005, migration0006, migration0007, migration0008, migration0009, migration0010, migration0011, migration0012, migration0013, migration0014, migration0015, migration0016, migration0017, migration0018, migration0019, migration0020, migration0021, migration0022, migration0023, migration0024, migration0025, migration0026, migration0027, migration0028, migration0029, migration0030, migration0031, migration0032, migration0033, migration0034, migration0035, migration0036, migration0037, migration0038, migration0039, migration0040, migration0041, migration0042, migration0043, migration0044, migration0045, migration0046, migration0047, mutableRequestStatusPredicate, migration0048, migration0049, previousDefaultAndRetiredModels, mutableRequestPredicate, updatedAt, migration0050, migration0051, migration0052, migration0053, migration0054, migration0055, migration0056, migration0057, migration0058, migration0059, migration0060, migration0061, migration0062, migration0063, migration0064, migration0065, migration0066, migration0067, MARIADB_MIGRATIONS;
|
|
54485
|
+
var __defProp2, __export2, schema_exports, reviewRuns, findings, buildCacheTable, aiCache, ruleCache, parseCache, astGraphNodes, astGraphEdges, astGraphMeta, SQLITE_BUSY_TIMEOUT_MS, isInMemory, toLibsqlUrl, createDb, DEFAULT_RETRY_DELAYS_MS, isSqliteBusyError, wait, withSqliteBusyRetry, hereDir, defaultMigrationsDir, ensureTrackingTable, listMigrations, alreadyApplied, runMigrations, RULE_EXECUTION_SKIP_REASONS, decodeSkipReasons, encodeSkipReasons, decodeRetryBacklog, decodeRetryIds, parseAiStatsJson, parseRuleResultsJson, parseFixJson, parseFindingMetadataJson, serializeAiStats, serializeRuleResults, serializeFix, serializeFindingMetadata, rowToSummary, rowToFinding, findingFingerprint, runUpsertStatement, findingInsertStatement, createReviewStore, TABLE_BY_NAMESPACE, purgeExpired, createSqliteCacheStore, AST_GRAPH_SCHEMA_VERSION, KNOWN_EDGE_KINDS, parseSymbols, rowToNode, rowToEdge, stringOrNull, createAstGraphStore, clearAstGraphForProject, migration0001, migration0002, migration0003, migration0004, migration0005, migration0006, migration0007, migration0008, migration0009, migration0010, migration0011, migration0012, migration0013, migration0014, migration0015, migration0016, migration0017, migration0018, migration0019, migration0020, migration0021, migration0022, migration0023, migration0024, migration0025, migration0026, migration0027, migration0028, migration0029, migration0030, migration0031, migration0032, migration0033, migration0034, migration0035, migration0036, migration0037, migration0038, migration0039, migration0040, migration0041, migration0042, migration0043, migration0044, migration0045, migration0046, migration0047, mutableRequestStatusPredicate, migration0048, migration0049, previousDefaultAndRetiredModels, mutableRequestPredicate, updatedAt, migration0050, migration0051, migration0052, migration0053, migration0054, migration0055, migration0056, migration0057, migration0058, migration0059, migration0060, migration0061, migration0062, migration0063, migration0064, migration0065, migration0066, migration0067, migration0068, MARIADB_MIGRATIONS;
|
|
54486
54486
|
var init_dist9 = __esm({
|
|
54487
54487
|
"../storage/dist/index.js"() {
|
|
54488
54488
|
init_libsql();
|
|
@@ -57961,6 +57961,64 @@ var init_dist9 = __esm({
|
|
|
57961
57961
|
ADD COLUMN IF NOT EXISTS provisioning_generation INT NOT NULL DEFAULT 0`
|
|
57962
57962
|
]
|
|
57963
57963
|
};
|
|
57964
|
+
migration0068 = {
|
|
57965
|
+
version: 68,
|
|
57966
|
+
name: "sandbox-investigations",
|
|
57967
|
+
statements: [
|
|
57968
|
+
`CREATE TABLE IF NOT EXISTS pentest_sandbox_investigations (
|
|
57969
|
+
id VARCHAR(64) PRIMARY KEY,
|
|
57970
|
+
project_id VARCHAR(255) NOT NULL,
|
|
57971
|
+
request_id VARCHAR(255) NOT NULL,
|
|
57972
|
+
assessment_id VARCHAR(255) NULL,
|
|
57973
|
+
scenario_id VARCHAR(128) NOT NULL,
|
|
57974
|
+
variant_id VARCHAR(128) NOT NULL,
|
|
57975
|
+
sandbox_id VARCHAR(64) NOT NULL,
|
|
57976
|
+
runtime_generation INT NOT NULL DEFAULT 1,
|
|
57977
|
+
recipe_version INT NOT NULL DEFAULT 1,
|
|
57978
|
+
created_by_user_id VARCHAR(384) NULL,
|
|
57979
|
+
created_at BIGINT NOT NULL,
|
|
57980
|
+
updated_at BIGINT NOT NULL,
|
|
57981
|
+
FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
|
|
57982
|
+
FOREIGN KEY (created_by_user_id) REFERENCES dashboard_users(id) ON DELETE SET NULL,
|
|
57983
|
+
INDEX idx_investigations_req_scen (request_id, scenario_id),
|
|
57984
|
+
INDEX idx_investigations_sandbox (sandbox_id)
|
|
57985
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`,
|
|
57986
|
+
`CREATE TABLE IF NOT EXISTS pentest_sandbox_attempts (
|
|
57987
|
+
id VARCHAR(64) PRIMARY KEY,
|
|
57988
|
+
investigation_id VARCHAR(64) NOT NULL,
|
|
57989
|
+
runtime_generation INT NOT NULL DEFAULT 1,
|
|
57990
|
+
plan_version INT NOT NULL DEFAULT 1,
|
|
57991
|
+
fixture_version INT NOT NULL DEFAULT 1,
|
|
57992
|
+
state VARCHAR(32) NOT NULL DEFAULT 'draft',
|
|
57993
|
+
outcome VARCHAR(32) NULL,
|
|
57994
|
+
steps_json MEDIUMTEXT NOT NULL,
|
|
57995
|
+
precondition_checks_json TEXT NOT NULL,
|
|
57996
|
+
principal_labels_json TEXT NOT NULL,
|
|
57997
|
+
evidence_refs_json TEXT NOT NULL,
|
|
57998
|
+
coverage_gaps_json TEXT NOT NULL,
|
|
57999
|
+
explanation_json MEDIUMTEXT NULL,
|
|
58000
|
+
started_at BIGINT NOT NULL,
|
|
58001
|
+
finished_at BIGINT NULL,
|
|
58002
|
+
created_at BIGINT NOT NULL,
|
|
58003
|
+
updated_at BIGINT NOT NULL,
|
|
58004
|
+
FOREIGN KEY (investigation_id) REFERENCES pentest_sandbox_investigations(id) ON DELETE CASCADE,
|
|
58005
|
+
INDEX idx_attempts_investigation (investigation_id, state)
|
|
58006
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`,
|
|
58007
|
+
`CREATE TABLE IF NOT EXISTS pentest_sandbox_evidence (
|
|
58008
|
+
id VARCHAR(64) PRIMARY KEY,
|
|
58009
|
+
attempt_id VARCHAR(64) NOT NULL,
|
|
58010
|
+
step_id VARCHAR(64) NULL,
|
|
58011
|
+
source VARCHAR(128) NOT NULL,
|
|
58012
|
+
checksum VARCHAR(64) NOT NULL,
|
|
58013
|
+
type VARCHAR(32) NOT NULL,
|
|
58014
|
+
safe_content_json MEDIUMTEXT NOT NULL,
|
|
58015
|
+
retention_expires_at BIGINT NOT NULL,
|
|
58016
|
+
created_at BIGINT NOT NULL,
|
|
58017
|
+
FOREIGN KEY (attempt_id) REFERENCES pentest_sandbox_attempts(id) ON DELETE CASCADE,
|
|
58018
|
+
INDEX idx_evidence_attempt (attempt_id)
|
|
58019
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`
|
|
58020
|
+
]
|
|
58021
|
+
};
|
|
57964
58022
|
MARIADB_MIGRATIONS = [
|
|
57965
58023
|
migration0001,
|
|
57966
58024
|
migration0002,
|
|
@@ -58028,7 +58086,8 @@ var init_dist9 = __esm({
|
|
|
58028
58086
|
migration0064,
|
|
58029
58087
|
migration0065,
|
|
58030
58088
|
migration0066,
|
|
58031
|
-
migration0067
|
|
58089
|
+
migration0067,
|
|
58090
|
+
migration0068
|
|
58032
58091
|
];
|
|
58033
58092
|
MARIADB_MIGRATIONS[MARIADB_MIGRATIONS.length - 1]?.version ?? 0;
|
|
58034
58093
|
}
|
|
@@ -60062,11 +60121,11 @@ var definedBuildValue = (value, fallback) => typeof value === "string" && value.
|
|
|
60062
60121
|
var getCliBuildMetadata = (version2) => ({
|
|
60063
60122
|
version: version2,
|
|
60064
60123
|
gitSha: definedBuildValue(
|
|
60065
|
-
"
|
|
60124
|
+
"f60caa7079ae" ,
|
|
60066
60125
|
"unknown"
|
|
60067
60126
|
),
|
|
60068
60127
|
buildTimestamp: definedBuildValue(
|
|
60069
|
-
"2026-10-
|
|
60128
|
+
"2026-10-08T09:39:44.167Z" ,
|
|
60070
60129
|
"unknown"
|
|
60071
60130
|
),
|
|
60072
60131
|
configSchemaRange: definedBuildValue(
|
|
@@ -61486,109 +61545,27 @@ var LinuxSecretServiceStore = class {
|
|
|
61486
61545
|
}
|
|
61487
61546
|
}
|
|
61488
61547
|
};
|
|
61489
|
-
var
|
|
61490
|
-
|
|
61491
|
-
|
|
61492
|
-
|
|
61493
|
-
using System;
|
|
61494
|
-
using System.Runtime.InteropServices;
|
|
61495
|
-
public static class CodeSentinelCredentialNative {
|
|
61496
|
-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
|
61497
|
-
public struct CREDENTIAL {
|
|
61498
|
-
public UInt32 Flags; public UInt32 Type; public IntPtr TargetName; public IntPtr Comment;
|
|
61499
|
-
public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten;
|
|
61500
|
-
public UInt32 CredentialBlobSize; public IntPtr CredentialBlob; public Int32 Persist; public UInt32 AttributeCount;
|
|
61501
|
-
public IntPtr Attributes; public IntPtr TargetAlias; public IntPtr UserName;
|
|
61502
|
-
}
|
|
61503
|
-
[DllImport("Advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
61504
|
-
public static extern bool CredRead(string target, UInt32 type, UInt32 flags, out IntPtr credentialPtr);
|
|
61505
|
-
[DllImport("Advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
61506
|
-
public static extern bool CredWrite([In] ref CREDENTIAL credential, UInt32 flags);
|
|
61507
|
-
[DllImport("Advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
61508
|
-
public static extern bool CredDelete(string target, UInt32 type, UInt32 flags);
|
|
61509
|
-
[DllImport("Advapi32.dll", SetLastError = true)]
|
|
61510
|
-
public static extern void CredFree(IntPtr credential);
|
|
61511
|
-
}
|
|
61512
|
-
'@
|
|
61513
|
-
Add-Type -TypeDefinition $native
|
|
61514
|
-
`;
|
|
61515
|
-
var encodedPowerShell = (script) => Buffer.from(script, "utf16le").toString("base64");
|
|
61516
|
-
var powerShellTarget = (service, account) => `${service}:${account}`;
|
|
61548
|
+
var nativeWindowsEntry = async (service, account) => {
|
|
61549
|
+
const { AsyncEntry } = await import('@napi-rs/keyring');
|
|
61550
|
+
return new AsyncEntry(service, account);
|
|
61551
|
+
};
|
|
61517
61552
|
var WindowsCredentialManagerStore = class {
|
|
61518
|
-
constructor(
|
|
61519
|
-
this.
|
|
61520
|
-
}
|
|
61521
|
-
commands;
|
|
61522
|
-
run(target, body, input4) {
|
|
61523
|
-
return this.commands.run(
|
|
61524
|
-
"powershell.exe",
|
|
61525
|
-
[
|
|
61526
|
-
"-NoProfile",
|
|
61527
|
-
"-NonInteractive",
|
|
61528
|
-
"-EncodedCommand",
|
|
61529
|
-
encodedPowerShell(powershellPrelude(target) + body)
|
|
61530
|
-
],
|
|
61531
|
-
input4
|
|
61532
|
-
);
|
|
61553
|
+
constructor(entry = nativeWindowsEntry) {
|
|
61554
|
+
this.entry = entry;
|
|
61533
61555
|
}
|
|
61556
|
+
entry;
|
|
61534
61557
|
async read(service, account) {
|
|
61535
|
-
const
|
|
61536
|
-
|
|
61537
|
-
`
|
|
61538
|
-
$credentialPtr = [IntPtr]::Zero
|
|
61539
|
-
if (-not [CodeSentinelCredentialNative]::CredRead($target, 1, 0, [ref] $credentialPtr)) {
|
|
61540
|
-
if ([Runtime.InteropServices.Marshal]::GetLastWin32Error() -eq 1168) { exit 0 }
|
|
61541
|
-
throw "Credential Manager read failed: $([Runtime.InteropServices.Marshal]::GetLastWin32Error())"
|
|
61542
|
-
}
|
|
61543
|
-
try {
|
|
61544
|
-
$credential = [Runtime.InteropServices.Marshal]::PtrToStructure($credentialPtr, [type][CodeSentinelCredentialNative+CREDENTIAL])
|
|
61545
|
-
$bytes = New-Object byte[] $credential.CredentialBlobSize
|
|
61546
|
-
[Runtime.InteropServices.Marshal]::Copy($credential.CredentialBlob, $bytes, 0, $bytes.Length)
|
|
61547
|
-
[Console]::Out.WriteLine("___CS_CLI_B64_START___$([Convert]::ToBase64String($bytes))___CS_CLI_B64_END___")
|
|
61548
|
-
} finally { [CodeSentinelCredentialNative]::CredFree($credentialPtr) }
|
|
61549
|
-
`
|
|
61550
|
-
);
|
|
61551
|
-
const match = output2.match(/___CS_CLI_B64_START___(.*?)___CS_CLI_B64_END___/);
|
|
61552
|
-
if (match?.[1]) return Buffer.from(match[1], "base64").toString("utf8");
|
|
61553
|
-
return null;
|
|
61558
|
+
const bytes = await (await this.entry(service, account)).getSecret();
|
|
61559
|
+
return bytes === void 0 ? null : Buffer.from(bytes).toString("utf8");
|
|
61554
61560
|
}
|
|
61555
61561
|
async write(service, account, value) {
|
|
61556
|
-
await this.
|
|
61557
|
-
|
|
61558
|
-
|
|
61559
|
-
|
|
61560
|
-
$credential = New-Object CodeSentinelCredentialNative+CREDENTIAL
|
|
61561
|
-
$credential.Type = 1
|
|
61562
|
-
$credential.TargetName = [Runtime.InteropServices.Marshal]::StringToCoTaskMemUni($target)
|
|
61563
|
-
$credential.UserName = [Runtime.InteropServices.Marshal]::StringToCoTaskMemUni('Code Sentinel CLI')
|
|
61564
|
-
$credential.CredentialBlobSize = $bytes.Length
|
|
61565
|
-
$credential.Persist = 2
|
|
61566
|
-
$credential.CredentialBlob = [Runtime.InteropServices.Marshal]::AllocCoTaskMem($bytes.Length)
|
|
61567
|
-
try {
|
|
61568
|
-
[Runtime.InteropServices.Marshal]::Copy($bytes, 0, $credential.CredentialBlob, $bytes.Length)
|
|
61569
|
-
if (-not [CodeSentinelCredentialNative]::CredWrite([ref] $credential, 0)) {
|
|
61570
|
-
throw "Credential Manager write failed: $([Runtime.InteropServices.Marshal]::GetLastWin32Error())"
|
|
61571
|
-
}
|
|
61572
|
-
} finally {
|
|
61573
|
-
[Runtime.InteropServices.Marshal]::FreeCoTaskMem($credential.TargetName)
|
|
61574
|
-
[Runtime.InteropServices.Marshal]::FreeCoTaskMem($credential.UserName)
|
|
61575
|
-
[Runtime.InteropServices.Marshal]::FreeCoTaskMem($credential.CredentialBlob)
|
|
61576
|
-
}
|
|
61577
|
-
`,
|
|
61578
|
-
Buffer.from(value, "utf8").toString("base64")
|
|
61579
|
-
);
|
|
61562
|
+
await (await this.entry(service, account)).setSecret(Buffer.from(value, "utf8"));
|
|
61563
|
+
if (await this.read(service, account) !== value) {
|
|
61564
|
+
throw new Error("Windows Credential Manager did not persist the credential.");
|
|
61565
|
+
}
|
|
61580
61566
|
}
|
|
61581
61567
|
async remove(service, account) {
|
|
61582
|
-
await this.
|
|
61583
|
-
powerShellTarget(service, account),
|
|
61584
|
-
`
|
|
61585
|
-
if (-not [CodeSentinelCredentialNative]::CredDelete($target, 1, 0)) {
|
|
61586
|
-
if ([Runtime.InteropServices.Marshal]::GetLastWin32Error() -ne 1168) {
|
|
61587
|
-
throw "Credential Manager delete failed: $([Runtime.InteropServices.Marshal]::GetLastWin32Error())"
|
|
61588
|
-
}
|
|
61589
|
-
}
|
|
61590
|
-
`
|
|
61591
|
-
);
|
|
61568
|
+
await (await this.entry(service, account)).deleteCredential();
|
|
61592
61569
|
}
|
|
61593
61570
|
};
|
|
61594
61571
|
var createPlatformSecretStore = (platform = process.platform) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-sentinel-cli/code-sentinel-cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.13-avtest.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "AI-assisted code review CLI for Angular, Spring Boot, and Flutter projects.",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@ai-sdk/openai-compatible": "2.0.47",
|
|
42
42
|
"@inquirer/prompts": "7.10.1",
|
|
43
43
|
"@libsql/client": "0.14.0",
|
|
44
|
+
"@napi-rs/keyring": "2.1.0",
|
|
44
45
|
"ai": "6.0.185",
|
|
45
46
|
"chokidar": "5.0.0",
|
|
46
47
|
"commander": "12.1.0",
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
"react-devtools-core"
|
|
75
76
|
],
|
|
76
77
|
"publishConfig": {
|
|
77
|
-
"registry": "https://registry.npmjs.org
|
|
78
|
+
"registry": "https://registry.npmjs.org",
|
|
78
79
|
"access": "public"
|
|
79
80
|
}
|
|
80
81
|
}
|