@code-sentinel-cli/code-sentinel-cli 4.0.0 → 4.0.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 +1644 -166
- package/dist/index.js +1644 -166
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -225,7 +225,7 @@ function compareTaintFindings(a, b) {
|
|
|
225
225
|
if (aIds !== bIds) return aIds < bIds ? -1 : 1;
|
|
226
226
|
return 0;
|
|
227
227
|
}
|
|
228
|
-
var SEVERITY_ORDER, severityRank, meetsSeverity, LANGUAGES, languageFromExtension, languageFromPath, CORE_PACK, rulePackOf, compareFindings, editsOverlap, AI_GATE_POLICIES, isAiGatePolicy, AI_SKIP_GATE_POLICIES, isAiSkipGatePolicy, aiCoverageGates, findingGates, toRunIngestDto, AI_SKIP_REASONS, isRecallRiskSkip, isRetryableSkip, countRecallRiskSkips, LAYER_FLOW_MAP, sortEdges, createAstDependencyGraph, scenarioVerdictFromOutcome, summarizeClientCoverage, CLIENT_TEST_OUTCOMES, isClientTestOutcome, CLIENT_ORACLE_FAILURE_MARKER, isClientOracleFailure, clientScenarioVerdictFromOutcome, AUTH_FILL_KINDS, isAuthFillKind, STR, STR_LIST, MOCK_USER_RE, ANONYMOUS_RE, JWT_AUTHORITY, JWT_AUTHORITY_LIST, JWT_RE, WMU_ARG, WITH_MOCK_USER_RE, WITH_USER_DETAILS_RE, ALLOWED_IMPORT_RE, isRecord, isSafeLine, validateImports, validateAuthFill, MAX_STATE_WRITES, MAX_HASH_FIELDS, MAX_CLAIMS, MAX_CLAIM_ARRAY, MAX_EVIDENCE, MAX_KEY_LEN, MAX_VALUE_LEN, MAX_EVIDENCE_LEN, TRANSPORTS, ALGORITHMS, VALUE_SOURCES, NAME_RE, CLAIM_NAME_RE, SCHEME_RE, FORBIDDEN_KEY_RE, CONTROL_RE, isRecord2, isSafeText, isSafeKey, isSafeField, INVALID, normaliseKeyFromClaim, normaliseClaimValue, normaliseClaims, normaliseHashFields, normaliseStateWrite, normaliseEvidence, validateRuntimeAuthHypothesis, resolveStateWriteKeys, describeRuntimeAuthHypothesisProblem, CHECKLIST_VERDICTS, rollupChecklistDecisions, UNASSESSED_REASONS, ASSESSMENT_SCHEMA_VERSION, emptyByVerdict, summarize, toAssessmentDocument, rollupRuntime, combinedRuntimeStance, DEFAULT_PENTEST_POLICY, PENTEST_POLICY_PROVENANCE, resolvePentestPolicy, policyProvenanceNote, PENTEST_POLICY_CONSUMERS, PENTEST_POLICY_CONDITIONAL_CONSUMERS, flattenPolicy, readPath, policyOverriddenPaths, appliedPolicyThresholds, PROVENANCE_POLICIES, isProvenancePolicy, canonicalDastId, normalizeRouteTemplate, dastExecutionTargetId, dastScenarioId, dastScenarioVerdict, DAST_TARGET_COVERAGES, classifyDastCoverage, COVERAGE_FIELD, rollupDastCoverage, dastReportHash, dastScanPlanHash, dastTargetManifestHash, resolveDastProvenance, cmpStr, COVERAGE_BINDING_WINDOW_MS, parseInstant, hasExplicitOffset, resolveDastCoverageProvenance, TRUST_TIERS, isTrustTier, PRODUCER_AUTHORITIES, isProducerAuthority, assuranceForAuthority, AUTHORITY_BY_TIER, isAuthorityPermitted, ORACLE_CATALOG, verdictContextFor, isProvenanceSound, deriveVerdict, VALIDATION_REJECT_CLASSES, DAST_NEGATIVE_ORACLE_CATALOG, dastNegativeOracleSpecFor, evaluateDastNegativeOracle, sastCorroborationState, rollupE1Provenance, canonicalE1Id, cmpStr2, e1SuiteHash, parseIso, hasExplicitOffset2, AMBIGUOUS_TIMESTAMP_TOLERANCE_MS, STATUS_RANK, resolveCurrentRunId, classify, resolveE1Provenance, TRUST_RANK, canonicalHarnessPlan, validateHarnessPlan, RUNTIME_OUTCOME_SCHEMA_VERSION, RUNTIME_TIERS, isRuntimeTier, RUNTIME_STOP_REASONS, isRuntimeStopReason, tierForStopReason, REQUIRED_DELIVERABLES, reachedTier, classifyRuntimeOutcome, classifyPreflight, BOOT_CAUSE_SOURCES, isBootCauseSource, validateRuntimeOutcome, computeRuleSetHash, buildRuleResults, reviewProject;
|
|
228
|
+
var SEVERITY_ORDER, severityRank, meetsSeverity, LANGUAGES, languageFromExtension, languageFromPath, CORE_PACK, rulePackOf, compareFindings, editsOverlap, AI_GATE_POLICIES, isAiGatePolicy, AI_SKIP_GATE_POLICIES, isAiSkipGatePolicy, aiCoverageGates, findingGates, toRunIngestDto, AI_SKIP_REASONS, isRecallRiskSkip, isRetryableSkip, countRecallRiskSkips, LAYER_FLOW_MAP, sortEdges, createAstDependencyGraph, scenarioVerdictFromOutcome, summarizeClientCoverage, CLIENT_TEST_OUTCOMES, isClientTestOutcome, CLIENT_ORACLE_FAILURE_MARKER, isClientOracleFailure, clientScenarioVerdictFromOutcome, AUTH_FILL_KINDS, isAuthFillKind, STR, STR_LIST, MOCK_USER_RE, ANONYMOUS_RE, JWT_AUTHORITY, JWT_AUTHORITY_LIST, JWT_RE, WMU_ARG, WITH_MOCK_USER_RE, WITH_USER_DETAILS_RE, ALLOWED_IMPORT_RE, isRecord, isSafeLine, validateImports, validateAuthFill, MAX_STATE_WRITES, MAX_HASH_FIELDS, MAX_CLAIMS, MAX_CLAIM_ARRAY, MAX_EVIDENCE, MAX_KEY_LEN, MAX_VALUE_LEN, MAX_EVIDENCE_LEN, TRANSPORTS, ALGORITHMS, VALUE_SOURCES, NAME_RE, CLAIM_NAME_RE, SCHEME_RE, FORBIDDEN_KEY_RE, CONTROL_RE, isRecord2, isSafeText, isSafeKey, isSafeField, INVALID, normaliseKeyFromClaim, normaliseClaimValue, normaliseClaims, normaliseHashFields, normaliseStateWrite, normaliseEvidence, validateRuntimeAuthHypothesis, resolveStateWriteKeys, describeRuntimeAuthHypothesisProblem, MAX_TARGETS, MAX_ROWS, MAX_COLUMNS, MAX_EVIDENCE2, MAX_STRING_VALUE, MAX_EVIDENCE_LEN2, SQL_IDENTIFIER_RE, isSqlIdentifier, PATH_RE, METHOD_RE, CONTROL_RE2, isRecord3, isSafeText2, normaliseValue, normaliseRow, normaliseEvidence2, normaliseTarget, validateRuntimeDataSeedHypothesis, describeRuntimeDataSeedHypothesisProblem, runtimeDataSeedDeviationBanner, CHECKLIST_VERDICTS, rollupChecklistDecisions, UNASSESSED_REASONS, ASSESSMENT_SCHEMA_VERSION, emptyByVerdict, summarize, toAssessmentDocument, rollupRuntime, combinedRuntimeStance, DEFAULT_PENTEST_POLICY, PENTEST_POLICY_PROVENANCE, resolvePentestPolicy, policyProvenanceNote, PENTEST_POLICY_CONSUMERS, PENTEST_POLICY_CONDITIONAL_CONSUMERS, flattenPolicy, readPath, policyOverriddenPaths, appliedPolicyThresholds, PROVENANCE_POLICIES, isProvenancePolicy, canonicalDastId, normalizeRouteTemplate, dastExecutionTargetId, dastScenarioId, dastScenarioVerdict, DAST_TARGET_COVERAGES, classifyDastCoverage, COVERAGE_FIELD, rollupDastCoverage, dastReportHash, dastScanPlanHash, dastTargetManifestHash, resolveDastProvenance, cmpStr, COVERAGE_BINDING_WINDOW_MS, parseInstant, hasExplicitOffset, resolveDastCoverageProvenance, TRUST_TIERS, isTrustTier, PRODUCER_AUTHORITIES, isProducerAuthority, assuranceForAuthority, AUTHORITY_BY_TIER, isAuthorityPermitted, ORACLE_CATALOG, verdictContextFor, isProvenanceSound, deriveVerdict, VALIDATION_REJECT_CLASSES, DAST_NEGATIVE_ORACLE_CATALOG, dastNegativeOracleSpecFor, evaluateDastNegativeOracle, sastCorroborationState, rollupE1Provenance, canonicalE1Id, cmpStr2, e1SuiteHash, parseIso, hasExplicitOffset2, AMBIGUOUS_TIMESTAMP_TOLERANCE_MS, STATUS_RANK, resolveCurrentRunId, classify, resolveE1Provenance, TRUST_RANK, canonicalHarnessPlan, validateHarnessPlan, RUNTIME_OUTCOME_SCHEMA_VERSION, RUNTIME_TIERS, isRuntimeTier, RUNTIME_STOP_REASONS, isRuntimeStopReason, tierForStopReason, REQUIRED_DELIVERABLES, reachedTier, classifyRuntimeOutcome, classifyPreflight, BOOT_CAUSE_SOURCES, isBootCauseSource, validateRuntimeOutcome, computeRuleSetHash, buildRuleResults, reviewProject;
|
|
229
229
|
var init_dist2 = __esm({
|
|
230
230
|
"../core/dist/index.js"() {
|
|
231
231
|
init_dist();
|
|
@@ -815,6 +815,134 @@ var init_dist2 = __esm({
|
|
|
815
815
|
}
|
|
816
816
|
return "the answer did not match the schema; re-check every field against the rules above.";
|
|
817
817
|
};
|
|
818
|
+
MAX_TARGETS = 32;
|
|
819
|
+
MAX_ROWS = 64;
|
|
820
|
+
MAX_COLUMNS = 32;
|
|
821
|
+
MAX_EVIDENCE2 = 20;
|
|
822
|
+
MAX_STRING_VALUE = 4096;
|
|
823
|
+
MAX_EVIDENCE_LEN2 = 300;
|
|
824
|
+
SQL_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
|
|
825
|
+
isSqlIdentifier = (v) => typeof v === "string" && SQL_IDENTIFIER_RE.test(v);
|
|
826
|
+
PATH_RE = /^\/[\x21-\x7e]{0,511}$/;
|
|
827
|
+
METHOD_RE = /^[A-Za-z]{1,10}$/;
|
|
828
|
+
CONTROL_RE2 = /[\u0000-\u001f\u007f]/;
|
|
829
|
+
isRecord3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
830
|
+
isSafeText2 = (v, max) => typeof v === "string" && v.length > 0 && v.length <= max && !CONTROL_RE2.test(v);
|
|
831
|
+
normaliseValue = (v) => {
|
|
832
|
+
if (v === null) return null;
|
|
833
|
+
if (typeof v === "boolean") return v;
|
|
834
|
+
if (typeof v === "number") return Number.isFinite(v) ? v : void 0;
|
|
835
|
+
if (typeof v === "string") return isSafeText2(v, MAX_STRING_VALUE) ? v : void 0;
|
|
836
|
+
return void 0;
|
|
837
|
+
};
|
|
838
|
+
normaliseRow = (raw) => {
|
|
839
|
+
if (!isRecord3(raw)) return null;
|
|
840
|
+
const entries = Object.entries(raw.columns ?? raw);
|
|
841
|
+
if (entries.length === 0 || entries.length > MAX_COLUMNS) return null;
|
|
842
|
+
const columns = {};
|
|
843
|
+
for (const [k, v] of entries) {
|
|
844
|
+
if (!isSqlIdentifier(k)) return null;
|
|
845
|
+
const value = normaliseValue(v);
|
|
846
|
+
if (value === void 0) return null;
|
|
847
|
+
columns[k] = value;
|
|
848
|
+
}
|
|
849
|
+
return { columns };
|
|
850
|
+
};
|
|
851
|
+
normaliseEvidence2 = (raw) => {
|
|
852
|
+
if (!Array.isArray(raw)) return null;
|
|
853
|
+
if (raw.length === 0 || raw.length > MAX_EVIDENCE2) return null;
|
|
854
|
+
const out = [];
|
|
855
|
+
for (const item15 of raw) {
|
|
856
|
+
if (!isSafeText2(item15, MAX_EVIDENCE_LEN2)) return null;
|
|
857
|
+
out.push(item15);
|
|
858
|
+
}
|
|
859
|
+
return out;
|
|
860
|
+
};
|
|
861
|
+
normaliseTarget = (raw) => {
|
|
862
|
+
if (!isRecord3(raw)) return null;
|
|
863
|
+
if (typeof raw.httpMethod !== "string" || !METHOD_RE.test(raw.httpMethod)) return null;
|
|
864
|
+
const httpMethod = raw.httpMethod.toUpperCase();
|
|
865
|
+
if (typeof raw.path !== "string" || !PATH_RE.test(raw.path)) return null;
|
|
866
|
+
if (!isSqlIdentifier(raw.table)) return null;
|
|
867
|
+
if (!Array.isArray(raw.rows) || raw.rows.length === 0 || raw.rows.length > MAX_ROWS) return null;
|
|
868
|
+
const rows = [];
|
|
869
|
+
for (const item15 of raw.rows) {
|
|
870
|
+
const row2 = normaliseRow(item15);
|
|
871
|
+
if (row2 === null) return null;
|
|
872
|
+
rows.push(row2);
|
|
873
|
+
}
|
|
874
|
+
return { httpMethod, path: raw.path, table: raw.table, rows };
|
|
875
|
+
};
|
|
876
|
+
validateRuntimeDataSeedHypothesis = (raw) => {
|
|
877
|
+
if (!isRecord3(raw)) return null;
|
|
878
|
+
if (raw.scheme !== "sql-insert") return null;
|
|
879
|
+
if (!Array.isArray(raw.targets)) return null;
|
|
880
|
+
if (raw.targets.length > MAX_TARGETS) return null;
|
|
881
|
+
const targets = [];
|
|
882
|
+
const seen = /* @__PURE__ */ new Set();
|
|
883
|
+
for (const item15 of raw.targets) {
|
|
884
|
+
const t = normaliseTarget(item15);
|
|
885
|
+
if (t === null) return null;
|
|
886
|
+
const id = `${t.httpMethod}\0${t.path}\0${t.table}`;
|
|
887
|
+
if (seen.has(id)) return null;
|
|
888
|
+
seen.add(id);
|
|
889
|
+
targets.push(t);
|
|
890
|
+
}
|
|
891
|
+
const evidence17 = normaliseEvidence2(raw.evidence);
|
|
892
|
+
if (evidence17 === null) return null;
|
|
893
|
+
return { scheme: "sql-insert", targets, evidence: evidence17 };
|
|
894
|
+
};
|
|
895
|
+
describeRuntimeDataSeedHypothesisProblem = (raw) => {
|
|
896
|
+
if (validateRuntimeDataSeedHypothesis(raw) !== null) return null;
|
|
897
|
+
if (raw === null || raw === void 0) return "the answer was null.";
|
|
898
|
+
if (!isRecord3(raw)) return `the answer was not a JSON object (it was ${typeof raw}).`;
|
|
899
|
+
const r = raw;
|
|
900
|
+
if (r.scheme !== "sql-insert") {
|
|
901
|
+
return `"scheme" must be exactly "sql-insert" (got ${JSON.stringify(r.scheme)}).`;
|
|
902
|
+
}
|
|
903
|
+
if (!Array.isArray(r.targets)) {
|
|
904
|
+
return '"targets" must be an array (use [] when no endpoint needs pre-existing state).';
|
|
905
|
+
}
|
|
906
|
+
for (const t of r.targets) {
|
|
907
|
+
if (!isRecord3(t)) continue;
|
|
908
|
+
if (typeof t.table === "string" && !isSqlIdentifier(t.table)) {
|
|
909
|
+
return `"table" must be a bare SQL identifier [A-Za-z_][A-Za-z0-9_]* \u2014 got ${JSON.stringify(t.table)} (schema-qualified names are not accepted).`;
|
|
910
|
+
}
|
|
911
|
+
if (typeof t.path === "string" && !PATH_RE.test(t.path)) {
|
|
912
|
+
return `"path" must be an endpoint path starting with "/" with no whitespace or control characters \u2014 got ${JSON.stringify(t.path)}.`;
|
|
913
|
+
}
|
|
914
|
+
if (Array.isArray(t.rows) && t.rows.length === 0) {
|
|
915
|
+
return `the target for "${t.httpMethod} ${t.path}" has zero rows \u2014 a seed target exists to insert rows; use an empty "targets" array if nothing needs seeding.`;
|
|
916
|
+
}
|
|
917
|
+
if (Array.isArray(t.rows)) {
|
|
918
|
+
for (const row2 of t.rows) {
|
|
919
|
+
if (isRecord3(row2) && isRecord3(row2.columns)) {
|
|
920
|
+
for (const [k, v] of Object.entries(row2.columns)) {
|
|
921
|
+
if (!isSqlIdentifier(k)) {
|
|
922
|
+
return `column name ${JSON.stringify(k)} is not a bare SQL identifier.`;
|
|
923
|
+
}
|
|
924
|
+
if (typeof v === "string" && new RegExp("\\p{Cc}", "u").test(v)) {
|
|
925
|
+
return `the value of column "${k}" contains control characters \u2014 values are data bound as quoted literals; remove the control bytes.`;
|
|
926
|
+
}
|
|
927
|
+
if (typeof v !== "string" && typeof v !== "number" && typeof v !== "boolean" && v !== null) {
|
|
928
|
+
return `the value of column "${k}" must be string/number/boolean/null \u2014 nested objects and arrays are not values this contract can bind.`;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
if (!Array.isArray(r.evidence) || r.evidence.length === 0) {
|
|
936
|
+
return '"evidence" is required and must be a non-empty array of file/class names the answer was read from.';
|
|
937
|
+
}
|
|
938
|
+
return "the answer did not match the schema; re-check every field against the rules above.";
|
|
939
|
+
};
|
|
940
|
+
runtimeDataSeedDeviationBanner = (h) => {
|
|
941
|
+
const tables = [...new Set(h.targets.map((t) => t.table))].sort();
|
|
942
|
+
const rows = h.targets.reduce((n, t) => n + t.rows.length, 0);
|
|
943
|
+
const evidence17 = h.evidence.join("; ");
|
|
944
|
+
return `D\u1EEF li\u1EC7u seed do runner t\u1EF1 gieo (sql-insert, ${rows} d\xF2ng v\xE0o ${tables.length} b\u1EA3ng: ${tables.join(", ")}). Finding li\xEAn quan d\u1EEF li\u1EC7u ch\u1EC9 ph\u1EA3n \xE1nh sandbox, KH\xD4NG ph\u1EA3i production. Gi\u1EA3 thuy\u1EBFt \u0111\u1ECDc t\u1EEB: ${evidence17}.`;
|
|
945
|
+
};
|
|
818
946
|
CHECKLIST_VERDICTS = [
|
|
819
947
|
"CONFIRMED-VULN",
|
|
820
948
|
"CONTROL-ABSENT",
|
|
@@ -1013,9 +1141,9 @@ var init_dist2 = __esm({
|
|
|
1013
1141
|
];
|
|
1014
1142
|
readPath = (override, path) => {
|
|
1015
1143
|
if (override === void 0) return void 0;
|
|
1016
|
-
const [
|
|
1017
|
-
if (
|
|
1018
|
-
const bag = override[
|
|
1144
|
+
const [group2, field2] = path.split(".");
|
|
1145
|
+
if (group2 === void 0 || field2 === void 0) return void 0;
|
|
1146
|
+
const bag = override[group2];
|
|
1019
1147
|
return bag?.[field2];
|
|
1020
1148
|
};
|
|
1021
1149
|
policyOverriddenPaths = (override) => {
|
|
@@ -1579,6 +1707,7 @@ var init_dist2 = __esm({
|
|
|
1579
1707
|
"boot-blocked",
|
|
1580
1708
|
"nothing-to-verify",
|
|
1581
1709
|
"auth-gate",
|
|
1710
|
+
"baseline-unreachable",
|
|
1582
1711
|
"complete",
|
|
1583
1712
|
"runner-fault"
|
|
1584
1713
|
];
|
|
@@ -1595,6 +1724,7 @@ var init_dist2 = __esm({
|
|
|
1595
1724
|
return "T2";
|
|
1596
1725
|
case "nothing-to-verify":
|
|
1597
1726
|
case "auth-gate":
|
|
1727
|
+
case "baseline-unreachable":
|
|
1598
1728
|
return "T3";
|
|
1599
1729
|
case "complete":
|
|
1600
1730
|
return "T4";
|
|
@@ -1639,9 +1769,22 @@ var init_dist2 = __esm({
|
|
|
1639
1769
|
if (!s.appServedHttp) return { tier: "T2", stopReason: "boot-blocked" };
|
|
1640
1770
|
if (s.scenariosGenerated === 0) return { tier: "T3", stopReason: "nothing-to-verify" };
|
|
1641
1771
|
if (s.scenariosConcluded === 0) {
|
|
1772
|
+
if (s.appDiedAbnormally === true) return { tier: "T3", stopReason: "runner-fault" };
|
|
1642
1773
|
const baseline = s.authBaselineStatus;
|
|
1643
|
-
|
|
1644
|
-
|
|
1774
|
+
const e2Scanned = s.e2ScannedCount;
|
|
1775
|
+
const e2Gated = s.e2AuthGatedCount;
|
|
1776
|
+
const e2SawRealSurfaceUngated = e2Scanned !== void 0 && e2Gated !== void 0 && e2Scanned > 0 && e2Gated === 0;
|
|
1777
|
+
if (baseline !== void 0 && baseline >= 400) {
|
|
1778
|
+
if (baseline === 401 || baseline === 403) {
|
|
1779
|
+
return e2SawRealSurfaceUngated ? { tier: "T3", stopReason: "baseline-unreachable" } : { tier: "T3", stopReason: "auth-gate" };
|
|
1780
|
+
}
|
|
1781
|
+
return { tier: "T3", stopReason: "baseline-unreachable" };
|
|
1782
|
+
}
|
|
1783
|
+
if (s.oracleRefusedOnBaseline === true) {
|
|
1784
|
+
if (e2Gated !== void 0 && e2Gated > 0) return { tier: "T3", stopReason: "auth-gate" };
|
|
1785
|
+
if (e2SawRealSurfaceUngated) return { tier: "T3", stopReason: "baseline-unreachable" };
|
|
1786
|
+
return { tier: "T3", stopReason: "auth-gate" };
|
|
1787
|
+
}
|
|
1645
1788
|
return { tier: "T3", stopReason: "runner-fault" };
|
|
1646
1789
|
}
|
|
1647
1790
|
return { tier: "T4", stopReason: "complete" };
|
|
@@ -1942,9 +2085,9 @@ function report(error, callback$1, output2, suppressErrors) {
|
|
|
1942
2085
|
else callback$1(null, output2);
|
|
1943
2086
|
}
|
|
1944
2087
|
function build$1(options, isSynchronous) {
|
|
1945
|
-
const { onlyCounts, group, maxFiles } = options;
|
|
2088
|
+
const { onlyCounts, group: group2, maxFiles } = options;
|
|
1946
2089
|
if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
|
|
1947
|
-
else if (
|
|
2090
|
+
else if (group2) return isSynchronous ? groupsSync : groupsAsync;
|
|
1948
2091
|
else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
|
|
1949
2092
|
else return isSynchronous ? defaultSync : defaultAsync;
|
|
1950
2093
|
}
|
|
@@ -6996,7 +7139,7 @@ function parseParams(url) {
|
|
|
6996
7139
|
function normalizeUrl(url) {
|
|
6997
7140
|
return url.replace(/^\/+/, "");
|
|
6998
7141
|
}
|
|
6999
|
-
var createCompositeParser, SUPPORTED, createTextParser, requireFromHere, grammarCache, parserInitialized, initParser, resolveGrammarPath, loadGrammar, LANGUAGE_TO_GRAMMAR, SUPPORTED2, createTreeSitterParser, asTreeSitterTree, SUPPORTED3, scriptKindFor, createTsMorphParser, createParser, TS_LANGUAGES, EXTENSIONS, TS_SOURCE_EXTENSIONS_BY_RUNTIME_EXT, scriptKindFor2, normalizeRelativePath, candidatePaths, normalizeConfigPath, stripJsonComments, loadTsConfigResolver, matchPathPattern, applyPathTarget, resolveAliasModule, resolveModule, aliasIfDifferent, exportedSymbols, expressionRootName, addSymbol, compareText, variableBindingNames, importEqualsSpecifier, extractSymbols, fingerprintFor, createTsAstDependencyGraphBuilder, isTsLike, debug, warn, tryLoad, trySave, createIncrementalAstGraphBuilder, SOURCES, SINKS, SANITIZERS, DEFAULT_TS_TAINT_TABLES, JAVA_SOURCES, JAVA_SINKS, JAVA_SANITIZERS, DEFAULT_JAVA_TAINT_TABLES, EMPTY_SUMMARY, paramSentinel, PARAM_SENTINEL_RE, MAX_CROSS_FILE_DEPTH, TYPE_DECL_NODES, indexCache, SCOPE_BOUNDARY, SCOPE_BOUNDARY2, TYPE_DECL, STRING_PASSTHROUGH, ARG_PASSTHROUGH, CONTAINER_ELEMENT, BUILDER_APPENDERS, COLLECTION_MUTATORS, RECEIVER_FOLD_MUTATORS, CONDITIONAL_CONSTRUCT, EMPTY_SUMMARY2, paramSentinel2, PARAM_SENTINEL_RE2, MAX_CROSS_METHOD_DEPTH, SANITIZE_CALL, BYPASS_CALL, PREFIX_GATE, MAX_VALUE_HOPS, SOURCE_PATTERNS, maskJavaComments, maskedCorpusCache, maskJavaFiles, MAPPING_ANNOTATIONS, PARAM_ANNOTATIONS, AUTHZ_ANNOTATIONS, VALIDATION_ANNOTATIONS, annotationScanner, TYPE_DECL2, MODIFIER, METHOD_NAME, LEADING_ANNOTATION, simpleName, lineOf, readBalanced, annotationArgs, firstStringLiteral, readMappingPath, readMappingMethod, joinPaths, skipToDeclaration, isTypeDeclaration, splitParams, parseParam, readAuthAnnotations, ROLE_ANNOTATIONS, stripRolePrefix, readAuthRoles, precedingBlock, readClassContext, extractFromFile, extractHttpEndpoints, findEnclosingEndpoint, SINK_ATTACKS, SOURCE_KIND, kindsFromSources, deriveAuthContext, resolveInjectionPoint, buildServerRequest, buildClientRequest, generateAttackScenario, UNASSESSED_CATALOG, BY_ID, buildUnassessedItems, INJECTION_LANGUAGES, TIER_A_INJECTION_ITEMS, CONFIRMED_LIMITATION, INCONCLUSIVE_LIMITATION, evidenceFrom, byFileLine, CHECKLIST_VERDICT_RANK, mergeEqualRank, dedupeByChecklistId, scenarioByFileLine, PENTEST_CHECKLIST_TOTAL, DECLARED_CHECKLIST_IDS, buildChecklistCoverage, buildCoverage, assembleAssessment, IMPORT_LINE_RE, isImportOrPackageLine, CSRF_SPEC, CORS_SPEC, HEADERS_SPEC, STACKTRACE_SPEC, MESSAGE_SPEC, COOKIE_SPEC, SESSION_FIXATION_SPEC, SESSION_TIMEOUT_SPEC, AUTH_CACHE_SPEC, lineOf2, SECURITY_CONFIG_RE, CSRF_DISABLE_RE, CORS_WILDCARD_RE, CROSS_ORIGIN_BARE_RE, ALLOW_CREDENTIALS_RE, CORS_EXPLICIT_ORIGIN_RE, CORS_ANY_RE, HEADERS_DISABLE_RES, HEADERS_CONFIGURED_RE, CSP_CONFIGURED_RE, STACKTRACE_EXPOSE_RE, STACKTRACE_NEVER_RE, MESSAGE_EXPOSE_RE, MESSAGE_NEVER_RE, COOKIE_CONTEXT_RE, COOKIE_INSECURE_CHECKS, COOKIE_HARDENED_RE, SESSION_FIXATION_DISABLED_RE, CACHE_CONTROL_DISABLE_RE, CACHE_CONTROL_CONFIGURED_RE, SESSION_TIMEOUT_PATH_RE, SESSION_BLOCK_HEADER_RE, SESSION_TIMEOUT_LEAF_RE, YAML_INDENT_RE, control, configEvidence, firstMatch, firstMatchAny, scanCsrf, CORS_ORIGINS_YAML_RE, CORS_CREDENTIALS_YAML_RE, isWildcardOrigins, corsConfigRank, corsOriginHits, scanCors, scanSecurityHeaders, NON_PROD_PROFILE_RE, scanStacktraceExposure, scanErrorMessageExposure, scanCookieAttributes, scanSessionFixation, scanAuthCacheControl, findSessionTimeout, timeoutNeverExpires, timeoutToMinutes, JWT_VALIDITY_RE, NON_PROD_CONFIG_RE, findJwtValidities, hoursOf, judgeJwtValidity, judgeServletTimeout, scanSessionTimeout, scanSecurityConfig, TEST_SOURCE_SET_RE, isTestSourcePath, WEAK_CRYPTO_SPEC, MAX_EVIDENCE2, lineOf3, classifyAlgorithm, GET_INSTANCE_RE, COMMONS_DIGEST_RE, GUAVA_HASHING_RE, SECRET_KEY_SPEC_RE, SHORTHAND_ALGO, collectWeakHits, STRONG_CRYPTO_RE, STRONG_CRYPTO_RE_G, firstStrong, evidence, item, scanWeakCrypto, REGEX_PRECEDING_KEYWORDS, isIdentChar, regexAllowedAt, maskJsComments, maskedCorpusCache2, maskJsFiles, BROWSER_STORAGE_SPEC, MAX_EVIDENCE22, lineOf4, HIGH_SENSITIVITY_RE, TOKEN_FAMILY_RE, classifyStorageKey, VALUE_TOKEN_FAMILY_RE, classifyStorageValue, keyToken, SET_ITEM_RE, BRACKET_ASSIGN_RE, STORAGE_USE_RE, IDB_CONTEXT_RE, LOCALFORAGE_SET_RE, IDB_STORE_WRITE_RE, collectStorageHits, collectIndexedDbHits, finalizeHits, firstStorageUse, evidence2, item2, scanSensitiveBrowserStorage, AT_REST_SPEC, MAX_EVIDENCE3, lineOf5, PWD_GETTER, PWD_EQUALS_RECEIVER_RE, PWD_EQUALS_ARG_RE, collectPasswordComparisonHits, SENSITIVE_FIELD_NAMES, FIELD_DECL_RE, FIELD_PROTECTED_RE, precedingBlock2, collectPlaintextFieldHits, finalizeHits2, PROTECTION_RE, firstProtection, AT_REST_SURFACE_RE, evidence3, item3, scanSensitiveDataAtRest, PADDING_ORACLE_SPEC, MAX_EVIDENCE4, lineOf6, GET_INSTANCE_RE2, collectCbcHits, BAD_PADDING_CATCH_RE, collectBadPaddingHits, finalizeHits3, AEAD_RE, firstAead, CIPHER_SURFACE_RE, evidence4, item4, scanPaddingOracle, LOGGING_SPEC, MAX_EVIDENCE5, lineOf7, LOG_CALL_RE, LOG_SURFACE_RE, stripStringLiterals, SECRET_RE, PII_RE, PROTECTED_TAIL_RE, findSensitiveToken, collectLogHits, firstLogSurface, evidence5, item5, scanSensitiveLogging, CHECKLIST_ID, CONTROL_ID, TITLE, CWE, MAX_EVIDENCE6, ADMIN_PATH_RE, ADMIN_CONTROLLER_RE, isAdminEndpoint, ADMIN_ROLE_RE, ROLE_CAPABLE_AUTHZ, ROLE_ANNOTATION_RE, SEC_CONFIG_HINT_RE, MATCHER_RE, ACCESS_AFTER_RE, ANY_REQUEST_RE, offsetOfLine, readBalanced2, stringLiterals, antMatches, hasAdminRoleAnnotation, classHeaderOf, memberWindow, annotationStance, accessKind, collectFilterConfig, filterStanceFor, combineProtection, publicNote, item6, auditAdminSurface, CLOUD_ACL_SPEC, MAX_EVIDENCE7, lineOf8, PUBLIC_ACL_PATTERNS, finalizeHits4, collectCannedAclHits, EFFECT_ALLOW_RE, WILDCARD_PRINCIPAL_RE, S3_ACTION_RE, enclosingObject, collectBucketPolicyHits, evidence6, item7, scanCloudStorageAcl, ACTUATOR_SPEC, MAX_EVIDENCE8, CONFIG_FILE_RE, SENSITIVE_ACTUATOR_ENDPOINTS, lineOf9, indentOf, isBlankOrComment, splitEndpoints, classifyExposure, exposureNote, H2_NOTE, findChildKey, collectListItems, collectExposureHits, collectH2Hits, finalizeHits5, evidence7, item8, scanActuatorExposure, BACKUP_FILE_SPEC, BACKUP_FILE_GLOBS, BACKUP_FILE_RE, SENSITIVE_BASE_RE, MAX_EVIDENCE9, stripBackupSuffix, classify2, evidence8, scanBackupFiles, CROSSDOMAIN_SPEC, CROSSDOMAIN_GLOBS, MAX_EVIDENCE10, lineOf10, PERMISSIVE_PATTERNS, collectHits, evidence9, scanCrossDomainPolicy, CLIENT_INFO_SPEC, ANGULAR_CONFIG_GLOBS, MAX_EVIDENCE11, lineOf11, asRecord, sourceMapEnabled, buildConfigurations, scanConfigFile, evidence10, item9, scanClientInfoLeak, SENSITIVE_FILE_SPEC, SENSITIVE_FILE_GLOBS, SENSITIVE_FILE_RE, PEM_TEXT_RE, PRIVATE_KEY_HEADER_RE, MAX_EVIDENCE12, classify22, evidence11, scanSensitiveFiles, INSECURE_TRANSPORT_SPEC, ENVIRONMENT_FILE_RE, MAX_EVIDENCE13, lineOf12, extractStringLiterals, HTTP_URL_RE, HTTPS_PRESENCE_RE, isExcludedHost, scanInsecureTransport, WEBSOCKET_SPEC, MAX_EVIDENCE14, WS_URL_RE, WSS_PRESENCE_RE, scanWebSocketSecurity, authFillKey, createStubAuthFillResolver, buildAuthFillMap, ALG_TO_HASH, SIGNING_KEY_LINE, ENV_PLACEHOLDER, lineOf13, cleanValue, discoverJwtSigningKeys, b64url, b64urlStr, signingKeyBytes, mintJwt, DEFAULT_JHIPSTER_CLAIMS, RECIPE_NOTE, sha256Hex, buildRuntimeAuthRecipe, mintTokenFromRecipe, DEFAULT_TTL_SECONDS, commandsFor, credentialFor, buildRuntimeAuthSeedPlan, runtimeAuthSeedDeviation, DEFAULT_TIMEOUT_MS, CRLF, encodeResp, identify, readReply, applyRuntimeAuthSeed, describeShape, resolveRuntimeAuthHypothesis, THREW, createStubRuntimeAuthHypothesisResolver, REACHABILITY_MANIFEST_SCHEMA_VERSION, MANIFEST_NOTE, SCALAR_JAVA_TYPES, baseTypeName, seedForParam, METHOD_INTENT, buildHint, buildReachabilityManifest, norm, dirOf, baseName, isMavenPom, isGradleBuild, stripXmlComments, isAncestorDir, normModulePath, selectRunnableModule, PACKAGE_DECL, BOOT_CLASS, posix22, detectSpringBootClass, BASE_CONFIG_RE, PROFILE_CONFIG_RE, HARNESS_PORT, KEY_LINE_RE, yamlEntries, emptyKeys, isConfigYaml, profileRank, declaresDatasource, detectDatasourceProfileBlocker, detectProfileCompositionBlocker, detectServerPortBlocker, XML_COMMENT_RE, INCLUDE_RE, CREATE_TABLE_RE, ALTER_TARGET_RE, matchAllGroups, detectUnrunnableMigrationBlocker, detectPolicyBootBlockers, BINDABLE_NAME_RE, YAML_KEY_RE, PROPS_KEY_RE, configValueOf, rawTokensOf, MARK, AUTHORITY_LIKE_RE, shapeInAuthority, nextOf, shapeInPath, shapeAt, parseConfigValue, renderTemplate, STANDALONE_BOOT_PROFILE, NOTE, isConfigFile, leafKey, indentOf2, fullPathFor, usesJpa, KAFKA_BUILD_RE, KAFKA_CONFIG_RE, declaresKafka, hasPinnedListenerAutoStartup, ENDPOINT_PROPERTY_RULES, ENDPOINT_VALUE_RE, CLUSTER_TOPOLOGY_RULES, literalDatabaseOf, buildStandaloneBootProfile, runtimeEnvKeyFor, A_SENTINEL, ENC_SENTINEL, isEndpointShaped, hasToken, dummyFor, RELAXED_ENV, envKeyFor, buildSidecars, renderSidecar, identifyByName, PATH_KINDS, PATH_LEAF_ROLES, identifyByPath, roleFromShape, shapedDummy, resolvePlaceholder, encSentinelFor, SHAPE_PRECEDENCE, strongerShape, buildBootResolution, CONFIG_ENTRY_RE, SKIPPED_ENTRY_RE, XML_COMMENT_RE2, SYSTEM_PATH_RE, declaredSystemJarEntries, declaredSystemJarPaths, readCentralDirectory, readEntryBytes, readEntryText, languageFor, detectMissingSystemJars, readJarConfigFiles, listJarClassNames, MIN_CONSTANT_LEN, MAX_CONSTANT_LEN, MAX_CONSTANTS_PER_CLASS, NOISE_CONSTANT_RE, parseClassConstants, constantRank, readJarClassConstants, collectDependencyClassConstants, collectDependencyClassNames, collectDependencyConfigFiles, EOCD_SIGNATURE, CENTRAL_SIGNATURE, EOCD_SEARCH_WINDOW, MAX_COMPRESSION_RATIO, MAX_UNCOMPRESSED_BYTES, MAX_ENTRIES, fail, isUnsafeName, readArchive, readArchiveEntryText, SOURCE_EXTENSIONS, extensionOf, baseNameOf, XML_COMMENT_RE3, isAggregatorPom, declaresParentPath, declaresSystemPaths, resolveAgainst, preflightArchive, SKIP_DIRS, MAX_FILE_BYTES, MAX_PARENT_DEPTH, toPosix2, isFile, walk, XML_COMMENT_RE4, RELATIVE_PATH_RE, SYSTEM_PATH_RE2, PARENT_BLOCK_RE, EMPTY_RELATIVE_PATH_RE, readPom, expandBasedir, planServicePackage, CRC_TABLE, crc32, writePackageZip, listPackageableModules, DIALECT_SPECS, JDBC_URL_PATTERNS, DRIVER_PATTERNS, isConfigFile2, isBuildFile, dialectsMatching, resolveDialect, DDL_AUTO_CREATE_RE, FLYWAY_RE, LIQUIBASE_RE, resolveSchemaProvisioning, detectDbTier, DB_SIDECAR_PORT, DISPOSABLE_DB, dbSidecarEnv, buildDbSidecarSpec, HARNESS_PLAN_SCHEMA_VERSION, isConfigFile3, isBuildFile2, stripComments, SERVICE_DEPS, detectDatabaseDependency, detectServiceDependencies, detectHarnessDependencies, buildHarnessPlan, RUNTIME_PLAN_SCHEMA_VERSION, PLAN_NOTE, describeSidecar, buildSteps, buildRuntimeBringUpPlan, RUNTIME_OVERLAY_FILE, RUNTIME_COMPOSE_FILE, RUNTIME_GUIDE_FILE, RUNTIME_BOOT_ENV_FILE, SIDECAR_IMAGE, REDIS_CLUSTER_COMMAND, renderNestedYaml, renderOverlay, publishLine, renderCompose, renderGuide, renderBootEnv, generateRuntimeArtifacts, SUBMISSION_REQUIREMENTS_SCHEMA_VERSION, MAX_EVIDENCE15, NOTE2, capEvidence, totalSuffix, blockerEvidence, groupBy, packagingRequirements, secretRequirements, POLICY_KINDS, policyRequirements, infrastructureRequirements, authRequirements, seedRequirements, TIER_ORDER, buildSubmissionRequirements, renderSubmissionRequirements, REJECT_SIDECAR, applyRuntimeInput, DESER_SPEC, MAX_EVIDENCE16, lineOf14, UNSAFE_PATTERNS, collectHits2, SAFE_VALIDATOR_RE, firstSafeValidator, evidence12, item10, scanUnsafeDeserialization, WEAK_RANDOM_SPEC, MAX_EVIDENCE17, lineOf15, WEAK_RNG_PATTERNS, SECURITY_ID_RE, statementAround, COOKIE_SINK_MAX_HOPS, namesCarrying, reachesCookie, collectHits3, SECURE_RANDOM_RE, firstSecureRandom, evidence13, item11, scanWeakSecureRandom, POSTMESSAGE_SPEC, MAX_EVIDENCE18, lineOf16, WINDOW_LISTENER_PATTERNS, ORIGIN_RE, isFrontend, listenersIn, evidence14, item12, scanPostMessageOrigin, XXE_SPEC, MAX_EVIDENCE19, lineOf17, XML_PARSER_PATTERNS, HARDENING_RE, parsersIn, evidence15, item13, scanXxe, WEAK_TLS_SPEC, MAX_EVIDENCE20, lineOf18, BYPASS_PATTERNS, TLS_SURFACE_RE, bypassesIn, evidence16, item14, scanWeakTls, HOST_HEADER_SPEC, MAX_EVIDENCE21, lineOf20, HOST_PATTERNS, collectHits5, evidence18, item16, scanHostHeader, CHECKLIST_ID2, CONTROL_ID2, TITLE2, evidenceOf, item17, VALUE_ANNOTATION_RE, FIELD_AFTER_VALUE_RE, LIFETIME_TOKEN_RE, tokenize, hasOtpToken, TIME_UNIT_RE, NAME_UNIT_HINTS, TO_SECONDS, lineOf21, isOtpLifetimeName, configRank, inconclusive, scanOtpPolicy, PASSWORD_POLICY_SPEC, MAX_EVIDENCE222, lineOf22, precedingBlock3, PASSWORD_NAME_RE, NOT_A_SECRET_RE, isPasswordName, STRING_DECL_RE, SIZE_MIN_RE, ANNOTATION_IN_BLOCK_RE, LENGTH_CHECK_RE, CONSTRAINT_VALIDATOR_RE, ANNOTATION_DECL_RE, STRING_LITERAL_RE, QUANT_MIN_RE, POLICY_SURFACE_PATTERNS, ACCOUNT_SURFACE_RE, baseName2, isAccountSurface, collectCustomConstraintMins, sitesIn, firstUsageIndex, pointersIn, dedupeSort, evidenceOf2, item18, policyNote, scanPasswordPolicy, SPEC, MAX_EVIDENCE23, AUTH_SURFACE_RE, ACCOUNT_EXISTENCE_RE, PASSWORD_ONLY_RE, COMBINED_RE, STRING_LITERAL_RE2, lineOf23, scanAuthFile, dedupeSort2, evidenceOf3, item19, scanAccountEnumeration, SPEC2, MAX_EVIDENCE24, LOGOUT_ENDPOINT_RE, LOGOUT_MENTION_RE, INVALIDATION_PATTERNS, lineOf24, invalidationHits, dedupeSort3, evidenceOf4, item20, scanLogoutInvalidation, SPEC3, MAX_EVIDENCE25, OTP_ISSUE_RE, OTP_MENTION_RE, THROTTLE_PATTERNS, lineOf25, firstMatch2, dedupeSort4, evidenceOf5, item21, scanOtpThrottle, SPEC4, MAX_EVIDENCE26, HARD_MUTATION_HANDLER_RE, DIRECT_WRITE_RE, DELEGATION_WRITE_RE, TXN_RE, READ_ONLY_TXN_RE, offsetOfLine2, insideLiteral, extractHandlerBody, braceMatchedBlock, signatureRegion, confirmWrite, dedupeSort5, evidenceOf6, item22, scanStateChangingGet, MAX_EVIDENCE27, REVIEW_SIGNAL_MAP, asJsonRecord, readReviewFinding, parseReviewReport, evidenceOf7, sortEvidence, foldReviewSignals, MAX_EVIDENCE28, AUTHORIZATION_RISK_EVIDENCE, AI_SIGNAL_MAP, readPerRule, parseAiReviewReport, evidenceOf8, sortEvidence2, provenanceOf, skipReasonOf, foldAiSignals, MAX_EVIDENCE29, SEVERITY_ORDER2, SCORE_FLOOR, asRecord2, asString, stripMountPrefix, severityFromTags, field, parseScaReport, effectiveScore, passesThreshold, distinctPairs, bySeverityThenName, evidenceOf9, countBySeverity, provenance, foldScaReport, BRUTE_FORCE_SPEC, MAX_EVIDENCE30, lineOf26, AUTH_CONTEXT_RE, LIMIT_NAME_RE, MAX_VALUE_ASSIGN_RE, MECHANISM_PATTERNS, failOpenHits, mechanismHits, dedupeSort6, evidenceOf10, item23, scanBruteForceProtection, TS_LANGS, MOUNT_ROOT, MOUNT_ANY, TS_EXT_CANDIDATES, MAX_CHAIN_DEPTH, MAX_REEXPORT_DEPTH, UNRESOLVED_PATH, keyOf, applyRouteConfigOverrides, CLIENT_CLASSES, MANUAL_DELIVERY_SOURCES, ENC, ROUTE_BASE_PREFIX, BENIGN_PARAM, CLIENT_ORACLE, deliveryFor, jsStr, normFile, camel, urlChunk, buildGoto, manualComment, renderMethod, renderSpec, dedupeRoutes, generateClientVerificationSuite, buildClientVerificationManifest, WSTG, TC16, MANUAL_CHECKLIST_ITEMS, NEEDS_MANUAL_LIMITATION, buildManualChecklistItems, handoffFileName, MAX_SURFACE_SAMPLE, surfaceContext, INFRA_CONTEXT, buildHandoffPackets, GENERATED_PACKAGE, SERVER_CLASSES, BOOLEAN_BLIND_CLASSES, BOOLEAN_BLIND_PAIRS, CLASS_CANARY, COMMAND_CANARY, VALIDATION_REJECT_CLASSES2, CANON_HELPER, CLASS_ORACLE, javaStr, BENIGN_SEED, renderAuthSuffix, pascal, camel2, identChunk, fillPath, requestExpr, isVerifiable, SERVER_SKIP_REASON, renderBooleanBlind, renderCanary, renderMethod2, renderEvidenceMethod, renderEvidenceHelpers, renderTestcontainersDbTierFields, renderExternalDbTierFields, renderClass, toManifestEntries, generateVerificationSuite, buildVerificationManifest, decodeEntities, attr, stripCdata, childMessage, classify3, parseJUnitXml, simpleClassName, joinKey, DEFAULT_TRUST_TIER, resolveFromEnvelope, ingestVerification, PROVENANCE_DETAIL, applyProvenanceDowngrades, asRecord3, asString2, asBool, asInt, SIGNALS, ATTESTATION_METHODS, parseProvenance, parseOracle, parseEffectBoundary, parseDefenseControl, parseBaseline, parseAttack, parseEvidenceEnvelope, asRecord4, asArray, asString3, asNumber, basename22, specOutcome, walkSuite, parsePlaywrightReport, joinKey2, ingestClientVerification, compareChecklistId, correlateVerification, EMPTY_CORRELATION, notTestedItem, groupDastByChecklist, dastAxisFor, groupClientByChecklist, clientAxisFor, correlateAssessment, ZAP_SCAN_RULES, DEFAULT_DAST_OPTIONS, DAST_PLAN_FILE, DAST_MANIFEST_FILE, isScannable, skipReason, yamlStr, fillPath2, normMethod, toTarget, SEED_VALUE, renderRequest, renderPlanYaml, generateDastPlan, buildDastManifest, cmpStr3, compareScenarioRef, compareExecutionTarget, RISK_BY_CODE, asString4, firstLine, parseZapReport, firstLineOf, usableTimestamp, latestMessageInstant, parseZapMessages, pathOf, stripTrailingSlash, pathMatches, methodMatches, injectionMatches, routeMatchesOrUnknown, alertMatchesTarget, queryHasParam, messageMatchesSurface, computeDastCoverage, detailOf, evidenceOf11, ingestDast, SEMGREP_CWE_MAP, asRecord5, asString5, asNonNegativeInteger, compareText2, compareCwe, stringsFrom, cwesFromProperties, messageText, compareFinding, findingKey, ruleMetadata, metadataForResult, locationsOf, findingsFromRun, parseSemgrepSarif, compareChecklistId2, unmatchedKey, ingestSemgrep, CHECKLIST_ID3, CONTROL_ID3, MAX_EVIDENCE31, OWNER_SCOPED_FINDER, REPOSITORY_DECL, lineOf27, fieldNameFor, collectOwnerScopedRepositories, scanIdor, CHECKLIST_ID4, CONTROL_ID4, MAX_EVIDENCE32, CONTROLLER, MULTIPART_PARAM, ALLOWLIST, CONTENT_SNIFF, lineOf28, collectUploadHandlers, firstMatch3, scanUploadValidation, CHECKLIST_ID5, CONTROL_ID5, MAX_EVIDENCE33, SECRET_KEY_LINE, SELF_IDENTIFYING_KEYS, JWT_CONTEXT_RE, PARENT_KEY_LINE, ancestorPath, ENV_PLACEHOLDER2, NON_PROD_PROFILE, CONFIG_FILE, lineOf29, byFileLine2, collectSecrets, scanJwtSecret;
|
|
7142
|
+
var createCompositeParser, SUPPORTED, createTextParser, requireFromHere, grammarCache, parserInitialized, initParser, resolveGrammarPath, loadGrammar, LANGUAGE_TO_GRAMMAR, SUPPORTED2, createTreeSitterParser, asTreeSitterTree, SUPPORTED3, scriptKindFor, createTsMorphParser, createParser, TS_LANGUAGES, EXTENSIONS, TS_SOURCE_EXTENSIONS_BY_RUNTIME_EXT, scriptKindFor2, normalizeRelativePath, candidatePaths, normalizeConfigPath, stripJsonComments, loadTsConfigResolver, matchPathPattern, applyPathTarget, resolveAliasModule, resolveModule, aliasIfDifferent, exportedSymbols, expressionRootName, addSymbol, compareText, variableBindingNames, importEqualsSpecifier, extractSymbols, fingerprintFor, createTsAstDependencyGraphBuilder, isTsLike, debug, warn, tryLoad, trySave, createIncrementalAstGraphBuilder, SOURCES, SINKS, SANITIZERS, DEFAULT_TS_TAINT_TABLES, JAVA_SOURCES, JAVA_SINKS, JAVA_SANITIZERS, DEFAULT_JAVA_TAINT_TABLES, EMPTY_SUMMARY, paramSentinel, PARAM_SENTINEL_RE, MAX_CROSS_FILE_DEPTH, TYPE_DECL_NODES, indexCache, SCOPE_BOUNDARY, SCOPE_BOUNDARY2, TYPE_DECL, STRING_PASSTHROUGH, ARG_PASSTHROUGH, CONTAINER_ELEMENT, BUILDER_APPENDERS, COLLECTION_MUTATORS, RECEIVER_FOLD_MUTATORS, CONDITIONAL_CONSTRUCT, EMPTY_SUMMARY2, paramSentinel2, PARAM_SENTINEL_RE2, MAX_CROSS_METHOD_DEPTH, SANITIZE_CALL, BYPASS_CALL, PREFIX_GATE, MAX_VALUE_HOPS, SOURCE_PATTERNS, maskJavaComments, maskedCorpusCache, maskJavaFiles, MAPPING_ANNOTATIONS, PARAM_ANNOTATIONS, AUTHZ_ANNOTATIONS, VALIDATION_ANNOTATIONS, annotationScanner, TYPE_DECL2, MODIFIER, METHOD_NAME, LEADING_ANNOTATION, simpleName, lineOf, readBalanced, annotationArgs, firstStringLiteral, readMappingPath, readMappingMethod, joinPaths, skipToDeclaration, isTypeDeclaration, splitParams, parseParam, readAuthAnnotations, ROLE_ANNOTATIONS, stripRolePrefix, readAuthRoles, precedingBlock, readClassContext, extractFromFile, extractHttpEndpoints, findEnclosingEndpoint, SINK_ATTACKS, SOURCE_KIND, kindsFromSources, deriveAuthContext, resolveCompanionParams, resolveInjectionPoint, buildServerRequest, buildClientRequest, generateAttackScenario, UNASSESSED_CATALOG, BY_ID, buildUnassessedItems, INJECTION_LANGUAGES, TIER_A_INJECTION_ITEMS, CONFIRMED_LIMITATION, INCONCLUSIVE_LIMITATION, evidenceFrom, byFileLine, CHECKLIST_VERDICT_RANK, mergeEqualRank, dedupeByChecklistId, scenarioByFileLine, PENTEST_CHECKLIST_TOTAL, DECLARED_CHECKLIST_IDS, buildChecklistCoverage, buildCoverage, assembleAssessment, IMPORT_LINE_RE, isImportOrPackageLine, CSRF_SPEC, CORS_SPEC, HEADERS_SPEC, STACKTRACE_SPEC, MESSAGE_SPEC, COOKIE_SPEC, SESSION_FIXATION_SPEC, SESSION_TIMEOUT_SPEC, AUTH_CACHE_SPEC, lineOf2, SECURITY_CONFIG_RE, CSRF_DISABLE_RE, CORS_WILDCARD_RE, CROSS_ORIGIN_BARE_RE, ALLOW_CREDENTIALS_RE, CORS_EXPLICIT_ORIGIN_RE, CORS_ANY_RE, HEADERS_DISABLE_RES, HEADERS_CONFIGURED_RE, CSP_CONFIGURED_RE, STACKTRACE_EXPOSE_RE, STACKTRACE_NEVER_RE, MESSAGE_EXPOSE_RE, MESSAGE_NEVER_RE, COOKIE_CONTEXT_RE, COOKIE_INSECURE_CHECKS, COOKIE_HARDENED_RE, SESSION_FIXATION_DISABLED_RE, CACHE_CONTROL_DISABLE_RE, CACHE_CONTROL_CONFIGURED_RE, SESSION_TIMEOUT_PATH_RE, SESSION_BLOCK_HEADER_RE, SESSION_TIMEOUT_LEAF_RE, YAML_INDENT_RE, control, configEvidence, firstMatch, firstMatchAny, scanCsrf, CORS_ORIGINS_YAML_RE, CORS_CREDENTIALS_YAML_RE, isWildcardOrigins, corsConfigRank, corsOriginHits, scanCors, scanSecurityHeaders, NON_PROD_PROFILE_RE, scanStacktraceExposure, scanErrorMessageExposure, scanCookieAttributes, scanSessionFixation, scanAuthCacheControl, findSessionTimeout, timeoutNeverExpires, timeoutToMinutes, JWT_VALIDITY_RE, NON_PROD_CONFIG_RE, findJwtValidities, hoursOf, judgeJwtValidity, judgeServletTimeout, scanSessionTimeout, scanSecurityConfig, TEST_SOURCE_SET_RE, isTestSourcePath, WEAK_CRYPTO_SPEC, MAX_EVIDENCE3, lineOf3, classifyAlgorithm, GET_INSTANCE_RE, COMMONS_DIGEST_RE, GUAVA_HASHING_RE, SECRET_KEY_SPEC_RE, SHORTHAND_ALGO, collectWeakHits, STRONG_CRYPTO_RE, STRONG_CRYPTO_RE_G, firstStrong, evidence, item, scanWeakCrypto, REGEX_PRECEDING_KEYWORDS, isIdentChar, regexAllowedAt, maskJsComments, maskedCorpusCache2, maskJsFiles, BROWSER_STORAGE_SPEC, MAX_EVIDENCE22, lineOf4, HIGH_SENSITIVITY_RE, TOKEN_FAMILY_RE, classifyStorageKey, VALUE_TOKEN_FAMILY_RE, classifyStorageValue, keyToken, SET_ITEM_RE, BRACKET_ASSIGN_RE, STORAGE_USE_RE, IDB_CONTEXT_RE, LOCALFORAGE_SET_RE, IDB_STORE_WRITE_RE, collectStorageHits, collectIndexedDbHits, finalizeHits, firstStorageUse, evidence2, item2, scanSensitiveBrowserStorage, AT_REST_SPEC, MAX_EVIDENCE32, lineOf5, PWD_GETTER, PWD_EQUALS_RECEIVER_RE, PWD_EQUALS_ARG_RE, collectPasswordComparisonHits, SENSITIVE_FIELD_NAMES, FIELD_DECL_RE, FIELD_PROTECTED_RE, precedingBlock2, collectPlaintextFieldHits, finalizeHits2, PROTECTION_RE, firstProtection, AT_REST_SURFACE_RE, evidence3, item3, scanSensitiveDataAtRest, PADDING_ORACLE_SPEC, MAX_EVIDENCE4, lineOf6, GET_INSTANCE_RE2, collectCbcHits, BAD_PADDING_CATCH_RE, collectBadPaddingHits, finalizeHits3, AEAD_RE, firstAead, CIPHER_SURFACE_RE, evidence4, item4, scanPaddingOracle, LOGGING_SPEC, MAX_EVIDENCE5, lineOf7, LOG_CALL_RE, LOG_SURFACE_RE, stripStringLiterals, SECRET_RE, PII_RE, PROTECTED_TAIL_RE, findSensitiveToken, collectLogHits, firstLogSurface, evidence5, item5, scanSensitiveLogging, CHECKLIST_ID, CONTROL_ID, TITLE, CWE, MAX_EVIDENCE6, ADMIN_PATH_RE, ADMIN_CONTROLLER_RE, isAdminEndpoint, ADMIN_ROLE_RE, ROLE_CAPABLE_AUTHZ, ROLE_ANNOTATION_RE, SEC_CONFIG_HINT_RE, MATCHER_RE, ACCESS_AFTER_RE, ANY_REQUEST_RE, offsetOfLine, readBalanced2, stringLiterals, antMatches, hasAdminRoleAnnotation, classHeaderOf, memberWindow, annotationStance, accessKind, collectFilterConfig, filterStanceFor, combineProtection, publicNote, item6, auditAdminSurface, CLOUD_ACL_SPEC, MAX_EVIDENCE7, lineOf8, PUBLIC_ACL_PATTERNS, finalizeHits4, collectCannedAclHits, EFFECT_ALLOW_RE, WILDCARD_PRINCIPAL_RE, S3_ACTION_RE, enclosingObject, collectBucketPolicyHits, evidence6, item7, scanCloudStorageAcl, ACTUATOR_SPEC, MAX_EVIDENCE8, CONFIG_FILE_RE, SENSITIVE_ACTUATOR_ENDPOINTS, lineOf9, indentOf, isBlankOrComment, splitEndpoints, classifyExposure, exposureNote, H2_NOTE, findChildKey, collectListItems, collectExposureHits, collectH2Hits, finalizeHits5, evidence7, item8, scanActuatorExposure, BACKUP_FILE_SPEC, BACKUP_FILE_GLOBS, BACKUP_FILE_RE, SENSITIVE_BASE_RE, MAX_EVIDENCE9, stripBackupSuffix, classify2, evidence8, scanBackupFiles, CROSSDOMAIN_SPEC, CROSSDOMAIN_GLOBS, MAX_EVIDENCE10, lineOf10, PERMISSIVE_PATTERNS, collectHits, evidence9, scanCrossDomainPolicy, CLIENT_INFO_SPEC, ANGULAR_CONFIG_GLOBS, MAX_EVIDENCE11, lineOf11, asRecord, sourceMapEnabled, buildConfigurations, scanConfigFile, evidence10, item9, scanClientInfoLeak, SENSITIVE_FILE_SPEC, SENSITIVE_FILE_GLOBS, SENSITIVE_FILE_RE, PEM_TEXT_RE, PRIVATE_KEY_HEADER_RE, MAX_EVIDENCE12, classify22, evidence11, scanSensitiveFiles, INSECURE_TRANSPORT_SPEC, ENVIRONMENT_FILE_RE, MAX_EVIDENCE13, lineOf12, extractStringLiterals, HTTP_URL_RE, HTTPS_PRESENCE_RE, isExcludedHost, scanInsecureTransport, WEBSOCKET_SPEC, MAX_EVIDENCE14, WS_URL_RE, WSS_PRESENCE_RE, scanWebSocketSecurity, authFillKey, createStubAuthFillResolver, buildAuthFillMap, ALG_TO_HASH, SIGNING_KEY_LINE, ENV_PLACEHOLDER, lineOf13, cleanValue, discoverJwtSigningKeys, b64url, b64urlStr, signingKeyBytes, mintJwt, DEFAULT_JHIPSTER_CLAIMS, RECIPE_NOTE, sha256Hex, buildRuntimeAuthRecipe, mintTokenFromRecipe, DEFAULT_TTL_SECONDS, commandsFor, credentialFor, buildRuntimeAuthSeedPlan, runtimeAuthSeedDeviation, DEFAULT_TIMEOUT_MS, CRLF, encodeResp, identify, readReply, applyRuntimeAuthSeed, describeShape, resolveRuntimeAuthHypothesis, THREW, createStubRuntimeAuthHypothesisResolver, dataSeedKey, describeShape2, THREW2, resolveRuntimeDataSeedHypothesis, createStubRuntimeDataSeedResolver, buildDataSeedPlan, dataSeedEndpointSummaries, IDEMPOTENT_INSERT, BACKSLASH_IS_ESCAPE, escapeSqlString, sqlLiteral, assertIdentifier, renderDataSeedSql, SEED_AUDIT_SENTINEL, AUDIT_FIELD_RE, CLASS_DECL_RE, TABLE_RE, EXTENDS_RE, NULLABLE_FALSE_RE, LENGTH_RE, stripJavaComments, group, detectSeedAuditColumns, applySeedAuditColumns, seedAuditAddedColumns, REACHABILITY_MANIFEST_SCHEMA_VERSION, MANIFEST_NOTE, SCALAR_JAVA_TYPES, baseTypeName, seedForParam, METHOD_INTENT, buildHint, buildReachabilityManifest, norm, dirOf, baseName, isMavenPom, isGradleBuild, stripXmlComments, isAncestorDir, normModulePath, selectRunnableModule, PACKAGE_DECL, BOOT_CLASS, posix22, detectSpringBootClass, BASE_CONFIG_RE, PROFILE_CONFIG_RE, HARNESS_PORT, KEY_LINE_RE, yamlEntries, emptyKeys, isConfigYaml, profileRank, declaresDatasource, detectDatasourceProfileBlocker, detectProfileCompositionBlocker, detectServerPortBlocker, XML_COMMENT_RE, INCLUDE_RE, CREATE_TABLE_RE, ALTER_TARGET_RE, matchAllGroups, detectUnrunnableMigrationBlocker, detectPolicyBootBlockers, BINDABLE_NAME_RE, YAML_KEY_RE, PROPS_KEY_RE, configValueOf, rawTokensOf, MARK, AUTHORITY_LIKE_RE, shapeInAuthority, nextOf, shapeInPath, shapeAt, parseConfigValue, renderTemplate, STANDALONE_BOOT_PROFILE, NOTE, isConfigFile, leafKey, indentOf2, fullPathFor, usesJpa, KAFKA_BUILD_RE, KAFKA_CONFIG_RE, declaresKafka, hasPinnedListenerAutoStartup, ENDPOINT_PROPERTY_RULES, ENDPOINT_VALUE_RE, CLUSTER_TOPOLOGY_RULES, literalDatabaseOf, buildStandaloneBootProfile, runtimeEnvKeyFor, A_SENTINEL, ENC_SENTINEL, isEndpointShaped, hasToken, dummyFor, RELAXED_ENV, envKeyFor, buildSidecars, renderSidecar, identifyByName, PATH_KINDS, PATH_LEAF_ROLES, identifyByPath, roleFromShape, shapedDummy, resolvePlaceholder, encSentinelFor, SHAPE_PRECEDENCE, strongerShape, buildBootResolution, CONFIG_ENTRY_RE, SKIPPED_ENTRY_RE, XML_COMMENT_RE2, SYSTEM_PATH_RE, declaredSystemJarEntries, declaredSystemJarPaths, readCentralDirectory, readEntryBytes, readEntryText, languageFor, detectMissingSystemJars, readJarConfigFiles, listJarClassNames, MIN_CONSTANT_LEN, MAX_CONSTANT_LEN, MAX_CONSTANTS_PER_CLASS, NOISE_CONSTANT_RE, parseClassConstants, constantRank, readJarClassConstants, collectDependencyClassConstants, collectDependencyClassNames, collectDependencyConfigFiles, EOCD_SIGNATURE, CENTRAL_SIGNATURE, EOCD_SEARCH_WINDOW, MAX_COMPRESSION_RATIO, MAX_UNCOMPRESSED_BYTES, MAX_ENTRIES, fail, isUnsafeName, readArchive, readArchiveEntryText, SOURCE_EXTENSIONS, extensionOf, baseNameOf, XML_COMMENT_RE3, isAggregatorPom, declaresParentPath, declaresSystemPaths, resolveAgainst, preflightArchive, SKIP_DIRS, MAX_FILE_BYTES, MAX_PARENT_DEPTH, toPosix2, isFile, walk, XML_COMMENT_RE4, RELATIVE_PATH_RE, SYSTEM_PATH_RE2, PARENT_BLOCK_RE, EMPTY_RELATIVE_PATH_RE, readPom, expandBasedir, planServicePackage, CRC_TABLE, crc32, writePackageZip, listPackageableModules, DIALECT_SPECS, JDBC_URL_PATTERNS, DRIVER_PATTERNS, isConfigFile2, isBuildFile, dialectsMatching, resolveDialect, DDL_AUTO_CREATE_RE, FLYWAY_RE, LIQUIBASE_RE, resolveSchemaProvisioning, detectDbTier, DB_SIDECAR_PORT, DISPOSABLE_DB, dbSidecarEnv, buildDbSidecarSpec, HARNESS_PLAN_SCHEMA_VERSION, isConfigFile3, isBuildFile2, stripComments, SERVICE_DEPS, detectDatabaseDependency, detectServiceDependencies, detectHarnessDependencies, buildHarnessPlan, RUNTIME_PLAN_SCHEMA_VERSION, PLAN_NOTE, describeSidecar, buildSteps, buildRuntimeBringUpPlan, RUNTIME_OVERLAY_FILE, RUNTIME_COMPOSE_FILE, RUNTIME_GUIDE_FILE, RUNTIME_BOOT_ENV_FILE, SIDECAR_IMAGE, REDIS_CLUSTER_COMMAND, renderNestedYaml, renderOverlay, publishLine, renderCompose, renderGuide, renderBootEnv, generateRuntimeArtifacts, SUBMISSION_REQUIREMENTS_SCHEMA_VERSION, MAX_EVIDENCE15, NOTE2, capEvidence, totalSuffix, blockerEvidence, groupBy, packagingRequirements, secretRequirements, POLICY_KINDS, policyRequirements, infrastructureRequirements, authRequirements, seedRequirements, TIER_ORDER, buildSubmissionRequirements, renderSubmissionRequirements, REJECT_SIDECAR, applyRuntimeInput, DESER_SPEC, MAX_EVIDENCE16, lineOf14, UNSAFE_PATTERNS, collectHits2, SAFE_VALIDATOR_RE, firstSafeValidator, evidence12, item10, scanUnsafeDeserialization, WEAK_RANDOM_SPEC, MAX_EVIDENCE17, lineOf15, WEAK_RNG_PATTERNS, SECURITY_ID_RE, statementAround, COOKIE_SINK_MAX_HOPS, namesCarrying, reachesCookie, collectHits3, SECURE_RANDOM_RE, firstSecureRandom, evidence13, item11, scanWeakSecureRandom, POSTMESSAGE_SPEC, MAX_EVIDENCE18, lineOf16, WINDOW_LISTENER_PATTERNS, ORIGIN_RE, isFrontend, listenersIn, evidence14, item12, scanPostMessageOrigin, XXE_SPEC, MAX_EVIDENCE19, lineOf17, XML_PARSER_PATTERNS, HARDENING_RE, parsersIn, evidence15, item13, scanXxe, WEAK_TLS_SPEC, MAX_EVIDENCE20, lineOf18, BYPASS_PATTERNS, TLS_SURFACE_RE, bypassesIn, evidence16, item14, scanWeakTls, HOST_HEADER_SPEC, MAX_EVIDENCE21, lineOf20, HOST_PATTERNS, collectHits5, evidence18, item16, scanHostHeader, CHECKLIST_ID2, CONTROL_ID2, TITLE2, evidenceOf, item17, VALUE_ANNOTATION_RE, FIELD_AFTER_VALUE_RE, LIFETIME_TOKEN_RE, tokenize, hasOtpToken, TIME_UNIT_RE, NAME_UNIT_HINTS, TO_SECONDS, lineOf21, isOtpLifetimeName, configRank, inconclusive, scanOtpPolicy, PASSWORD_POLICY_SPEC, MAX_EVIDENCE222, lineOf22, precedingBlock3, PASSWORD_NAME_RE, NOT_A_SECRET_RE, isPasswordName, STRING_DECL_RE, SIZE_MIN_RE, ANNOTATION_IN_BLOCK_RE, LENGTH_CHECK_RE, CONSTRAINT_VALIDATOR_RE, ANNOTATION_DECL_RE, STRING_LITERAL_RE, QUANT_MIN_RE, POLICY_SURFACE_PATTERNS, ACCOUNT_SURFACE_RE, baseName2, isAccountSurface, collectCustomConstraintMins, sitesIn, firstUsageIndex, pointersIn, dedupeSort, evidenceOf2, item18, policyNote, scanPasswordPolicy, SPEC, MAX_EVIDENCE23, AUTH_SURFACE_RE, ACCOUNT_EXISTENCE_RE, PASSWORD_ONLY_RE, COMBINED_RE, STRING_LITERAL_RE2, lineOf23, scanAuthFile, dedupeSort2, evidenceOf3, item19, scanAccountEnumeration, SPEC2, MAX_EVIDENCE24, LOGOUT_ENDPOINT_RE, LOGOUT_MENTION_RE, INVALIDATION_PATTERNS, lineOf24, invalidationHits, dedupeSort3, evidenceOf4, item20, scanLogoutInvalidation, SPEC3, MAX_EVIDENCE25, OTP_ISSUE_RE, OTP_MENTION_RE, THROTTLE_PATTERNS, lineOf25, firstMatch2, dedupeSort4, evidenceOf5, item21, scanOtpThrottle, SPEC4, MAX_EVIDENCE26, HARD_MUTATION_HANDLER_RE, DIRECT_WRITE_RE, DELEGATION_WRITE_RE, TXN_RE, READ_ONLY_TXN_RE, offsetOfLine2, insideLiteral, extractHandlerBody, braceMatchedBlock, signatureRegion, confirmWrite, dedupeSort5, evidenceOf6, item22, scanStateChangingGet, MAX_EVIDENCE27, REVIEW_SIGNAL_MAP, asJsonRecord, readReviewFinding, parseReviewReport, evidenceOf7, sortEvidence, foldReviewSignals, MAX_EVIDENCE28, AUTHORIZATION_RISK_EVIDENCE, AI_SIGNAL_MAP, readPerRule, parseAiReviewReport, evidenceOf8, sortEvidence2, provenanceOf, skipReasonOf, foldAiSignals, MAX_EVIDENCE29, SEVERITY_ORDER2, SCORE_FLOOR, asRecord2, asString, stripMountPrefix, severityFromTags, field, parseScaReport, effectiveScore, passesThreshold, distinctPairs, bySeverityThenName, evidenceOf9, countBySeverity, provenance, foldScaReport, BRUTE_FORCE_SPEC, MAX_EVIDENCE30, lineOf26, AUTH_CONTEXT_RE, LIMIT_NAME_RE, MAX_VALUE_ASSIGN_RE, MECHANISM_PATTERNS, failOpenHits, mechanismHits, dedupeSort6, evidenceOf10, item23, scanBruteForceProtection, TS_LANGS, MOUNT_ROOT, MOUNT_ANY, TS_EXT_CANDIDATES, MAX_CHAIN_DEPTH, MAX_REEXPORT_DEPTH, UNRESOLVED_PATH, keyOf, applyRouteConfigOverrides, CLIENT_CLASSES, MANUAL_DELIVERY_SOURCES, ENC, ROUTE_BASE_PREFIX, BENIGN_PARAM, CLIENT_ORACLE, deliveryFor, jsStr, normFile, camel, urlChunk, buildGoto, manualComment, renderMethod, renderSpec, dedupeRoutes, generateClientVerificationSuite, buildClientVerificationManifest, WSTG, TC16, MANUAL_CHECKLIST_ITEMS, NEEDS_MANUAL_LIMITATION, buildManualChecklistItems, handoffFileName, MAX_SURFACE_SAMPLE, surfaceContext, INFRA_CONTEXT, buildHandoffPackets, OBJECT_STORE_PROBE_SINKS, GENERATED_PACKAGE, SERVER_CLASSES, BOOLEAN_BLIND_CLASSES, BOOLEAN_BLIND_PAIRS, CLASS_CANARY, COMMAND_CANARY, VALIDATION_REJECT_CLASSES2, CANON_HELPER, CLASS_ORACLE, javaStr, BENIGN_SEED, BUCKET_BENIGN_SEED, benignSeedFor, renderAuthSuffix, RUNTIME_AUTH_SUFFIX, renderRuntimeAuthHelper, pascal, camel2, verificationTestClassName, identChunk, fillPath, companionCalls, requestExpr, isVerifiable, SERVER_SKIP_REASON, renderBooleanBlind, renderCanary, isObjectStoreProbeSink, OBJECT_STORE_REJECT_CATCH_LINES, wrapObjectStoreAttackGuard, wrapObjectStoreEvidenceAttackGuard, renderMethod2, renderEvidenceMethod, renderEvidenceHelpers, renderTestcontainersDbTierFields, renderExternalDbTierFields, javaSeedValue, renderSeedMethod, renderClass, toManifestEntries, generateVerificationSuite, buildVerificationManifest, decodeEntities, attr, stripCdata, childMessage, classify3, parseJUnitXml, simpleClassName, joinKey, DEFAULT_TRUST_TIER, resolveFromEnvelope, ingestVerification, PROVENANCE_DETAIL, applyProvenanceDowngrades, asRecord3, asString2, asBool, asInt, SIGNALS, ATTESTATION_METHODS, parseProvenance, parseOracle, parseEffectBoundary, parseDefenseControl, parseBaseline, parseAttack, parseEvidenceEnvelope, asRecord4, asArray, asString3, asNumber, basename22, specOutcome, walkSuite, parsePlaywrightReport, joinKey2, ingestClientVerification, compareChecklistId, correlateVerification, EMPTY_CORRELATION, notTestedItem, groupDastByChecklist, dastAxisFor, groupClientByChecklist, clientAxisFor, correlateAssessment, ZAP_SCAN_RULES, DEFAULT_DAST_OPTIONS, DAST_PLAN_FILE, DAST_MANIFEST_FILE, DAST_PROBE_SCRIPT_FILE, PROBE_VICTIM_BUCKET_REF, PROBE_CANARY_OBJECT_REF, PROBE_INJECTION_KINDS, isScannable, skipReason, yamlStr, normMethod, toTarget, SEED_VALUE, allParams, queryString, requestPath, renderRequest, renderPlanYaml, generateDastPlan, buildProbeSpec, buildProbe, buildDastManifest, cmpStr3, compareScenarioRef, compareExecutionTarget, shq, PROBE_SCRIPT_PROLOGUE, PROBE_SCRIPT_EPILOGUE, renderDastProbeScript, RISK_BY_CODE, asString4, firstLine, parseZapReport, firstLineOf, usableTimestamp, latestMessageInstant, parseZapMessages, pathOf, stripTrailingSlash, pathMatches, methodMatches, injectionMatches, routeMatchesOrUnknown, alertMatchesTarget, queryHasParam, messageMatchesSurface, computeDastCoverage, detailOf, evidenceOf11, ingestDast, SEMGREP_CWE_MAP, asRecord5, asString5, asNonNegativeInteger, compareText2, compareCwe, stringsFrom, cwesFromProperties, messageText, compareFinding, findingKey, ruleMetadata, metadataForResult, locationsOf, findingsFromRun, parseSemgrepSarif, compareChecklistId2, unmatchedKey, ingestSemgrep, CHECKLIST_ID3, CONTROL_ID3, MAX_EVIDENCE31, OWNER_SCOPED_FINDER, REPOSITORY_DECL, lineOf27, fieldNameFor, collectOwnerScopedRepositories, scanIdor, CHECKLIST_ID4, CONTROL_ID4, MAX_EVIDENCE322, CONTROLLER, MULTIPART_PARAM, ALLOWLIST, CONTENT_SNIFF, lineOf28, collectUploadHandlers, firstMatch3, scanUploadValidation, CHECKLIST_ID5, CONTROL_ID5, MAX_EVIDENCE33, SECRET_KEY_LINE, SELF_IDENTIFYING_KEYS, JWT_CONTEXT_RE, PARENT_KEY_LINE, ancestorPath, ENV_PLACEHOLDER2, NON_PROD_PROFILE, CONFIG_FILE, lineOf29, byFileLine2, collectSecrets, scanJwtSecret;
|
|
7000
7143
|
var init_dist5 = __esm({
|
|
7001
7144
|
"../parsers/dist/index.js"() {
|
|
7002
7145
|
init_dist();
|
|
@@ -9185,6 +9328,7 @@ ${edgePart}`);
|
|
|
9185
9328
|
if (anns.includes("PermitAll") || anns.length === 0) return { kind: "public" };
|
|
9186
9329
|
return endpoint.roles.length > 0 ? { kind: "authenticated", roles: endpoint.roles } : { kind: "authenticated" };
|
|
9187
9330
|
};
|
|
9331
|
+
resolveCompanionParams = (endpoint, injection) => endpoint.params.filter((p) => p.kind !== "body").filter((p) => !(injection !== null && p.name === injection.name && p.kind === injection.kind)).map((p) => ({ name: p.name, kind: p.kind }));
|
|
9188
9332
|
resolveInjectionPoint = (endpoint, sourceKinds) => {
|
|
9189
9333
|
const byKind = (k) => endpoint.params.find((p) => p.kind === k);
|
|
9190
9334
|
for (const k of sourceKinds) {
|
|
@@ -9236,6 +9380,10 @@ ${edgePart}`);
|
|
|
9236
9380
|
expectedIfSafe: template.expectedIfSafe,
|
|
9237
9381
|
sinkFile: finding.file,
|
|
9238
9382
|
sinkLine: finding.line,
|
|
9383
|
+
// ADR-0071: the sink FAMILY identity — one vulnerability class spans several sinks
|
|
9384
|
+
// (path-traversal = path-file + path-resource + minio-object) and only some carry a
|
|
9385
|
+
// canary probe; downstream layers key on this id, never on the class alone.
|
|
9386
|
+
sinkId: finding.sinkId,
|
|
9239
9387
|
verdict: "suspected",
|
|
9240
9388
|
confidence,
|
|
9241
9389
|
...finding.path && finding.path.length > 0 ? { taintPath: finding.path } : {}
|
|
@@ -9248,6 +9396,10 @@ ${edgePart}`);
|
|
|
9248
9396
|
httpMethod: endpoint ? endpoint.httpMethod === "ANY" ? "GET" : endpoint.httpMethod : "GET",
|
|
9249
9397
|
path: endpoint?.path ?? null,
|
|
9250
9398
|
injectionPoint: injection2,
|
|
9399
|
+
...(() => {
|
|
9400
|
+
const companions = endpoint ? resolveCompanionParams(endpoint, injection2) : [];
|
|
9401
|
+
return companions.length > 0 ? { companionParams: companions } : {};
|
|
9402
|
+
})(),
|
|
9251
9403
|
...endpoint ? { authContext: deriveAuthContext(endpoint) } : {},
|
|
9252
9404
|
requestExample: endpoint ? buildServerRequest(endpoint, injection2, firstPayload) : `# Kh\xF4ng gi\u1EA3i \u0111\u01B0\u1EE3c HTTP entry point cho sink ${finding.file}:${finding.line} \u2014 ki\u1EC3m tra th\u1EE7 c\xF4ng`
|
|
9253
9405
|
};
|
|
@@ -10716,7 +10868,7 @@ ${edgePart}`);
|
|
|
10716
10868
|
title: "Thu\u1EADt to\xE1n m\xE3 ho\xE1/b\u0103m m\u1EA1nh (kh\xF4ng MD5/SHA1/DES/RC4/ECB)",
|
|
10717
10869
|
cweId: "CWE-327"
|
|
10718
10870
|
};
|
|
10719
|
-
|
|
10871
|
+
MAX_EVIDENCE3 = 50;
|
|
10720
10872
|
lineOf3 = (content, index2) => {
|
|
10721
10873
|
let line = 1;
|
|
10722
10874
|
for (let i = 0; i < index2 && i < content.length; i++) {
|
|
@@ -10818,7 +10970,7 @@ ${edgePart}`);
|
|
|
10818
10970
|
if (seen.has(key)) return false;
|
|
10819
10971
|
seen.add(key);
|
|
10820
10972
|
return true;
|
|
10821
|
-
}).slice(0,
|
|
10973
|
+
}).slice(0, MAX_EVIDENCE3);
|
|
10822
10974
|
};
|
|
10823
10975
|
STRONG_CRYPTO_RE = /\bgetInstance\s*\(\s*"[^"]*(?:SHA-?(?:256|384|512)|SHA3|SHA-3|PBKDF2|\/GCM|ChaCha20|Poly1305)|\b(?:BCryptPasswordEncoder|Argon2PasswordEncoder|Pbkdf2PasswordEncoder|SCryptPasswordEncoder|DelegatingPasswordEncoder)\b|\b(?:DigestUtils|Hashing)\s*\.\s*sha(?:256|384|512)/i;
|
|
10824
10976
|
STRONG_CRYPTO_RE_G = new RegExp(STRONG_CRYPTO_RE.source, "gi");
|
|
@@ -11312,7 +11464,7 @@ ${edgePart}`);
|
|
|
11312
11464
|
title: "M\xE3 ho\xE1/b\u0103m d\u1EEF li\u1EC7u nh\u1EA1y c\u1EA3m khi l\u01B0u tr\u1EEF (at-rest)",
|
|
11313
11465
|
cweId: "CWE-312"
|
|
11314
11466
|
};
|
|
11315
|
-
|
|
11467
|
+
MAX_EVIDENCE32 = 50;
|
|
11316
11468
|
lineOf5 = (content, index2) => {
|
|
11317
11469
|
let line = 1;
|
|
11318
11470
|
for (let i = 0; i < index2 && i < content.length; i++) {
|
|
@@ -11451,7 +11603,7 @@ ${edgePart}`);
|
|
|
11451
11603
|
if (seen.has(key)) return false;
|
|
11452
11604
|
seen.add(key);
|
|
11453
11605
|
return true;
|
|
11454
|
-
}).slice(0,
|
|
11606
|
+
}).slice(0, MAX_EVIDENCE32);
|
|
11455
11607
|
};
|
|
11456
11608
|
PROTECTION_RE = /\b(?:BCrypt|Argon2|Pbkdf2|SCrypt|Delegating)PasswordEncoder\b|\bPasswordEncoder\b|\bpasswordEncoder\s*\.\s*(?:encode|matches)\s*\(|@ColumnTransformer\b|@Convert\s*\(\s*converter\s*=\s*[\w.]*(?:Crypt|Encrypt|Cipher|Aes|AES)/;
|
|
11457
11609
|
firstProtection = (javaFiles) => {
|
|
@@ -13233,6 +13385,249 @@ ${edgePart}`);
|
|
|
13233
13385
|
createStubRuntimeAuthHypothesisResolver = () => ({
|
|
13234
13386
|
resolve: () => Promise.resolve(null)
|
|
13235
13387
|
});
|
|
13388
|
+
dataSeedKey = (httpMethod, path2) => `${httpMethod} ${path2}`;
|
|
13389
|
+
describeShape2 = (raw) => {
|
|
13390
|
+
if (typeof raw !== "object" || raw === null) return `not an object (${typeof raw})`;
|
|
13391
|
+
const rec = raw;
|
|
13392
|
+
const keys = Object.keys(rec).sort();
|
|
13393
|
+
const targets = Array.isArray(rec.targets) ? rec.targets : [];
|
|
13394
|
+
const shapes = targets.slice(0, 6).map((t) => {
|
|
13395
|
+
if (typeof t !== "object" || t === null) return "<not-an-object>";
|
|
13396
|
+
const r = t;
|
|
13397
|
+
const rows = Array.isArray(r.rows) ? r.rows.length : -1;
|
|
13398
|
+
return `{${Object.keys(r).sort().join(",")}}${typeof r.table === "string" ? ` table=${r.table}` : ""} rows=${rows}`;
|
|
13399
|
+
});
|
|
13400
|
+
return `keys=[${keys.join(",")}] targets=${targets.length}${shapes.length > 0 ? ` ${shapes.join(" ")}` : ""}`;
|
|
13401
|
+
};
|
|
13402
|
+
THREW2 = /* @__PURE__ */ Symbol("resolver-threw");
|
|
13403
|
+
resolveRuntimeDataSeedHypothesis = async (resolver, request) => {
|
|
13404
|
+
const ask = async (req) => {
|
|
13405
|
+
try {
|
|
13406
|
+
return await resolver.resolve(req);
|
|
13407
|
+
} catch {
|
|
13408
|
+
return THREW2;
|
|
13409
|
+
}
|
|
13410
|
+
};
|
|
13411
|
+
const raw = await ask(request);
|
|
13412
|
+
if (raw === THREW2) return { hypothesis: null, outcome: "resolver-error" };
|
|
13413
|
+
if (raw === null || raw === void 0) return { hypothesis: null, outcome: "no-proposal" };
|
|
13414
|
+
const hypothesis = validateRuntimeDataSeedHypothesis(raw);
|
|
13415
|
+
if (hypothesis !== null) return { hypothesis, outcome: "accepted" };
|
|
13416
|
+
const reason = describeRuntimeDataSeedHypothesisProblem(raw);
|
|
13417
|
+
if (reason !== null) {
|
|
13418
|
+
const retried = await ask({ ...request, priorRejection: reason });
|
|
13419
|
+
if (retried !== THREW2 && retried !== null && retried !== void 0) {
|
|
13420
|
+
const fixed = validateRuntimeDataSeedHypothesis(retried);
|
|
13421
|
+
if (fixed !== null) return { hypothesis: fixed, outcome: "accepted" };
|
|
13422
|
+
return { hypothesis: null, outcome: "rejected", rejectedShape: describeShape2(retried) };
|
|
13423
|
+
}
|
|
13424
|
+
}
|
|
13425
|
+
return { hypothesis: null, outcome: "rejected", rejectedShape: describeShape2(raw) };
|
|
13426
|
+
};
|
|
13427
|
+
createStubRuntimeDataSeedResolver = () => ({
|
|
13428
|
+
resolve: () => Promise.resolve(null)
|
|
13429
|
+
});
|
|
13430
|
+
buildDataSeedPlan = (hypothesis) => {
|
|
13431
|
+
const plan = /* @__PURE__ */ new Map();
|
|
13432
|
+
for (const target of hypothesis.targets) {
|
|
13433
|
+
const key = dataSeedKey(target.httpMethod, target.path);
|
|
13434
|
+
const bucket = plan.get(key);
|
|
13435
|
+
if (bucket) bucket.push(target);
|
|
13436
|
+
else plan.set(key, [target]);
|
|
13437
|
+
}
|
|
13438
|
+
return plan;
|
|
13439
|
+
};
|
|
13440
|
+
dataSeedEndpointSummaries = (entries) => entries.filter((e) => e.seedRequirements.length > 0).map((e) => ({
|
|
13441
|
+
httpMethod: e.endpoint.httpMethod,
|
|
13442
|
+
path: e.endpoint.path,
|
|
13443
|
+
seedRequirements: e.seedRequirements.map((r) => ({
|
|
13444
|
+
kind: r.kind,
|
|
13445
|
+
param: r.param,
|
|
13446
|
+
javaType: r.javaType
|
|
13447
|
+
}))
|
|
13448
|
+
}));
|
|
13449
|
+
IDEMPOTENT_INSERT = /* @__PURE__ */ new Map([
|
|
13450
|
+
["mysql", { prefix: "IGNORE " }],
|
|
13451
|
+
["mariadb", { prefix: "IGNORE " }],
|
|
13452
|
+
["postgresql", { suffix: " ON CONFLICT DO NOTHING" }]
|
|
13453
|
+
]);
|
|
13454
|
+
BACKSLASH_IS_ESCAPE = /* @__PURE__ */ new Set(["mysql", "mariadb"]);
|
|
13455
|
+
escapeSqlString = (value, dialect) => {
|
|
13456
|
+
const body = BACKSLASH_IS_ESCAPE.has(dialect) ? value.replace(/\\/g, "\\\\").replace(/'/g, "''") : value.replace(/'/g, "''");
|
|
13457
|
+
return `'${body}'`;
|
|
13458
|
+
};
|
|
13459
|
+
sqlLiteral = (value, dialect) => {
|
|
13460
|
+
if (value === null) return "NULL";
|
|
13461
|
+
if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
|
|
13462
|
+
if (typeof value === "number") {
|
|
13463
|
+
if (!Number.isFinite(value)) {
|
|
13464
|
+
throw new Error("runtime-data-seed render: non-finite number (firewall bypassed?)");
|
|
13465
|
+
}
|
|
13466
|
+
return String(value);
|
|
13467
|
+
}
|
|
13468
|
+
return escapeSqlString(value, dialect);
|
|
13469
|
+
};
|
|
13470
|
+
assertIdentifier = (name, what) => {
|
|
13471
|
+
if (!isSqlIdentifier(name)) {
|
|
13472
|
+
throw new Error(`runtime-data-seed render: invalid ${what} identifier (firewall bypassed?)`);
|
|
13473
|
+
}
|
|
13474
|
+
return name;
|
|
13475
|
+
};
|
|
13476
|
+
renderDataSeedSql = (hypothesis, dialect = "generic") => {
|
|
13477
|
+
const statements = [];
|
|
13478
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13479
|
+
const idempotent = IDEMPOTENT_INSERT.get(dialect);
|
|
13480
|
+
for (const target of hypothesis.targets) {
|
|
13481
|
+
if (target.rows.length === 0) {
|
|
13482
|
+
throw new Error("runtime-data-seed render: zero-row target (firewall bypassed?)");
|
|
13483
|
+
}
|
|
13484
|
+
const table = assertIdentifier(target.table, "table");
|
|
13485
|
+
for (const row2 of target.rows) {
|
|
13486
|
+
const columns = Object.keys(row2.columns).sort();
|
|
13487
|
+
if (columns.length === 0) {
|
|
13488
|
+
throw new Error("runtime-data-seed render: zero-column row (firewall bypassed?)");
|
|
13489
|
+
}
|
|
13490
|
+
for (const column of columns) assertIdentifier(column, "column");
|
|
13491
|
+
const values = columns.map((c) => {
|
|
13492
|
+
const v = row2.columns[c];
|
|
13493
|
+
if (v === void 0) {
|
|
13494
|
+
throw new Error("runtime-data-seed render: vanished column value (firewall bypassed?)");
|
|
13495
|
+
}
|
|
13496
|
+
return sqlLiteral(v, dialect);
|
|
13497
|
+
}).join(", ");
|
|
13498
|
+
const insert = `INSERT ${idempotent?.prefix ?? ""}INTO ${table} (${columns.join(", ")}) VALUES (${values})${idempotent?.suffix ?? ""};`;
|
|
13499
|
+
if (seen.has(insert)) continue;
|
|
13500
|
+
seen.add(insert);
|
|
13501
|
+
statements.push(insert);
|
|
13502
|
+
}
|
|
13503
|
+
}
|
|
13504
|
+
const evidenceLines = hypothesis.evidence.map((e) => `-- ${e}`);
|
|
13505
|
+
return [
|
|
13506
|
+
"-- code-sentinel data seed (ADR-0070) \u2014 d\u1EEF li\u1EC7u do runner t\u1EF1 gieo; finding li\xEAn quan d\u1EEF li\u1EC7u",
|
|
13507
|
+
"-- ch\u1EC9 ph\u1EA3n \xE1nh sandbox, KH\xD4NG ph\u1EA3i production.",
|
|
13508
|
+
`-- INSERT-only, idempotent (duplicate-key coi nh\u01B0 th\xE0nh c\xF4ng \u2014 INSERT IGNORE / ON CONFLICT DO NOTHING). Dialect: ${dialect}.`,
|
|
13509
|
+
"-- Gi\u1EA3 thuy\u1EBFt \u0111\u1ECDc t\u1EEB:",
|
|
13510
|
+
...evidenceLines,
|
|
13511
|
+
"",
|
|
13512
|
+
...statements,
|
|
13513
|
+
""
|
|
13514
|
+
].join("\n");
|
|
13515
|
+
};
|
|
13516
|
+
SEED_AUDIT_SENTINEL = "pentest-seed";
|
|
13517
|
+
AUDIT_FIELD_RE = /@(CreatedBy|LastModifiedBy)\s*@Column\s*\(([^)]*)\)\s*private\s+String\s+[A-Za-z_]\w*\s*;/g;
|
|
13518
|
+
CLASS_DECL_RE = /\b(?:class|interface|enum)\s+([A-Za-z_]\w*)/g;
|
|
13519
|
+
TABLE_RE = /@Table\s*\([^)]*?name\s*=\s*"([A-Za-z_]\w*)"/;
|
|
13520
|
+
EXTENDS_RE = /\bextends\s+([A-Za-z_]\w*)/;
|
|
13521
|
+
NULLABLE_FALSE_RE = /nullable\s*=\s*false/;
|
|
13522
|
+
LENGTH_RE = /\blength\s*=\s*(\d+)/;
|
|
13523
|
+
stripJavaComments = (src) => src.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/\/\/[^\n]*/g, " ");
|
|
13524
|
+
group = (m, i) => m[i] ?? "";
|
|
13525
|
+
detectSeedAuditColumns = (files) => {
|
|
13526
|
+
const auditByClass = /* @__PURE__ */ new Map();
|
|
13527
|
+
const tableByClass = /* @__PURE__ */ new Map();
|
|
13528
|
+
const superByClass = /* @__PURE__ */ new Map();
|
|
13529
|
+
for (const file of files) {
|
|
13530
|
+
if (!file.path.endsWith(".java")) continue;
|
|
13531
|
+
const src = stripJavaComments(file.content);
|
|
13532
|
+
const classNames = [];
|
|
13533
|
+
for (const m of src.matchAll(CLASS_DECL_RE)) {
|
|
13534
|
+
const name = group(m, 1);
|
|
13535
|
+
if (name !== "") classNames.push(name);
|
|
13536
|
+
}
|
|
13537
|
+
const auditFields = [];
|
|
13538
|
+
for (const m of src.matchAll(AUDIT_FIELD_RE)) {
|
|
13539
|
+
const args = group(m, 2);
|
|
13540
|
+
if (!NULLABLE_FALSE_RE.test(args)) continue;
|
|
13541
|
+
const columnMatch = /name\s*=\s*"([A-Za-z_]\w*)"/.exec(args);
|
|
13542
|
+
if (columnMatch === null) continue;
|
|
13543
|
+
const column = group(columnMatch, 1);
|
|
13544
|
+
if (column === "") continue;
|
|
13545
|
+
const lengthMatch = LENGTH_RE.exec(args);
|
|
13546
|
+
const length = lengthMatch !== null ? Number.parseInt(group(lengthMatch, 1), 10) : void 0;
|
|
13547
|
+
auditFields.push({ column, length });
|
|
13548
|
+
}
|
|
13549
|
+
if (classNames.length > 0 && auditFields.length > 0) {
|
|
13550
|
+
for (const cls of classNames) auditByClass.set(cls, auditFields);
|
|
13551
|
+
}
|
|
13552
|
+
const tableMatch = TABLE_RE.exec(src);
|
|
13553
|
+
if (tableMatch !== null && classNames.length > 0) {
|
|
13554
|
+
const table = group(tableMatch, 1);
|
|
13555
|
+
if (table !== "") tableByClass.set(classNames[0] ?? "", table);
|
|
13556
|
+
}
|
|
13557
|
+
const extendsMatch = EXTENDS_RE.exec(src);
|
|
13558
|
+
if (extendsMatch !== null && classNames.length > 0) {
|
|
13559
|
+
const sup = group(extendsMatch, 1);
|
|
13560
|
+
if (sup !== "") superByClass.set(classNames[0] ?? "", sup);
|
|
13561
|
+
}
|
|
13562
|
+
}
|
|
13563
|
+
const out = /* @__PURE__ */ new Map();
|
|
13564
|
+
for (const [cls, table] of tableByClass) {
|
|
13565
|
+
const seen = /* @__PURE__ */ new Set([cls]);
|
|
13566
|
+
let current = cls;
|
|
13567
|
+
for (let depth = 0; current !== void 0 && depth <= 5; depth += 1) {
|
|
13568
|
+
const fields = auditByClass.get(current);
|
|
13569
|
+
if (fields !== void 0) {
|
|
13570
|
+
for (const f of fields) {
|
|
13571
|
+
const key = `${table}\0${f.column}`;
|
|
13572
|
+
if (out.has(key)) continue;
|
|
13573
|
+
out.set(key, {
|
|
13574
|
+
table,
|
|
13575
|
+
column: f.column,
|
|
13576
|
+
value: f.length !== void 0 && f.length > 0 ? SEED_AUDIT_SENTINEL.slice(0, f.length) : SEED_AUDIT_SENTINEL
|
|
13577
|
+
});
|
|
13578
|
+
}
|
|
13579
|
+
}
|
|
13580
|
+
const sup = superByClass.get(current);
|
|
13581
|
+
if (sup === void 0 || seen.has(sup)) break;
|
|
13582
|
+
seen.add(sup);
|
|
13583
|
+
current = sup;
|
|
13584
|
+
}
|
|
13585
|
+
}
|
|
13586
|
+
return [...out.values()].sort(
|
|
13587
|
+
(a, b) => a.table === b.table ? a.column.localeCompare(b.column) : a.table.localeCompare(b.table)
|
|
13588
|
+
);
|
|
13589
|
+
};
|
|
13590
|
+
applySeedAuditColumns = (hypothesis, audit) => {
|
|
13591
|
+
if (audit.length === 0) return hypothesis;
|
|
13592
|
+
const byTable = /* @__PURE__ */ new Map();
|
|
13593
|
+
for (const c of audit) {
|
|
13594
|
+
const bucket = byTable.get(c.table);
|
|
13595
|
+
if (bucket) bucket.push(c);
|
|
13596
|
+
else byTable.set(c.table, [c]);
|
|
13597
|
+
}
|
|
13598
|
+
let changed = false;
|
|
13599
|
+
const targets = hypothesis.targets.map((t) => {
|
|
13600
|
+
const cols = byTable.get(t.table);
|
|
13601
|
+
if (cols === void 0) return t;
|
|
13602
|
+
let targetChanged = false;
|
|
13603
|
+
const rows = t.rows.map((row2) => {
|
|
13604
|
+
let rowColumns = row2.columns;
|
|
13605
|
+
for (const c of cols) {
|
|
13606
|
+
if (c.column in rowColumns) continue;
|
|
13607
|
+
rowColumns = { ...rowColumns, [c.column]: c.value };
|
|
13608
|
+
targetChanged = true;
|
|
13609
|
+
}
|
|
13610
|
+
return rowColumns === row2.columns ? row2 : { columns: rowColumns };
|
|
13611
|
+
});
|
|
13612
|
+
if (!targetChanged) return t;
|
|
13613
|
+
changed = true;
|
|
13614
|
+
return { ...t, rows };
|
|
13615
|
+
});
|
|
13616
|
+
return changed ? { ...hypothesis, targets } : hypothesis;
|
|
13617
|
+
};
|
|
13618
|
+
seedAuditAddedColumns = (before, after) => {
|
|
13619
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13620
|
+
for (const t of after.targets) {
|
|
13621
|
+
const prev = before.targets.find((v) => v.table === t.table);
|
|
13622
|
+
if (prev === void 0) continue;
|
|
13623
|
+
const prevKeys = new Set(prev.rows.flatMap((r) => Object.keys(r.columns)));
|
|
13624
|
+
const nowKeys = new Set(t.rows.flatMap((r) => Object.keys(r.columns)));
|
|
13625
|
+
for (const k of nowKeys) {
|
|
13626
|
+
if (!prevKeys.has(k)) seen.add(`${k}\u2192${t.table}`);
|
|
13627
|
+
}
|
|
13628
|
+
}
|
|
13629
|
+
return [...seen];
|
|
13630
|
+
};
|
|
13236
13631
|
REACHABILITY_MANIFEST_SCHEMA_VERSION = 1;
|
|
13237
13632
|
MANIFEST_NOTE = "This manifest LISTS the pre-existing state each endpoint needs to be REACHABLE (a seeded row for a path id, a valid body payload) plus its auth/authz evidence. It does NOT seed anything: schema and entity relationships cannot be inferred from a controller signature, so provisioning stays a human/workflow step (ADR-0065 \xA7D1). Auth/authz fields are EVIDENCE, never a verdict \u2014 an empty annotation list does not mean the route is open.";
|
|
13238
13633
|
SCALAR_JAVA_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -14021,7 +14416,7 @@ ${edgePart}`);
|
|
|
14021
14416
|
if (isEndpointShaped(v)) return `http://${A_SENTINEL}`;
|
|
14022
14417
|
return A_SENTINEL;
|
|
14023
14418
|
};
|
|
14024
|
-
RELAXED_ENV = (path2) => path2.replace(
|
|
14419
|
+
RELAXED_ENV = (path2) => path2.replace(/\./g, "_").replace(/-/g, "").toUpperCase();
|
|
14025
14420
|
envKeyFor = (varName) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(varName) ? varName : RELAXED_ENV(varName);
|
|
14026
14421
|
buildSidecars = (db) => ({
|
|
14027
14422
|
database: {
|
|
@@ -14357,6 +14752,12 @@ ${edgePart}`);
|
|
|
14357
14752
|
SPRING_CLOUD_CONSUL_CONFIG_ENABLED: "false"
|
|
14358
14753
|
};
|
|
14359
14754
|
for (const [k, v] of Object.entries(remoteDisables)) if (!(k in env)) env[k] = v;
|
|
14755
|
+
const appNamesDdlAuto = boot.bootBlockers.some(
|
|
14756
|
+
(b) => /(?:^|\.)ddl-auto$/.test(b.path) || /(?:^|\.)hbm2ddl\.auto$/.test(b.path)
|
|
14757
|
+
);
|
|
14758
|
+
if (!("SPRING_JPA_PROPERTIES_HIBERNATE_HBM2DDL_AUTO" in env) && !appNamesDdlAuto) {
|
|
14759
|
+
env.SPRING_JPA_PROPERTIES_HIBERNATE_HBM2DDL_AUTO = "update";
|
|
14760
|
+
}
|
|
14360
14761
|
const wired = [...placeholders.keys()].filter((k) => wiredKeys.has(k)).length;
|
|
14361
14762
|
const dummied = placeholders.size - wired;
|
|
14362
14763
|
const deviations = [
|
|
@@ -14383,6 +14784,9 @@ ${edgePart}`);
|
|
|
14383
14784
|
`${dummied} unmatched placeholder(s) set to a type-guessed dummy (\`${A_SENTINEL}\` / 0 / 10 / 30000 / false by name) \u2014 REACHABILITY only: a bean that eagerly connects with one still fails at boot, honestly.`
|
|
14384
14785
|
);
|
|
14385
14786
|
deviations.push(...conflicts);
|
|
14787
|
+
deviations.push(
|
|
14788
|
+
"Schema provisioning: SPRING_JPA_PROPERTIES_HIBERNATE_HBM2DDL_AUTO=update \u2014 tables the service's own migration set does not create are generated by Hibernate from its entities (a no-op when the app does not use JPA or binds its SessionFactory in code). The sandbox schema is Hibernate-assisted, NOT the production one."
|
|
14789
|
+
);
|
|
14386
14790
|
return {
|
|
14387
14791
|
env,
|
|
14388
14792
|
deviations,
|
|
@@ -14579,7 +14983,9 @@ ${edgePart}`);
|
|
|
14579
14983
|
const len = bytes.readUInt16BE(p);
|
|
14580
14984
|
p += 2;
|
|
14581
14985
|
if (p + len > bytes.length) return out;
|
|
14582
|
-
out.push(
|
|
14986
|
+
out.push(
|
|
14987
|
+
bytes.toString("utf8", p, p + len).replaceAll("", "{}").replaceAll("", "{}")
|
|
14988
|
+
);
|
|
14583
14989
|
p += len;
|
|
14584
14990
|
break;
|
|
14585
14991
|
}
|
|
@@ -15798,30 +16204,30 @@ ${todos.join("\n")}` : "";
|
|
|
15798
16204
|
const placeholders = plan.boot.bootBlockers.filter(
|
|
15799
16205
|
(b) => b.kind === "unresolved-placeholder" && b.varName !== void 0
|
|
15800
16206
|
);
|
|
15801
|
-
for (const [varName,
|
|
16207
|
+
for (const [varName, group2] of groupBy(placeholders, (b) => b.varName ?? "")) {
|
|
15802
16208
|
if (varName === "") continue;
|
|
15803
|
-
const { evidence: evidence19, omitted } = capEvidence(
|
|
16209
|
+
const { evidence: evidence19, omitted } = capEvidence(group2.map(blockerEvidence));
|
|
15804
16210
|
const isPropertyRef = varName.includes(".");
|
|
15805
16211
|
out.push({
|
|
15806
16212
|
id: `config-value:${varName}`,
|
|
15807
16213
|
category: "config-value",
|
|
15808
16214
|
severity: "substituted",
|
|
15809
16215
|
tierUnlocked: "T2",
|
|
15810
|
-
whatWeNeed: isPropertyRef ? `X\xE1c nh\u1EADn property \`${varName}\` c\xF3 \u0111\u01B0\u1EE3c \u0111\u1ECBnh ngh\u0129a trong config kh\xF4ng (d\xF9ng \u1EDF ${
|
|
16216
|
+
whatWeNeed: isPropertyRef ? `X\xE1c nh\u1EADn property \`${varName}\` c\xF3 \u0111\u01B0\u1EE3c \u0111\u1ECBnh ngh\u0129a trong config kh\xF4ng (d\xF9ng \u1EDF ${group2.length} n\u01A1i).${totalSuffix(group2.length, omitted)}` : `Gi\xE1 tr\u1ECB cho bi\u1EBFn m\xF4i tr\u01B0\u1EDDng \`${varName}\` (d\xF9ng \u1EDF ${group2.length} property).${totalSuffix(group2.length, omitted)}`,
|
|
15811
16217
|
whyItBlocks: isPropertyRef ? "T\xEAn c\xF3 d\u1EA5u ch\u1EA5m \u21D2 \u0111\xE2y l\xE0 THAM CHI\u1EBEU PROPERTY c\u1EE7a Spring, kh\xF4ng ph\u1EA3i bi\u1EBFn m\xF4i tr\u01B0\u1EDDng: Spring t\u1EF1 gi\u1EA3i n\xF3 t\u1EEB ch\xEDnh config n\u1EBFu property \u0111\xF3 t\u1ED3n t\u1EA1i. C\xF4ng c\u1EE5 li\u1EC7t k\xEA v\xEC n\xF3 kh\xF4ng c\xF3 default; n\u1EBFu property \u0111\xE3 \u0111\u01B0\u1EE3c \u0111\u1ECBnh ngh\u0129a th\xEC KH\xD4NG c\u1EA7n g\u1EEDi g\xEC c\u1EA3." : "Placeholder kh\xF4ng c\xF3 default th\xEC Spring d\u1EEBng ngay khi bind. C\xF4ng c\u1EE5 \u0110\xC3 \u0111i\u1EC1n m\u1ED9t gi\xE1 tr\u1ECB theo h\xECnh d\u1EA1ng v\u1ECB tr\xED c\u1EE7a n\xF3, n\xEAn boot v\u1EABn \u0111\u01B0\u1EE3c th\u1EED \u2014 nh\u01B0ng m\u1ED9t bean n\u1ED1i eager s\u1EBD ch\u1EBFt v\u1EDBi gi\xE1 tr\u1ECB gi\u1EA3, v\xE0 ch\u1EC9 l\xFAc ch\u1EA1y m\u1EDBi bi\u1EBFt.",
|
|
15812
16218
|
evidence: evidence19,
|
|
15813
16219
|
howToProvide: isPropertyRef ? `N\u1EBFu property ch\u01B0a c\xF3, \u0111\u1EB7t \`values.${varName}\` trong \`code-sentinel-runtime.yaml\`; n\u1EBFu \u0111\xE3 c\xF3 th\xEC b\u1ECF qua d\xF2ng n\xE0y.` : `\u0110\u1EB7t \`values.${varName}\` trong \`code-sentinel-runtime.yaml\`. Gi\xE1 tr\u1ECB d\xF9ng-m\u1ED9t-l\u1EA7n l\xE0 \u0111\u1EE7; n\xF3 kh\xF4ng r\u1EDDi sandbox v\xE0 kh\xF4ng v\xE0o b\xE1o c\xE1o.`
|
|
15814
16220
|
});
|
|
15815
16221
|
}
|
|
15816
16222
|
const encrypted = plan.boot.bootBlockers.filter((b) => b.kind === "encrypted-value");
|
|
15817
|
-
for (const [path2,
|
|
15818
|
-
const { evidence: evidence19, omitted } = capEvidence(
|
|
16223
|
+
for (const [path2, group2] of groupBy(encrypted, (b) => b.path === "" ? b.key : b.path)) {
|
|
16224
|
+
const { evidence: evidence19, omitted } = capEvidence(group2.map(blockerEvidence));
|
|
15819
16225
|
out.push({
|
|
15820
16226
|
id: `secret-value:${path2}`,
|
|
15821
16227
|
category: "secret-value",
|
|
15822
16228
|
severity: "substituted",
|
|
15823
16229
|
tierUnlocked: "T2",
|
|
15824
|
-
whatWeNeed: `Gi\xE1 tr\u1ECB PLAINTEXT d\xF9ng-m\u1ED9t-l\u1EA7n cho \`${path2}\` (\u0111ang l\xE0 \`ENC(...)\` jasypt).${totalSuffix(
|
|
16230
|
+
whatWeNeed: `Gi\xE1 tr\u1ECB PLAINTEXT d\xF9ng-m\u1ED9t-l\u1EA7n cho \`${path2}\` (\u0111ang l\xE0 \`ENC(...)\` jasypt).${totalSuffix(group2.length, omitted)}`,
|
|
15825
16231
|
whyItBlocks: "Kh\xF4ng c\xF3 m\u1EADt kh\u1EA9u jasypt th\xEC kh\xF4ng gi\u1EA3i m\xE3 \u0111\u01B0\u1EE3c, v\xE0 m\u1EADt kh\u1EA9u \u0111\xF3 kh\xF4ng n\u1EB1m trong archive \u2014 \u0111\xE2y l\xE0 gi\u1EDBi h\u1EA1n TH\xD4NG TIN, kh\xF4ng ph\u1EA3i gi\u1EDBi h\u1EA1n c\xF4ng c\u1EE5. C\xF4ng c\u1EE5 \u0110\xC3 thay b\u1EB1ng sentinel (ho\u1EB7c \u0111\u1ECBa ch\u1EC9 sidecar n\u1EBFu property n\xE0y l\xE0 endpoint datastore), n\xEAn boot v\u1EABn \u0111\u01B0\u1EE3c th\u1EED; gi\xE1 tr\u1ECB th\u1EADt ch\u1EC9 c\u1EA7n khi bean n\u1ED1i eager t\u1EDBi \u0111\xFAng ch\u1ED7 \u0111\xF3.",
|
|
15826
16232
|
evidence: evidence19,
|
|
15827
16233
|
howToProvide: `\u0110\u1EB7t \`values.${path2}\` (gi\xE1 tr\u1ECB t\u1EA1m, tr\u1ECF v\xE0o sidecar d\xF9ng-m\u1ED9t-l\u1EA7n l\xE0 \u0111\u01B0\u1EE3c), HO\u1EB6C c\u1EA5p m\u1EADt kh\u1EA9u jasypt qua \`values.jasypt.encryptor.password\`.`
|
|
@@ -18622,9 +19028,9 @@ ${methods.join("\n\n")}
|
|
|
18622
19028
|
});
|
|
18623
19029
|
continue;
|
|
18624
19030
|
}
|
|
18625
|
-
const
|
|
18626
|
-
for (const route of routes)
|
|
18627
|
-
byChecklist.set(scenario.checklistId,
|
|
19031
|
+
const group2 = byChecklist.get(scenario.checklistId) ?? [];
|
|
19032
|
+
for (const route of routes) group2.push({ scenario, route });
|
|
19033
|
+
byChecklist.set(scenario.checklistId, group2);
|
|
18628
19034
|
}
|
|
18629
19035
|
const tests = [...byChecklist.entries()].sort(([a], [b]) => Number(a) - Number(b)).map(([checklistId, pairs]) => {
|
|
18630
19036
|
const sorted = [...pairs].sort(
|
|
@@ -18926,6 +19332,7 @@ ${methods.join("\n\n")}
|
|
|
18926
19332
|
}));
|
|
18927
19333
|
return { packets, meta, ...unassessed !== void 0 ? { unassessed } : {} };
|
|
18928
19334
|
};
|
|
19335
|
+
OBJECT_STORE_PROBE_SINKS = /* @__PURE__ */ new Set(["spring/minio-object"]);
|
|
18929
19336
|
GENERATED_PACKAGE = "com.codesentinel.generated.pentest";
|
|
18930
19337
|
SERVER_CLASSES = /* @__PURE__ */ new Set([
|
|
18931
19338
|
"sql-injection",
|
|
@@ -19043,17 +19450,55 @@ ${methods.join("\n\n")}
|
|
|
19043
19450
|
};
|
|
19044
19451
|
javaStr = (s) => s.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
19045
19452
|
BENIGN_SEED = "1";
|
|
19453
|
+
BUCKET_BENIGN_SEED = "pentest-bucket";
|
|
19454
|
+
benignSeedFor = (paramName2) => /bucket/i.test(paramName2) ? BUCKET_BENIGN_SEED : BENIGN_SEED;
|
|
19046
19455
|
renderAuthSuffix = (auth) => {
|
|
19047
19456
|
if (!auth || auth.kind !== "authenticated") return "";
|
|
19048
19457
|
const roles = auth.roles && auth.roles.length > 0 ? auth.roles : ["USER"];
|
|
19049
19458
|
const args = roles.map((r) => `"${javaStr(r)}"`).join(", ");
|
|
19050
19459
|
return `.with(user("pentest").roles(${args}))`;
|
|
19051
19460
|
};
|
|
19461
|
+
RUNTIME_AUTH_SUFFIX = '.header("Authorization", "Bearer " + csRuntimeToken()).with(csServletPathFromUri())';
|
|
19462
|
+
renderRuntimeAuthHelper = (envVar) => [
|
|
19463
|
+
" /**",
|
|
19464
|
+
` * ADR-0070: token runtime do pipeline mint qua bi\u1EBFn m\xF4i tr\u01B0\u1EDDng ${envVar}, g\u1EAFn v\xE0o M\u1ECCI`,
|
|
19465
|
+
" * request c\u1EE7a suite (baseline + attack). R\u1ED7ng/sai \u21D2 baseline b\u1ECB t\u1EEB ch\u1ED1i (4xx) \u21D2 test",
|
|
19466
|
+
" * skipped \u21D2 `not-tested` (\xA7D1). Suite KH\xD4NG t\u1EF1 mint v\xE0 KH\xD4NG bao gi\u1EDD in gi\xE1 tr\u1ECB token",
|
|
19467
|
+
" * (\xA7D1/#48).",
|
|
19468
|
+
" */",
|
|
19469
|
+
" private static String csRuntimeToken() {",
|
|
19470
|
+
` String t = System.getenv("${javaStr(envVar)}");`,
|
|
19471
|
+
' return t == null ? "" : t;',
|
|
19472
|
+
" }",
|
|
19473
|
+
"",
|
|
19474
|
+
" /**",
|
|
19475
|
+
" * ADR-0070 (MEASURED, E1 lane run ptr_mtlepy7l): MockMvc ch\u1EC9 set requestURI \u2014",
|
|
19476
|
+
" * getServletPath() r\u1ED7ng, v\xE0 filter ph\xE2n quy\u1EC1n ki\u1EC3u dvs (UserContextFilter \u2192",
|
|
19477
|
+
" * RedisAbstract.checkAccess) fail-closed khi path r\u1ED7ng \u21D2 403 d\xF9 token \u0111\xFAng. Helper",
|
|
19478
|
+
" * mirror requestURI (tr\u1EEB contextPath n\u1EBFu c\xF3) v\xE0o servletPath CH\u1EC8 KHI n\xF3 r\u1ED7ng \u2014",
|
|
19479
|
+
" * kh\xF4ng bao gi\u1EDD ghi \u0111\xE8 gi\xE1 tr\u1ECB container \u0111\xE3 set. Reachability-only (\xA7D1).",
|
|
19480
|
+
" */",
|
|
19481
|
+
" private static RequestPostProcessor csServletPathFromUri() {",
|
|
19482
|
+
" return request -> {",
|
|
19483
|
+
" MockHttpServletRequest req = (MockHttpServletRequest) request;",
|
|
19484
|
+
" if (req.getServletPath() == null || req.getServletPath().isEmpty()) {",
|
|
19485
|
+
" String uri = req.getRequestURI();",
|
|
19486
|
+
" String ctx = req.getContextPath();",
|
|
19487
|
+
" if (ctx != null && !ctx.isEmpty() && uri != null && uri.startsWith(ctx)) {",
|
|
19488
|
+
" uri = uri.substring(ctx.length());",
|
|
19489
|
+
" }",
|
|
19490
|
+
' req.setServletPath(uri == null ? "" : uri);',
|
|
19491
|
+
" }",
|
|
19492
|
+
" return req;",
|
|
19493
|
+
" };",
|
|
19494
|
+
" }"
|
|
19495
|
+
].join("\n");
|
|
19052
19496
|
pascal = (slug) => slug.split(/[-_]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join("");
|
|
19053
19497
|
camel2 = (slug) => {
|
|
19054
19498
|
const p = pascal(slug);
|
|
19055
19499
|
return p.charAt(0).toLowerCase() + p.slice(1);
|
|
19056
19500
|
};
|
|
19501
|
+
verificationTestClassName = (vulnerabilityClass, checklistId) => `${pascal(vulnerabilityClass)}${checklistId}VerificationTest`;
|
|
19057
19502
|
identChunk = (raw) => {
|
|
19058
19503
|
const parts = raw.replace(/\{[^}]*\}/g, " ").split(/[^A-Za-z0-9]+/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1));
|
|
19059
19504
|
return parts.join("");
|
|
@@ -19063,19 +19508,26 @@ ${methods.join("\n\n")}
|
|
|
19063
19508
|
if (/\{[^}]+\}/.test(path2)) return path2.replace(/\{[^}]+\}/, encoded);
|
|
19064
19509
|
return `${path2.replace(/\/$/, "")}/${encoded}`;
|
|
19065
19510
|
};
|
|
19066
|
-
|
|
19511
|
+
companionCalls = (companions) => companions.filter((c) => c.kind === "query" || c.kind === "header").map(
|
|
19512
|
+
(c) => c.kind === "query" ? `.param("${javaStr(c.name)}", "${javaStr(benignSeedFor(c.name))}")` : `.header("${javaStr(c.name)}", "${javaStr(benignSeedFor(c.name))}")`
|
|
19513
|
+
).join("");
|
|
19514
|
+
requestExpr = (method, path2, injection, payload, companions = []) => {
|
|
19067
19515
|
const m = `HttpMethod.${(method === "ANY" ? "GET" : method).toUpperCase()}`;
|
|
19516
|
+
const extra = companionCalls(companions);
|
|
19068
19517
|
switch (injection.kind) {
|
|
19069
19518
|
case "query":
|
|
19070
19519
|
return {
|
|
19071
|
-
expr: `request(${m}, "${javaStr(path2)}").param("${javaStr(injection.name)}", "${javaStr(payload)}")`,
|
|
19520
|
+
expr: `request(${m}, "${javaStr(path2)}").param("${javaStr(injection.name)}", "${javaStr(payload)}")${extra}`,
|
|
19072
19521
|
usesMediaType: false
|
|
19073
19522
|
};
|
|
19074
19523
|
case "path":
|
|
19075
|
-
return {
|
|
19524
|
+
return {
|
|
19525
|
+
expr: `request(${m}, "${javaStr(fillPath(path2, payload))}")${extra}`,
|
|
19526
|
+
usesMediaType: false
|
|
19527
|
+
};
|
|
19076
19528
|
case "header":
|
|
19077
19529
|
return {
|
|
19078
|
-
expr: `request(${m}, "${javaStr(path2)}").header("${javaStr(injection.name)}", "${javaStr(payload)}")`,
|
|
19530
|
+
expr: `request(${m}, "${javaStr(path2)}").header("${javaStr(injection.name)}", "${javaStr(payload)}")${extra}`,
|
|
19079
19531
|
usesMediaType: false
|
|
19080
19532
|
};
|
|
19081
19533
|
case "body":
|
|
@@ -19090,7 +19542,7 @@ ${methods.join("\n\n")}
|
|
|
19090
19542
|
isVerifiable = (s) => SERVER_CLASSES.has(s.vulnerabilityClass) && s.path !== null && s.injectionPoint !== null;
|
|
19091
19543
|
SERVER_SKIP_REASON = "Kh\xF4ng gi\u1EA3i \u0111\u01B0\u1EE3c HTTP entry point / injection point cho sink \u2014 ki\u1EC3m tra th\u1EE7 c\xF4ng (kh\xF4ng sinh \u0111\u01B0\u1EE3c MockMvc request).";
|
|
19092
19544
|
renderBooleanBlind = (s, path2, injection, authSuffix) => {
|
|
19093
|
-
const capture = (payload) => `mockMvc.perform(${requestExpr(s.httpMethod, path2, injection, payload).expr}${authSuffix}).andReturn().getResponse().getContentAsString()`;
|
|
19545
|
+
const capture = (payload) => `mockMvc.perform(${requestExpr(s.httpMethod, path2, injection, payload, s.companionParams ?? []).expr}${authSuffix}).andReturn().getResponse().getContentAsString()`;
|
|
19094
19546
|
const lines = [
|
|
19095
19547
|
" // E1.7 ([ADR-0041]): boolean-based blind SQLi \u2014 vi sai 3 ph\u1EA3n h\u1ED3i qua canon()",
|
|
19096
19548
|
" // (\u0111i\u1EC1u ki\u1EC7n lu\xF4n-\u0111\xFAng KH\u1EDAP baseline l\xE0nh, lu\xF4n-sai KH\xC1C \u21D2 WHERE b\u1ECB thao t\xFAng)."
|
|
@@ -19113,7 +19565,13 @@ ${methods.join("\n\n")}
|
|
|
19113
19565
|
return lines;
|
|
19114
19566
|
};
|
|
19115
19567
|
renderCanary = (s, path2, injection, authSuffix, canary) => {
|
|
19116
|
-
const expr = requestExpr(
|
|
19568
|
+
const expr = requestExpr(
|
|
19569
|
+
s.httpMethod,
|
|
19570
|
+
path2,
|
|
19571
|
+
injection,
|
|
19572
|
+
canary.payload,
|
|
19573
|
+
s.companionParams ?? []
|
|
19574
|
+
).expr;
|
|
19117
19575
|
const marker = javaStr(canary.reflected);
|
|
19118
19576
|
return [
|
|
19119
19577
|
` // E1.7 ([ADR-0041]): canary ph\u1EA3n chi\u1EBFu ${canary.payload} \u2192 ${canary.reflected} (${canary.note}).`,
|
|
@@ -19123,16 +19581,73 @@ ${methods.join("\n\n")}
|
|
|
19123
19581
|
` "Ph\u1EA3n h\u1ED3i ch\u1EE9a k\u1EBFt qu\u1EA3 ${canary.payload}=${canary.reflected} (kh\xF4ng c\xF3 \u1EDF baseline) \u2014 bi\u1EC3u th\u1EE9c \u0111\xE3 \u0111\u01B0\u1EE3c \u0110\xC1NH GI\xC1 (SSTI) (#${s.checklistId}). X\xE1c nh\u1EADn th\u1EE7 c\xF4ng.");`
|
|
19124
19582
|
];
|
|
19125
19583
|
};
|
|
19126
|
-
|
|
19584
|
+
isObjectStoreProbeSink = (s) => s.sinkId !== void 0 && OBJECT_STORE_PROBE_SINKS.has(s.sinkId);
|
|
19585
|
+
OBJECT_STORE_REJECT_CATCH_LINES = (checklistId) => [
|
|
19586
|
+
" } catch (Exception rejected) {",
|
|
19587
|
+
" // [ADR-0071 \xA7Validation] payload traversal l\xE0 bucket name b\u1EA5t h\u1EE3p l\u1EC7 v\u1EC1 c\u1EA5u tr\xFAc \u2014",
|
|
19588
|
+
" // SDK MinIO/S3 t\u1EEB ch\u1ED1i CLIENT-SIDE (IllegalArgumentException) tr\u01B0\u1EDBc m\u1ECDi network I/O.",
|
|
19589
|
+
` // \u0110\u1ECDc nh\u01B0 "attack b\u1ECB reject" (kh\xF4ng ph\u1EA3i crash) \u0111\u1EC3 testcase pass v\xE0 probe canary #${checklistId}`,
|
|
19590
|
+
" // b\u1EAFn \u0111\u01B0\u1EE3c; exception kh\xE1c (infra/app bug th\u1EADt) rethrow \u21D2 `<error` \u21D2 probe fail-closed.",
|
|
19591
|
+
" boolean clientSideReject = false;",
|
|
19592
|
+
" for (Throwable c = rejected; c != null; c = c.getCause()) {",
|
|
19593
|
+
" if (c instanceof java.lang.IllegalArgumentException) { clientSideReject = true; break; }",
|
|
19594
|
+
" }",
|
|
19595
|
+
" if (!clientSideReject) throw rejected;"
|
|
19596
|
+
];
|
|
19597
|
+
wrapObjectStoreAttackGuard = (lines, checklistId) => {
|
|
19598
|
+
const start = lines.findIndex((line) => line.startsWith(" mockMvc.perform("));
|
|
19599
|
+
if (start < 0) return lines;
|
|
19600
|
+
const end = lines.indexOf(" });", start);
|
|
19601
|
+
if (end < 0) return lines;
|
|
19602
|
+
return [
|
|
19603
|
+
...lines.slice(0, start),
|
|
19604
|
+
" try {",
|
|
19605
|
+
...lines.slice(start, end + 1).map((line) => ` ${line}`),
|
|
19606
|
+
...OBJECT_STORE_REJECT_CATCH_LINES(checklistId),
|
|
19607
|
+
" }",
|
|
19608
|
+
...lines.slice(end + 1)
|
|
19609
|
+
];
|
|
19610
|
+
};
|
|
19611
|
+
wrapObjectStoreEvidenceAttackGuard = (lines, checklistId) => {
|
|
19612
|
+
const start = lines.findIndex(
|
|
19613
|
+
(line) => line.startsWith(" MvcResult attackResult = mockMvc.perform(")
|
|
19614
|
+
);
|
|
19615
|
+
if (start < 0) return lines;
|
|
19616
|
+
const inner = lines.slice(start, start + 3).map(
|
|
19617
|
+
(line) => line.replace(/^ {8}int attackStatus = /, " attackStatus = ").replace(/^ {8}String attackBody = /, " attackBody = ").replace(/^/, " ")
|
|
19618
|
+
);
|
|
19619
|
+
return [
|
|
19620
|
+
...lines.slice(0, start),
|
|
19621
|
+
" int attackStatus;",
|
|
19622
|
+
" String attackBody;",
|
|
19623
|
+
" try {",
|
|
19624
|
+
...inner,
|
|
19625
|
+
...OBJECT_STORE_REJECT_CATCH_LINES(checklistId),
|
|
19626
|
+
" // Ghi nh\u01B0 validation-reject: attack b\u1ECB SDK ch\u1EB7n TR\u01AF\u1EDAC khi ch\u1EA1m store \u2014 400",
|
|
19627
|
+
' // (kh\xF4ng ph\u1EA3i 5xx) \u21D2 noCrash=true, negative \u0111\xFAng ngh\u0129a "\u0111\xE3 t\u1EEB ch\u1ED1i", envelope v\u1EABn ghi.',
|
|
19628
|
+
" attackStatus = 400;",
|
|
19629
|
+
' attackBody = "";',
|
|
19630
|
+
" }",
|
|
19631
|
+
...lines.slice(start + 3)
|
|
19632
|
+
];
|
|
19633
|
+
};
|
|
19634
|
+
renderMethod2 = (s, methodName, fill, runtimeAuth) => {
|
|
19127
19635
|
const path2 = s.path;
|
|
19128
19636
|
const injection = s.injectionPoint;
|
|
19129
19637
|
const payload = s.payloads[0] ?? "";
|
|
19130
|
-
const attack = requestExpr(s.httpMethod, path2, injection, payload);
|
|
19131
|
-
const baseline = requestExpr(
|
|
19132
|
-
|
|
19638
|
+
const attack = requestExpr(s.httpMethod, path2, injection, payload, s.companionParams ?? []);
|
|
19639
|
+
const baseline = requestExpr(
|
|
19640
|
+
s.httpMethod,
|
|
19641
|
+
path2,
|
|
19642
|
+
injection,
|
|
19643
|
+
benignSeedFor(injection.name),
|
|
19644
|
+
s.companionParams ?? []
|
|
19645
|
+
);
|
|
19646
|
+
const authSuffix = fill?.suffix ?? (runtimeAuth !== void 0 ? RUNTIME_AUTH_SUFFIX : renderAuthSuffix(s.authContext));
|
|
19133
19647
|
const hasAuth = authSuffix !== "";
|
|
19134
19648
|
const usesFillSuffix = fill?.suffix !== void 0;
|
|
19135
|
-
const
|
|
19649
|
+
const usesRuntimeAuth = !usesFillSuffix && runtimeAuth !== void 0;
|
|
19650
|
+
const usesSecurity = hasAuth && !usesFillSuffix && !usesRuntimeAuth;
|
|
19136
19651
|
const fillImports = usesFillSuffix ? fill?.imports ?? [] : [];
|
|
19137
19652
|
const usesMediaType = attack.usesMediaType || baseline.usesMediaType;
|
|
19138
19653
|
const others = s.payloads.slice(1);
|
|
@@ -19143,8 +19658,8 @@ ${methods.join("\n\n")}
|
|
|
19143
19658
|
const contentLine = oracle !== void 0 ? `
|
|
19144
19659
|
* n\u1ED9i dung: FAIL n\u1EBFu body T\u1EA4N C\xD4NG l\u1ED9 [${oracle.leakMarkers.join(" | ")}] m\xE0 baseline l\xE0nh KH\xD4NG c\xF3 (${oracle.note})` : "";
|
|
19145
19660
|
const roleCount = s.authContext?.roles?.length ?? 0;
|
|
19146
|
-
const authNote = hasAuth ? usesFillSuffix ? "\n * Auth: principal qua auth-fill LLM slot-fill (ADR-0045) \u2014 E1.5 t\u1EA5t \u0111\u1ECBnh ch\u01B0a suy \u0111\u01B0\u1EE3c (vd @VauthzCheck/OAuth2). Fill sai \u21D2 baseline 4xx \u21D2 not-tested (\xA7D1)." : `
|
|
19147
|
-
* Auth: principal \`pentest\`${roleCount > 0 ? ` roles ${s.authContext?.roles?.join("/")}` : " role USER (suy \u0111o\xE1n)"} \u2014 endpoint c\xF3 authz annotation (E1.5)
|
|
19661
|
+
const authNote = !hasAuth ? "" : usesFillSuffix ? "\n * Auth: principal qua auth-fill LLM slot-fill (ADR-0045) \u2014 E1.5 t\u1EA5t \u0111\u1ECBnh ch\u01B0a suy \u0111\u01B0\u1EE3c (vd @VauthzCheck/OAuth2). Fill sai \u21D2 baseline 4xx \u21D2 not-tested (\xA7D1)." : usesRuntimeAuth ? "\n * Auth: Bearer runtime (ADR-0070) \u2014 token TH\u1EACT t\u1EEB $CS_RUNTIME_TOKEN do pipeline mint; r\u1ED7ng/sai \u21D2 baseline 4xx \u21D2 not-tested (\xA7D1)." : `
|
|
19662
|
+
* Auth: principal \`pentest\`${roleCount > 0 ? ` roles ${s.authContext?.roles?.join("/")}` : " role USER (suy \u0111o\xE1n)"} \u2014 endpoint c\xF3 authz annotation (E1.5).`;
|
|
19148
19663
|
const contentAssertions = oracle === void 0 ? [] : [
|
|
19149
19664
|
" String body = result.getResponse().getContentAsString();",
|
|
19150
19665
|
...oracle.leakMarkers.flatMap((marker) => [
|
|
@@ -19164,7 +19679,7 @@ ${methods.join("\n\n")}
|
|
|
19164
19679
|
const canary = hasOracle ? CLASS_CANARY[s.vulnerabilityClass] : void 0;
|
|
19165
19680
|
const canaryLines = canary ? renderCanary(s, path2, injection, authSuffix, canary) : [];
|
|
19166
19681
|
const usesCanon = blindLines.length > 0;
|
|
19167
|
-
const
|
|
19682
|
+
const codeLines = [
|
|
19168
19683
|
" /**",
|
|
19169
19684
|
` * #${s.checklistId} ${s.title}`,
|
|
19170
19685
|
` * Sink: ${s.sinkFile}:${s.sinkLine} \xB7 \u0111i\u1EC3m ti\xEAm: ${injection.kind} \`${injection.name}\``,
|
|
@@ -19190,19 +19705,27 @@ ${methods.join("\n\n")}
|
|
|
19190
19705
|
...blindLines,
|
|
19191
19706
|
...canaryLines,
|
|
19192
19707
|
" }"
|
|
19193
|
-
]
|
|
19708
|
+
];
|
|
19709
|
+
const code2 = (isObjectStoreProbeSink(s) ? wrapObjectStoreAttackGuard(codeLines, s.checklistId) : codeLines).join("\n");
|
|
19194
19710
|
return { code: code2, usesMediaType, usesSecurity, usesMvcResult: hasOracle, usesCanon, fillImports };
|
|
19195
19711
|
};
|
|
19196
|
-
renderEvidenceMethod = (s, methodName, className, fill) => {
|
|
19712
|
+
renderEvidenceMethod = (s, methodName, className, fill, runtimeAuth) => {
|
|
19197
19713
|
const path2 = s.path;
|
|
19198
19714
|
const injection = s.injectionPoint;
|
|
19199
19715
|
const payload = s.payloads[0] ?? "";
|
|
19200
|
-
const attack = requestExpr(s.httpMethod, path2, injection, payload);
|
|
19201
|
-
const baseline = requestExpr(
|
|
19202
|
-
|
|
19716
|
+
const attack = requestExpr(s.httpMethod, path2, injection, payload, s.companionParams ?? []);
|
|
19717
|
+
const baseline = requestExpr(
|
|
19718
|
+
s.httpMethod,
|
|
19719
|
+
path2,
|
|
19720
|
+
injection,
|
|
19721
|
+
benignSeedFor(injection.name),
|
|
19722
|
+
s.companionParams ?? []
|
|
19723
|
+
);
|
|
19724
|
+
const authSuffix = fill?.suffix ?? (runtimeAuth !== void 0 ? RUNTIME_AUTH_SUFFIX : renderAuthSuffix(s.authContext));
|
|
19203
19725
|
const hasAuth = authSuffix !== "";
|
|
19204
19726
|
const usesFillSuffix = fill?.suffix !== void 0;
|
|
19205
|
-
const
|
|
19727
|
+
const usesRuntimeAuth = !usesFillSuffix && runtimeAuth !== void 0;
|
|
19728
|
+
const usesSecurity = hasAuth && !usesFillSuffix && !usesRuntimeAuth;
|
|
19206
19729
|
const fillImports = usesFillSuffix ? fill?.imports ?? [] : [];
|
|
19207
19730
|
const usesMediaType = attack.usesMediaType || baseline.usesMediaType;
|
|
19208
19731
|
const oracle = CLASS_ORACLE[s.vulnerabilityClass];
|
|
@@ -19212,7 +19735,7 @@ ${methods.join("\n\n")}
|
|
|
19212
19735
|
const usesBlind = BOOLEAN_BLIND_CLASSES.has(s.vulnerabilityClass);
|
|
19213
19736
|
const blindLines = [];
|
|
19214
19737
|
if (usesBlind) {
|
|
19215
|
-
const cap = (pl2) => `mockMvc.perform(${requestExpr(s.httpMethod, path2, injection, pl2).expr}${authSuffix}).andReturn().getResponse().getContentAsString()`;
|
|
19738
|
+
const cap = (pl2) => `mockMvc.perform(${requestExpr(s.httpMethod, path2, injection, pl2, s.companionParams ?? []).expr}${authSuffix}).andReturn().getResponse().getContentAsString()`;
|
|
19216
19739
|
const conds = [];
|
|
19217
19740
|
for (const pair of BOOLEAN_BLIND_PAIRS) {
|
|
19218
19741
|
const tVar = `blindTrue${pascal(pair.label)}`;
|
|
@@ -19228,7 +19751,13 @@ ${methods.join("\n\n")}
|
|
|
19228
19751
|
const canary = CLASS_CANARY[s.vulnerabilityClass];
|
|
19229
19752
|
const canaryLines = [];
|
|
19230
19753
|
if (canary) {
|
|
19231
|
-
const expr = requestExpr(
|
|
19754
|
+
const expr = requestExpr(
|
|
19755
|
+
s.httpMethod,
|
|
19756
|
+
path2,
|
|
19757
|
+
injection,
|
|
19758
|
+
canary.payload,
|
|
19759
|
+
s.companionParams ?? []
|
|
19760
|
+
).expr;
|
|
19232
19761
|
const marker = javaStr(canary.reflected);
|
|
19233
19762
|
canaryLines.push(
|
|
19234
19763
|
` String canaryBody = mockMvc.perform(${expr}${authSuffix}).andReturn().getResponse().getContentAsString();`
|
|
@@ -19240,7 +19769,13 @@ ${methods.join("\n\n")}
|
|
|
19240
19769
|
const commandLines = [];
|
|
19241
19770
|
if (s.vulnerabilityClass === "command-injection") {
|
|
19242
19771
|
const probePayload = `${BENIGN_SEED}; echo ${COMMAND_CANARY}`;
|
|
19243
|
-
const expr = requestExpr(
|
|
19772
|
+
const expr = requestExpr(
|
|
19773
|
+
s.httpMethod,
|
|
19774
|
+
path2,
|
|
19775
|
+
injection,
|
|
19776
|
+
probePayload,
|
|
19777
|
+
s.companionParams ?? []
|
|
19778
|
+
).expr;
|
|
19244
19779
|
commandLines.push(
|
|
19245
19780
|
` // slice #4: canary ph\u1EA3n chi\u1EBFu output l\u1EC7nh \u2014 '${COMMAND_CANARY}' trong body \u21D2 shell \u0111\xE3 ch\u1EA1y l\u1EC7nh ti\xEAm.`
|
|
19246
19781
|
);
|
|
@@ -19252,7 +19787,7 @@ ${methods.join("\n\n")}
|
|
|
19252
19787
|
const hasNegative = ORACLE_CATALOG[s.vulnerabilityClass]?.negativeOracleId !== void 0;
|
|
19253
19788
|
const negExpr = !hasNegative ? "false" : VALIDATION_REJECT_CLASSES2.has(s.vulnerabilityClass) ? "baselineReached && attackStatus >= 400 && attackStatus < 500" : "baselineReached && noCrash && !positive";
|
|
19254
19789
|
const scenarioId = `${className}::${methodName}`;
|
|
19255
|
-
const
|
|
19790
|
+
const codeLines = [
|
|
19256
19791
|
" /**",
|
|
19257
19792
|
` * #${s.checklistId} ${s.title}`,
|
|
19258
19793
|
` * Sink: ${s.sinkFile}:${s.sinkLine} \xB7 \u0111i\u1EC3m ti\xEAm: ${injection.kind} \`${injection.name}\``,
|
|
@@ -19287,7 +19822,8 @@ ${methods.join("\n\n")}
|
|
|
19287
19822
|
" Assertions.assertFalse(!noCrash || positive,",
|
|
19288
19823
|
` "T\u1EA5n c\xF4ng (#${s.checklistId}): crash 5xx HO\u1EB6C oracle d\u01B0\u01A1ng \u2014 nghi khai th\xE1c. Verdict chu\u1EA9n: cs verify --evidence. X\xE1c nh\u1EADn th\u1EE7 c\xF4ng.");`,
|
|
19289
19824
|
" }"
|
|
19290
|
-
]
|
|
19825
|
+
];
|
|
19826
|
+
const code2 = (isObjectStoreProbeSink(s) ? wrapObjectStoreEvidenceAttackGuard(codeLines, s.checklistId) : codeLines).join("\n");
|
|
19291
19827
|
return {
|
|
19292
19828
|
code: code2,
|
|
19293
19829
|
usesMediaType,
|
|
@@ -19405,13 +19941,84 @@ ${methods.join("\n\n")}
|
|
|
19405
19941
|
" return value;",
|
|
19406
19942
|
" }"
|
|
19407
19943
|
].join("\n");
|
|
19408
|
-
|
|
19944
|
+
javaSeedValue = (v) => {
|
|
19945
|
+
if (v === null) return "null";
|
|
19946
|
+
if (typeof v === "boolean") return v ? "true" : "false";
|
|
19947
|
+
if (typeof v === "number") {
|
|
19948
|
+
if (!Number.isFinite(v)) {
|
|
19949
|
+
throw new Error(
|
|
19950
|
+
"runtime-data-seed @BeforeAll render: non-finite number (firewall bypassed?)"
|
|
19951
|
+
);
|
|
19952
|
+
}
|
|
19953
|
+
return String(v);
|
|
19954
|
+
}
|
|
19955
|
+
return `"${javaStr(v)}"`;
|
|
19956
|
+
};
|
|
19957
|
+
renderSeedMethod = (targets) => {
|
|
19958
|
+
const updateLines = [];
|
|
19959
|
+
for (const target of targets) {
|
|
19960
|
+
if (target.rows.length === 0) {
|
|
19961
|
+
throw new Error("runtime-data-seed @BeforeAll render: zero-row target (firewall bypassed?)");
|
|
19962
|
+
}
|
|
19963
|
+
const table = isSqlIdentifier(target.table) ? target.table : (() => {
|
|
19964
|
+
throw new Error(
|
|
19965
|
+
"runtime-data-seed @BeforeAll render: invalid table (firewall bypassed?)"
|
|
19966
|
+
);
|
|
19967
|
+
})();
|
|
19968
|
+
for (const row2 of target.rows) {
|
|
19969
|
+
const columns = Object.keys(row2.columns).sort();
|
|
19970
|
+
if (columns.length === 0) {
|
|
19971
|
+
throw new Error(
|
|
19972
|
+
"runtime-data-seed @BeforeAll render: zero-column row (firewall bypassed?)"
|
|
19973
|
+
);
|
|
19974
|
+
}
|
|
19975
|
+
for (const column of columns) {
|
|
19976
|
+
if (!isSqlIdentifier(column)) {
|
|
19977
|
+
throw new Error(
|
|
19978
|
+
"runtime-data-seed @BeforeAll render: invalid column (firewall bypassed?)"
|
|
19979
|
+
);
|
|
19980
|
+
}
|
|
19981
|
+
}
|
|
19982
|
+
const sql2 = `INSERT INTO ${table} (${columns.join(", ")}) VALUES (${columns.map(() => "?").join(", ")})`;
|
|
19983
|
+
const args = columns.map((c) => {
|
|
19984
|
+
const v = row2.columns[c];
|
|
19985
|
+
if (v === void 0) {
|
|
19986
|
+
throw new Error(
|
|
19987
|
+
"runtime-data-seed @BeforeAll render: vanished column value (firewall bypassed?)"
|
|
19988
|
+
);
|
|
19989
|
+
}
|
|
19990
|
+
return javaSeedValue(v);
|
|
19991
|
+
}).join(", ");
|
|
19992
|
+
updateLines.push(
|
|
19993
|
+
` jdbcTemplate.update("${javaStr(sql2)}"${args ? `, ${args}` : ""});`
|
|
19994
|
+
);
|
|
19995
|
+
}
|
|
19996
|
+
}
|
|
19997
|
+
return [
|
|
19998
|
+
" @BeforeAll",
|
|
19999
|
+
" static void csSeedData(@Autowired JdbcTemplate jdbcTemplate) {",
|
|
20000
|
+
" try {",
|
|
20001
|
+
...updateLines.map(
|
|
20002
|
+
(line) => ` try {
|
|
20003
|
+
${line}
|
|
20004
|
+
} catch (DuplicateKeyException csAlreadySeeded) {
|
|
20005
|
+
// idempotent: d\xF2ng \u0111\xE3 t\u1ED3n t\u1EA1i trong DB d\xF9ng m\u1ED9t l\u1EA7n (ADR-0070)
|
|
20006
|
+
}`
|
|
20007
|
+
),
|
|
20008
|
+
" } catch (Exception csSeedFailure) {",
|
|
20009
|
+
" // seed h\u1ECFng \u21D2 baseline s\u1EBD kh\xF4ng reachable \u21D2 skip HONEST (kh\xF4ng ph\u1EA3i blocked)",
|
|
20010
|
+
' Assumptions.abort("seedFailed: " + csSeedFailure);',
|
|
20011
|
+
" }",
|
|
20012
|
+
" }"
|
|
20013
|
+
].join("\n");
|
|
20014
|
+
};
|
|
20015
|
+
renderClass = (checklistId, scenarios, dbTier, dbRuntime = "testcontainers", authFills, emitEvidence = false, suiteHash = "", bootClass, seedPlan, runtimeAuth) => {
|
|
19409
20016
|
const vulnClass = scenarios[0]?.vulnerabilityClass ?? "injection";
|
|
19410
20017
|
const catalogEntry = ORACLE_CATALOG[vulnClass];
|
|
19411
20018
|
const positiveOracleId = catalogEntry?.positiveOracleId ?? `${vulnClass}.positive`;
|
|
19412
20019
|
const negativeOracleId = catalogEntry?.negativeOracleId ?? `${vulnClass}.no-negative-oracle`;
|
|
19413
20020
|
const useDbTier = vulnClass === "sql-injection" && dbTier !== void 0;
|
|
19414
|
-
const className =
|
|
20021
|
+
const className = verificationTestClassName(vulnClass, checklistId);
|
|
19415
20022
|
const used = /* @__PURE__ */ new Set();
|
|
19416
20023
|
let anyMediaType = false;
|
|
19417
20024
|
let anySecurity = false;
|
|
@@ -19428,7 +20035,7 @@ ${methods.join("\n\n")}
|
|
|
19428
20035
|
while (used.has(name)) name = `${base}_${i++}`;
|
|
19429
20036
|
used.add(name);
|
|
19430
20037
|
const fill = authFills?.get(authFillKey(s.httpMethod, s.path ?? ""));
|
|
19431
|
-
const { code: code2, usesMediaType, usesSecurity, usesMvcResult, usesCanon, fillImports } = emitEvidence ? renderEvidenceMethod(s, name, className, fill) : renderMethod2(s, name, fill);
|
|
20038
|
+
const { code: code2, usesMediaType, usesSecurity, usesMvcResult, usesCanon, fillImports } = emitEvidence ? renderEvidenceMethod(s, name, className, fill, runtimeAuth) : renderMethod2(s, name, fill, runtimeAuth);
|
|
19432
20039
|
for (const imp of fillImports) fillImportSet.add(imp);
|
|
19433
20040
|
if (usesMediaType) anyMediaType = true;
|
|
19434
20041
|
if (usesSecurity) anySecurity = true;
|
|
@@ -19444,6 +20051,11 @@ ${methods.join("\n\n")}
|
|
|
19444
20051
|
sinkLine: s.sinkLine
|
|
19445
20052
|
});
|
|
19446
20053
|
}
|
|
20054
|
+
const seedKeys = new Set(scenarios.map((s) => dataSeedKey(s.httpMethod, s.path ?? "")));
|
|
20055
|
+
const classSeedTargets = seedPlan ? [...seedKeys].flatMap((k) => seedPlan.get(k) ?? []) : [];
|
|
20056
|
+
const anySeed = classSeedTargets.length > 0;
|
|
20057
|
+
const anyRuntimeAuth = runtimeAuth !== void 0;
|
|
20058
|
+
const runtimeAuthHelper = anyRuntimeAuth ? renderRuntimeAuthHelper(runtimeAuth.envVar) : "";
|
|
19447
20059
|
const importLines = [
|
|
19448
20060
|
"import org.junit.jupiter.api.Assertions;",
|
|
19449
20061
|
"import org.junit.jupiter.api.Assumptions;",
|
|
@@ -19453,8 +20065,12 @@ ${methods.join("\n\n")}
|
|
|
19453
20065
|
"import org.springframework.boot.test.context.SpringBootTest;",
|
|
19454
20066
|
"import org.springframework.http.HttpMethod;",
|
|
19455
20067
|
...anyMediaType ? ["import org.springframework.http.MediaType;"] : [],
|
|
20068
|
+
// [ADR-0070]: runtime-auth rides with BOTH helpers (token + servletPath mirror) —
|
|
20069
|
+
// absent ⇒ byte-identical output (the isolation gate, like every E1 option).
|
|
20070
|
+
...anyRuntimeAuth ? ["import org.springframework.mock.web.MockHttpServletRequest;"] : [],
|
|
19456
20071
|
"import org.springframework.test.web.servlet.MockMvc;",
|
|
19457
20072
|
...anyMvcResult ? ["import org.springframework.test.web.servlet.MvcResult;"] : [],
|
|
20073
|
+
...anyRuntimeAuth ? ["import org.springframework.test.web.servlet.request.RequestPostProcessor;"] : [],
|
|
19458
20074
|
"import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request;",
|
|
19459
20075
|
...anySecurity ? [
|
|
19460
20076
|
"import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user;"
|
|
@@ -19467,6 +20083,12 @@ ${methods.join("\n\n")}
|
|
|
19467
20083
|
"import org.testcontainers.junit.jupiter.Container;",
|
|
19468
20084
|
"import org.testcontainers.junit.jupiter.Testcontainers;"
|
|
19469
20085
|
] : []
|
|
20086
|
+
] : [],
|
|
20087
|
+
// [ADR-0070]: seed imports ride ONLY with a seed-bearing class (isolation gate).
|
|
20088
|
+
...anySeed ? [
|
|
20089
|
+
"import org.junit.jupiter.api.BeforeAll;",
|
|
20090
|
+
"import org.springframework.dao.DuplicateKeyException;",
|
|
20091
|
+
"import org.springframework.jdbc.core.JdbcTemplate;"
|
|
19470
20092
|
] : []
|
|
19471
20093
|
];
|
|
19472
20094
|
const extraImports = [...fillImportSet].filter((i) => !importLines.includes(i)).sort();
|
|
@@ -19478,6 +20100,9 @@ ${methods.join("\n\n")}
|
|
|
19478
20100
|
].join("\n");
|
|
19479
20101
|
const dbTierFields = useDbTier && dbTier !== void 0 ? `${dbRuntime === "external" ? renderExternalDbTierFields(dbTier) : renderTestcontainersDbTierFields(dbTier)}
|
|
19480
20102
|
|
|
20103
|
+
` : "";
|
|
20104
|
+
const seedBlock = anySeed ? `${renderSeedMethod(classSeedTargets)}
|
|
20105
|
+
|
|
19481
20106
|
` : "";
|
|
19482
20107
|
const content = `package ${GENERATED_PACKAGE};
|
|
19483
20108
|
|
|
@@ -19498,7 +20123,11 @@ ${imports}
|
|
|
19498
20123
|
* \u2014 c\u1EA7n \`spring-security-test\` tr\xEAn test classpath). Baseline b\u1ECB t\u1EEB ch\u1ED1i (4xx: auth
|
|
19499
20124
|
* thi\u1EBFu/sai, route/binding sai) \u21D2 test skipped \u21D2 \`not-tested\`, KH\xD4NG ph\u1EA3i
|
|
19500
20125
|
* \`blocked\` (\xA7D1). Endpoint d\xF9ng authz tu\u1EF3 bi\u1EBFn (vd \`@VauthzCheck\`) / OAuth2 /
|
|
19501
|
-
* principal \u0111\u1EB7c th\xF9: ch\u1EC9nh slot auth cho kh\u1EDBp \u2014 ch\u01B0a kh\u1EDBp th\xEC honest \`not-tested\`.${
|
|
20126
|
+
* principal \u0111\u1EB7c th\xF9: ch\u1EC9nh slot auth cho kh\u1EDBp \u2014 ch\u01B0a kh\u1EDBp th\xEC honest \`not-tested\`.${anyRuntimeAuth ? `
|
|
20127
|
+
*
|
|
20128
|
+
* ADR-0070 (runtime-auth): M\u1ECCI request (baseline + attack) g\u1EAFn \`Authorization: Bearer\` t\u1EEB
|
|
20129
|
+
* $CS_RUNTIME_TOKEN do pipeline mint \u2014 token TH\u1EACT \u0111i qua servlet filter (kh\xF4ng ph\u1EA3i principal
|
|
20130
|
+
* Spring Security Test). Token r\u1ED7ng/sai \u21D2 baseline 4xx \u21D2 test skipped \u21D2 \`not-tested\` (\xA7D1).` : ""}${emitEvidence ? `
|
|
19502
20131
|
*
|
|
19503
20132
|
* ADR-0049 (evidence mode, --emit-evidence): m\u1ED7i test c\xF2n ghi 1 evidence-envelope sidecar
|
|
19504
20133
|
* (quan s\xE1t dual-run baseline+attack, provenance \`generated-test\`) v\xE0o $CODE_SENTINEL_EVIDENCE_DIR
|
|
@@ -19511,11 +20140,13 @@ class ${className} {
|
|
|
19511
20140
|
${dbTierFields} @Autowired
|
|
19512
20141
|
private MockMvc mockMvc;
|
|
19513
20142
|
|
|
19514
|
-
${methods.join("\n\n")}${anyCanon ? `
|
|
20143
|
+
${seedBlock}${methods.join("\n\n")}${anyCanon ? `
|
|
19515
20144
|
|
|
19516
20145
|
${CANON_HELPER}` : ""}${emitEvidence ? `
|
|
19517
20146
|
|
|
19518
|
-
${renderEvidenceHelpers(positiveOracleId, negativeOracleId, suiteHash)}` : ""}
|
|
20147
|
+
${renderEvidenceHelpers(positiveOracleId, negativeOracleId, suiteHash)}` : ""}${anyRuntimeAuth ? `
|
|
20148
|
+
|
|
20149
|
+
${runtimeAuthHelper}` : ""}
|
|
19519
20150
|
}
|
|
19520
20151
|
`;
|
|
19521
20152
|
return {
|
|
@@ -19542,8 +20173,8 @@ ${renderEvidenceHelpers(positiveOracleId, negativeOracleId, suiteHash)}` : ""}
|
|
|
19542
20173
|
const skipped = [];
|
|
19543
20174
|
for (const s of scenarios) {
|
|
19544
20175
|
if (isVerifiable(s)) {
|
|
19545
|
-
const
|
|
19546
|
-
if (
|
|
20176
|
+
const group2 = byChecklist.get(s.checklistId);
|
|
20177
|
+
if (group2) group2.push(s);
|
|
19547
20178
|
else byChecklist.set(s.checklistId, [s]);
|
|
19548
20179
|
} else if (SERVER_CLASSES.has(s.vulnerabilityClass)) {
|
|
19549
20180
|
skipped.push({
|
|
@@ -19555,15 +20186,17 @@ ${renderEvidenceHelpers(positiveOracleId, negativeOracleId, suiteHash)}` : ""}
|
|
|
19555
20186
|
}
|
|
19556
20187
|
const emitEvidence = options?.emitEvidence ?? false;
|
|
19557
20188
|
const renderAll = (suiteHash) => [...byChecklist.entries()].sort(([a], [b]) => Number(a) - Number(b)).map(
|
|
19558
|
-
([checklistId,
|
|
20189
|
+
([checklistId, group2]) => renderClass(
|
|
19559
20190
|
checklistId,
|
|
19560
|
-
|
|
20191
|
+
group2,
|
|
19561
20192
|
options?.dbTier,
|
|
19562
20193
|
options?.dbRuntime ?? "testcontainers",
|
|
19563
20194
|
options?.authFills,
|
|
19564
20195
|
emitEvidence,
|
|
19565
20196
|
suiteHash,
|
|
19566
|
-
options?.bootClass
|
|
20197
|
+
options?.bootClass,
|
|
20198
|
+
options?.seedPlan,
|
|
20199
|
+
options?.runtimeAuth
|
|
19567
20200
|
)
|
|
19568
20201
|
);
|
|
19569
20202
|
const firstPass = renderAll("");
|
|
@@ -20313,13 +20946,13 @@ ${renderEvidenceHelpers(positiveOracleId, negativeOracleId, suiteHash)}` : ""}
|
|
|
20313
20946
|
};
|
|
20314
20947
|
DAST_PLAN_FILE = "code-sentinel-dast-plan.yaml";
|
|
20315
20948
|
DAST_MANIFEST_FILE = "code-sentinel-dast.json";
|
|
20949
|
+
DAST_PROBE_SCRIPT_FILE = "code-sentinel-dast-probe.sh";
|
|
20950
|
+
PROBE_VICTIM_BUCKET_REF = "${CS_PROBE_VICTIM_BUCKET}";
|
|
20951
|
+
PROBE_CANARY_OBJECT_REF = "${CS_PROBE_CANARY_OBJECT}";
|
|
20952
|
+
PROBE_INJECTION_KINDS = /* @__PURE__ */ new Set(["query", "path"]);
|
|
20316
20953
|
isScannable = (s) => ZAP_SCAN_RULES.has(s.vulnerabilityClass) && s.path !== null && s.injectionPoint !== null;
|
|
20317
20954
|
skipReason = (s) => ZAP_SCAN_RULES.has(s.vulnerabilityClass) ? "Kh\xF4ng gi\u1EA3i \u0111\u01B0\u1EE3c HTTP entry point / injection point cho sink \u2014 ki\u1EC3m tra th\u1EE7 c\xF4ng (kh\xF4ng d\u1EF1ng \u0111\u01B0\u1EE3c ZAP scan target)." : "B\u1EC1 m\u1EB7t client-side (DOM/redirect/eval tr\xECnh duy\u1EC7t) \u2014 c\u1EA7n AJAX spider + tr\xECnh duy\u1EC7t, ngo\xE0i ph\u1EA1m vi ZAP active-scan targeted (E2.0).";
|
|
20318
20955
|
yamlStr = (s) => `"${s.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
20319
|
-
fillPath2 = (path2, value) => {
|
|
20320
|
-
if (/\{[^}]+\}/.test(path2)) return path2.replace(/\{[^}]+\}/, value);
|
|
20321
|
-
return `${path2.replace(/\/$/, "")}/${value}`;
|
|
20322
|
-
};
|
|
20323
20956
|
normMethod = (method) => method === "ANY" ? "GET" : method.toUpperCase();
|
|
20324
20957
|
toTarget = (s) => {
|
|
20325
20958
|
const scanRule = ZAP_SCAN_RULES.get(s.vulnerabilityClass);
|
|
@@ -20330,34 +20963,59 @@ ${renderEvidenceHelpers(positiveOracleId, negativeOracleId, suiteHash)}` : ""}
|
|
|
20330
20963
|
httpMethod: normMethod(s.httpMethod),
|
|
20331
20964
|
path: s.path,
|
|
20332
20965
|
injectionPoint: s.injectionPoint,
|
|
20966
|
+
...s.companionParams && s.companionParams.length > 0 ? { companionParams: s.companionParams } : {},
|
|
20333
20967
|
sinkFile: s.sinkFile,
|
|
20334
|
-
sinkLine: s.sinkLine
|
|
20968
|
+
sinkLine: s.sinkLine,
|
|
20969
|
+
...s.sinkId !== void 0 ? { sinkId: s.sinkId } : {}
|
|
20335
20970
|
};
|
|
20336
20971
|
};
|
|
20337
20972
|
SEED_VALUE = "1";
|
|
20973
|
+
allParams = (t) => [
|
|
20974
|
+
t.injectionPoint,
|
|
20975
|
+
...t.companionParams ?? []
|
|
20976
|
+
];
|
|
20977
|
+
queryString = (t) => {
|
|
20978
|
+
const q = allParams(t).filter((p) => p.kind === "query");
|
|
20979
|
+
return q.length === 0 ? "" : `?${q.map((p) => `${p.name}=${SEED_VALUE}`).join("&")}`;
|
|
20980
|
+
};
|
|
20981
|
+
requestPath = (t) => {
|
|
20982
|
+
const hasVar = /\{[^}]+\}/.test(t.path);
|
|
20983
|
+
if (!hasVar && t.injectionPoint.kind === "path") {
|
|
20984
|
+
return `${t.path.replace(/\/$/, "")}/${SEED_VALUE}`;
|
|
20985
|
+
}
|
|
20986
|
+
return t.path.replace(/\{[^}]+\}/g, SEED_VALUE);
|
|
20987
|
+
};
|
|
20338
20988
|
renderRequest = (t, varRef) => {
|
|
20339
20989
|
const inj = t.injectionPoint;
|
|
20340
20990
|
const lines = [];
|
|
20991
|
+
const headerParams = allParams(t).filter((p) => p.kind === "header");
|
|
20992
|
+
const headerLines = headerParams.length === 0 ? [] : [
|
|
20993
|
+
" headers:",
|
|
20994
|
+
...headerParams.flatMap((p) => [
|
|
20995
|
+
` - name: ${yamlStr(p.name)}`,
|
|
20996
|
+
` value: ${yamlStr(SEED_VALUE)}`
|
|
20997
|
+
])
|
|
20998
|
+
];
|
|
20341
20999
|
switch (inj.kind) {
|
|
20342
21000
|
case "query":
|
|
20343
21001
|
lines.push(
|
|
20344
|
-
` - url: ${yamlStr(`${varRef}${t
|
|
20345
|
-
` method: ${yamlStr(t.httpMethod)}
|
|
21002
|
+
` - url: ${yamlStr(`${varRef}${requestPath(t)}${queryString(t)}`)}`,
|
|
21003
|
+
` method: ${yamlStr(t.httpMethod)}`,
|
|
21004
|
+
...headerLines
|
|
20346
21005
|
);
|
|
20347
21006
|
break;
|
|
20348
21007
|
case "path":
|
|
20349
21008
|
lines.push(
|
|
20350
|
-
` - url: ${yamlStr(`${varRef}${
|
|
20351
|
-
` method: ${yamlStr(t.httpMethod)}
|
|
21009
|
+
` - url: ${yamlStr(`${varRef}${requestPath(t)}${queryString(t)}`)}`,
|
|
21010
|
+
` method: ${yamlStr(t.httpMethod)}`,
|
|
21011
|
+
...headerLines
|
|
20352
21012
|
);
|
|
20353
21013
|
break;
|
|
20354
21014
|
case "header":
|
|
20355
21015
|
lines.push(
|
|
20356
|
-
` - url: ${yamlStr(`${varRef}${t
|
|
21016
|
+
` - url: ${yamlStr(`${varRef}${requestPath(t)}${queryString(t)}`)}`,
|
|
20357
21017
|
` method: ${yamlStr(t.httpMethod)}`,
|
|
20358
|
-
|
|
20359
|
-
` - name: ${yamlStr(inj.name)}`,
|
|
20360
|
-
` value: ${yamlStr(SEED_VALUE)}`
|
|
21018
|
+
...headerLines
|
|
20361
21019
|
);
|
|
20362
21020
|
break;
|
|
20363
21021
|
case "body":
|
|
@@ -20378,7 +21036,16 @@ ${renderEvidenceHelpers(positiveOracleId, negativeOracleId, suiteHash)}` : ""}
|
|
|
20378
21036
|
};
|
|
20379
21037
|
renderPlanYaml = (targets, scanRuleIds, opts) => {
|
|
20380
21038
|
const varRef = `\${${opts.targetUrlVar}}`;
|
|
20381
|
-
const
|
|
21039
|
+
const authTokenVar = opts.authTokenEnvVar ? `
|
|
21040
|
+
${opts.authTokenEnvVar}: "\${${opts.authTokenEnvVar}}" # \u0111\u1ECDc t\u1EEB bi\u1EBFn m\xF4i tr\u01B0\u1EDDng l\xFAc ch\u1EA1y; KH\xD4NG ch\u1EE9a token` : "";
|
|
21041
|
+
const replacerJob = opts.authTokenEnvVar ? ` # \u26A0\uFE0F T\xCAN FIELD L\xC0 H\u1EE2P \u0110\u1ED2NG V\u1EDAI ZAP, KH\xD4NG PH\u1EA2I S\u1EDE TH\xCDCH. \u0110\xFAng t\xEAn: \`replacementString\`
|
|
21042
|
+
# (KH\xD4NG ph\u1EA3i \`replacement\`), v\xE0 KH\xD4NG c\xF3 \`enabled\`. Sai t\xEAn th\xEC ZAP **v\u1EABn ch\u1EA1y job v\xE0 v\u1EABn in
|
|
21043
|
+
# \`Job replacer started/finished\`** \u2014 n\xF3 ch\u1EC9 l\u1EB7ng l\u1EBD b\u1ECF field: MEASURED tr\xEAn run
|
|
21044
|
+
# cs-pentest-ptr-mtk7753j-3da8c6d7, ZAP 2.16.1 in \`Unrecognised parameter for job replacer :
|
|
21045
|
+
# replacement\`, r\u1ED3i active scan g\u1EEDi 31 request KH\xD4NG c\xF3 header Authorization v\xE0 nh\u1EADn 401
|
|
21046
|
+
# "Kh\xF4ng c\xF3 th\xF4ng tin x\xE1c th\u1EF1c" cho m\u1ECDi request \u2014 0 alert, tr\xF4ng y h\u1EC7t m\u1ED9t app s\u1EA1ch.
|
|
21047
|
+
# M\u1ECDi c\xF4ng s\u1EE9c mint + seed token d\u1EEBng l\u1EA1i \u1EDF \u0111\xE2y n\u1EBFu t\xEAn field sai.
|
|
21048
|
+
# Auth cho E2 (ADR-0065): th\xEAm Bearer token runtime \u0111\u1EC3 qu\xE9t endpoint SAU c\u1ED5ng auth.
|
|
20382
21049
|
# \${${opts.authTokenEnvVar}} do ZAP AF thay t\u1EEB OS env l\xFAc ch\u1EA1y; plan KH\xD4NG ch\u1EE9a token (ch\u1EC9 t\xEAn bi\u1EBFn).
|
|
20383
21050
|
# Token ch\u1EC9 m\u1EDF REACHABILITY \u2014 oracle v\u1EABn ph\xE1n l\u1ED7 h\u1ED5ng (\xA7D1).
|
|
20384
21051
|
- type: replacer
|
|
@@ -20387,9 +21054,8 @@ ${renderEvidenceHelpers(positiveOracleId, negativeOracleId, suiteHash)}` : ""}
|
|
|
20387
21054
|
matchType: "req_header"
|
|
20388
21055
|
matchString: "Authorization"
|
|
20389
21056
|
matchRegex: false
|
|
20390
|
-
|
|
21057
|
+
replacementString: ${yamlStr(`Bearer \${${opts.authTokenEnvVar}}`)}
|
|
20391
21058
|
tokenProcessing: false
|
|
20392
|
-
enabled: true
|
|
20393
21059
|
` : "";
|
|
20394
21060
|
const requests = targets.flatMap((t) => renderRequest(t, varRef));
|
|
20395
21061
|
const rules = scanRuleIds.flatMap((id) => {
|
|
@@ -20427,7 +21093,7 @@ env:
|
|
|
20427
21093
|
authentication:
|
|
20428
21094
|
method: "manual" # n\u1ED1i auth/session h\u1EE3p l\u1EC7 n\u1EBFu endpoint \u0111\u01B0\u1EE3c b\u1EA3o v\u1EC7 (\xA7D15)
|
|
20429
21095
|
vars:
|
|
20430
|
-
${opts.targetUrlVar}: ${yamlStr(opts.targetUrlPlaceholder)} # \u2190 S\u1EECA th\xE0nh URL env ephemeral c\u1EE7a b\u1EA1n
|
|
21096
|
+
${opts.targetUrlVar}: ${yamlStr(opts.targetUrlPlaceholder)} # \u2190 S\u1EECA th\xE0nh URL env ephemeral c\u1EE7a b\u1EA1n${authTokenVar}
|
|
20431
21097
|
parameters:
|
|
20432
21098
|
failOnError: false
|
|
20433
21099
|
failOnWarning: false
|
|
@@ -20488,6 +21154,26 @@ ${rules.join("\n")}
|
|
|
20488
21154
|
const planYaml = renderPlanYaml(targets, scanRuleIds, opts);
|
|
20489
21155
|
return { contextName: opts.contextName, planYaml, targets, scanRuleIds, skipped };
|
|
20490
21156
|
};
|
|
21157
|
+
buildProbeSpec = (t) => {
|
|
21158
|
+
const inj = t.injectionPoint;
|
|
21159
|
+
return {
|
|
21160
|
+
kind: "object-store-cross-tenant",
|
|
21161
|
+
method: t.httpMethod,
|
|
21162
|
+
urlPath: t.path.replace(/\{[^}]+\}/g, PROBE_VICTIM_BUCKET_REF),
|
|
21163
|
+
params: [
|
|
21164
|
+
...inj.kind === "query" ? [{ name: inj.name, kind: "query", value: PROBE_VICTIM_BUCKET_REF }] : [],
|
|
21165
|
+
...(t.companionParams ?? []).filter((p) => p.kind === "query" || p.kind === "header").map((p) => ({ name: p.name, kind: p.kind, value: PROBE_CANARY_OBJECT_REF }))
|
|
21166
|
+
],
|
|
21167
|
+
e1GateClass: verificationTestClassName(t.vulnerabilityClass, t.checklistId)
|
|
21168
|
+
};
|
|
21169
|
+
};
|
|
21170
|
+
buildProbe = (base, scenarios) => {
|
|
21171
|
+
const hasProbeFamilySink = scenarios.some(
|
|
21172
|
+
(s) => s.sinkId !== void 0 && OBJECT_STORE_PROBE_SINKS.has(s.sinkId)
|
|
21173
|
+
);
|
|
21174
|
+
if (!hasProbeFamilySink || !PROBE_INJECTION_KINDS.has(base.injectionPoint.kind)) return {};
|
|
21175
|
+
return { probe: buildProbeSpec(base) };
|
|
21176
|
+
};
|
|
20491
21177
|
buildDastManifest = (plan, meta) => {
|
|
20492
21178
|
const groups = /* @__PURE__ */ new Map();
|
|
20493
21179
|
for (const t of plan.targets) {
|
|
@@ -20508,12 +21194,13 @@ ${rules.join("\n")}
|
|
|
20508
21194
|
checklistId: t.checklistId,
|
|
20509
21195
|
vulnerabilityClass: t.vulnerabilityClass,
|
|
20510
21196
|
sinkFile: t.sinkFile,
|
|
20511
|
-
sinkLine: t.sinkLine
|
|
21197
|
+
sinkLine: t.sinkLine,
|
|
21198
|
+
...t.sinkId !== void 0 ? { sinkId: t.sinkId } : {}
|
|
20512
21199
|
};
|
|
20513
|
-
const
|
|
20514
|
-
if (
|
|
20515
|
-
else if (!
|
|
20516
|
-
|
|
21200
|
+
const group2 = groups.get(executionTargetId);
|
|
21201
|
+
if (group2 === void 0) groups.set(executionTargetId, { base: t, scenarios: [scenario] });
|
|
21202
|
+
else if (!group2.scenarios.some((s) => s.scenarioId === scenario.scenarioId))
|
|
21203
|
+
group2.scenarios.push(scenario);
|
|
20517
21204
|
}
|
|
20518
21205
|
const targets = [...groups.entries()].map(([executionTargetId, { base, scenarios }]) => ({
|
|
20519
21206
|
executionTargetId,
|
|
@@ -20523,7 +21210,8 @@ ${rules.join("\n")}
|
|
|
20523
21210
|
path: base.path,
|
|
20524
21211
|
injectionName: base.injectionPoint.name,
|
|
20525
21212
|
injectionKind: base.injectionPoint.kind,
|
|
20526
|
-
scenarios: [...scenarios].sort((a, b) => compareScenarioRef(a, b))
|
|
21213
|
+
scenarios: [...scenarios].sort((a, b) => compareScenarioRef(a, b)),
|
|
21214
|
+
...buildProbe(base, scenarios)
|
|
20527
21215
|
})).sort(compareExecutionTarget);
|
|
20528
21216
|
const expectedProvenance = {
|
|
20529
21217
|
scanPlanHash: dastScanPlanHash(plan.planYaml),
|
|
@@ -20556,6 +21244,145 @@ ${rules.join("\n")}
|
|
|
20556
21244
|
if (a.httpMethod !== b.httpMethod) return cmpStr3(a.httpMethod, b.httpMethod);
|
|
20557
21245
|
return cmpStr3(a.executionTargetId, b.executionTargetId);
|
|
20558
21246
|
};
|
|
21247
|
+
shq = (value) => value.split(/(\$\{CS_PROBE_(?:VICTIM_BUCKET|CANARY_OBJECT)\})/).map((part) => {
|
|
21248
|
+
if (part === PROBE_VICTIM_BUCKET_REF) return '"${CS_PROBE_VICTIM_BUCKET}"';
|
|
21249
|
+
if (part === PROBE_CANARY_OBJECT_REF) return '"${CS_PROBE_CANARY_OBJECT}"';
|
|
21250
|
+
if (part === "") return "";
|
|
21251
|
+
return `'${part.replaceAll("'", "'\\''")}'`;
|
|
21252
|
+
}).join("");
|
|
21253
|
+
PROBE_SCRIPT_PROLOGUE = `#!/usr/bin/env bash
|
|
21254
|
+
# [ADR-0071] Canary cross-tenant probe \u2014 GENERATED by \`cs assess --emit-dast\`; do not edit.
|
|
21255
|
+
# \`cs dast-verify\` / \`cs correlate\` read <out-file> from the manifest's directory
|
|
21256
|
+
# (DAST_PROBE_FILE) and join each attempt onto the resolution whose e1GateClass it carries.
|
|
21257
|
+
#
|
|
21258
|
+
# Usage: code-sentinel-dast-probe.sh <canary-token> <out-file> <base-url> <e1-results-dir>
|
|
21259
|
+
# <canary-token> the canary marker the runtime seeded (an absent token SKIPS every fire \u2014
|
|
21260
|
+
# fail-closed; the attempts are still recorded with the note)
|
|
21261
|
+
# <out-file> where the probe-results envelope is written (temp file + atomic mv)
|
|
21262
|
+
# <base-url> the application base URL (e.g. http://127.0.0.1:8080 in the runtime pod)
|
|
21263
|
+
# <e1-results-dir> the E1 surefire directory whose TEST-*.xml results gate each attempt
|
|
21264
|
+
#
|
|
21265
|
+
# Env: CS_RUNTIME_TOKEN (optional bearer); CS_PROBE_VICTIM_BUCKET + CS_PROBE_CANARY_OBJECT are
|
|
21266
|
+
# expanded at run time from the reference strings this script was generated with (the manifest
|
|
21267
|
+
# carries names, never values \u2014 same rule as the ZAP plan's \`\${ZAP_TARGET_URL}\`).
|
|
21268
|
+
#
|
|
21269
|
+
# Honesty contract (ADR-0071): every attempt is recorded whatever happens; a failed curl is
|
|
21270
|
+
# httpStatus 0; a gate that is not 'e1-baseline-passed' SKIPS the probe (recorded with the gate
|
|
21271
|
+
# as the note). Only a POSITIVE canary match may upgrade a verdict downstream \u2014 this script can
|
|
21272
|
+
# never manufacture 'blocked'. Empty arrays under \`set -u\` need bash >= 4.4 (ZAP image: bash 5).
|
|
21273
|
+
set -u
|
|
21274
|
+
|
|
21275
|
+
CANARY="\${1:-}"
|
|
21276
|
+
OUT_FILE="\${2:-}"
|
|
21277
|
+
BASE_URL="\${3:-}"
|
|
21278
|
+
E1_RESULTS="\${4:-}"
|
|
21279
|
+
|
|
21280
|
+
if [ -z "$CANARY" ] || [ -z "$OUT_FILE" ] || [ -z "$BASE_URL" ]; then
|
|
21281
|
+
echo "[adr-0071] usage: code-sentinel-dast-probe.sh <canary-token> <out-file> <base-url> <e1-results-dir>" >&2
|
|
21282
|
+
exit 2
|
|
21283
|
+
fi
|
|
21284
|
+
|
|
21285
|
+
BODY_FILE=$(mktemp)
|
|
21286
|
+
ATTEMPTS_FILE=$(mktemp)
|
|
21287
|
+
trap 'rm -f "$BODY_FILE" "$ATTEMPTS_FILE"' EXIT
|
|
21288
|
+
|
|
21289
|
+
auth_args=()
|
|
21290
|
+
[ -n "\${CS_RUNTIME_TOKEN:-}" ] && auth_args=(-H "Authorization: Bearer \${CS_RUNTIME_TOKEN}")
|
|
21291
|
+
|
|
21292
|
+
# Map the E1 JUnit baseline of the gate class to the schema's gate enum (fail-closed): a missing
|
|
21293
|
+
# file, a <skipped> case (baseline unreachable) or an <error> (harness/context failure) all mean
|
|
21294
|
+
# the attack shape is NOT proven to reach the handler, so the probe records the honest gate and
|
|
21295
|
+
# never fires. A JUnit <failure> still PASSES this gate: the attack REACHED the handler, which is
|
|
21296
|
+
# what E1 proved \u2014 the exploit oracle here is the canary, not the assertion.
|
|
21297
|
+
probe_gate() {
|
|
21298
|
+
_cls="$1"
|
|
21299
|
+
_xml=$(find "$E1_RESULTS" -name "TEST-*\${_cls}.xml" -print -quit 2>/dev/null)
|
|
21300
|
+
if [ -z "$_xml" ]; then
|
|
21301
|
+
echo 'e1-baseline-missing'
|
|
21302
|
+
elif grep -q '<skipped' "$_xml" 2>/dev/null; then
|
|
21303
|
+
echo 'e1-baseline-skipped'
|
|
21304
|
+
elif grep -q '<error' "$_xml" 2>/dev/null; then
|
|
21305
|
+
echo 'e1-baseline-errored'
|
|
21306
|
+
else
|
|
21307
|
+
echo 'e1-baseline-passed'
|
|
21308
|
+
fi
|
|
21309
|
+
}
|
|
21310
|
+
|
|
21311
|
+
# JSON string escape for interpolated values (single-line values; backslash and double-quote are
|
|
21312
|
+
# the only characters that can break the envelope).
|
|
21313
|
+
json_escape() {
|
|
21314
|
+
sed -e 's/\\\\/\\\\\\\\/g' -e 's/"/\\\\"/g'
|
|
21315
|
+
}
|
|
21316
|
+
|
|
21317
|
+
# Append one attempt object (one JSON line) to the attempts scratch file.
|
|
21318
|
+
# Fields match the dastProbeAttemptSchema consumed by cs dast-verify / cs correlate.
|
|
21319
|
+
emit_attempt() {
|
|
21320
|
+
_tid="$1"; _cls="$2"; _gate="$3"; _match="$4"; _status="$5"; _req="$6"; _note="\${7:-}"
|
|
21321
|
+
_canary_esc=$(printf '%s' "$CANARY" | json_escape)
|
|
21322
|
+
printf '{"executionTargetId":"%s","e1GateClass":"%s","gate":"%s","canaryMatched":%s,"canaryToken":"%s","httpStatus":%s,"requestedPath":"%s"' \\
|
|
21323
|
+
"$_tid" "$_cls" "$_gate" "$_match" "$_canary_esc" "$_status" "$_req" >> "$ATTEMPTS_FILE"
|
|
21324
|
+
if [ -n "$_note" ]; then
|
|
21325
|
+
_note_esc=$(printf '%s' "$_note" | json_escape)
|
|
21326
|
+
printf ',"note":"%s"' "$_note_esc" >> "$ATTEMPTS_FILE"
|
|
21327
|
+
fi
|
|
21328
|
+
printf '}\\n' >> "$ATTEMPTS_FILE"
|
|
21329
|
+
}
|
|
21330
|
+
|
|
21331
|
+
# Fire one probe (or record why it was skipped). Args: <targetId> <gateClass> <method> <path> <query>
|
|
21332
|
+
# Headers for this target ride the global hdr_args array (reset before each call). A failed curl
|
|
21333
|
+
# yields code 000/empty \u2192 httpStatus 0 (a numeric field, never a JSON-invalid 000).
|
|
21334
|
+
probe_one() {
|
|
21335
|
+
_tid="$1"; _cls="$2"; _method="$3"; _path="$4"; _query="\${5:-}"
|
|
21336
|
+
_gate=$(probe_gate "$_cls")
|
|
21337
|
+
_match=false
|
|
21338
|
+
_status=0
|
|
21339
|
+
_req="$_path"
|
|
21340
|
+
[ -n "$_query" ] && _req="\${_path}?\${_query}"
|
|
21341
|
+
if [ "$_gate" = 'e1-baseline-passed' ]; then
|
|
21342
|
+
_url="\${BASE_URL}\${_path}"
|
|
21343
|
+
[ -n "$_query" ] && _url="\${_url}?\${_query}"
|
|
21344
|
+
_code=$(curl -sS -o "$BODY_FILE" -w '%{http_code}' --max-time 30 -X "$_method" \\
|
|
21345
|
+
"\${auth_args[@]}" "\${hdr_args[@]}" "$_url" 2>/dev/null) || true
|
|
21346
|
+
case "$_code" in ''|*[!0-9]*|000) _code=0 ;; esac
|
|
21347
|
+
_status="$_code"
|
|
21348
|
+
grep -qF -- "$CANARY" "$BODY_FILE" 2>/dev/null && _match=true
|
|
21349
|
+
fi
|
|
21350
|
+
_note=''
|
|
21351
|
+
[ "$_gate" != 'e1-baseline-passed' ] && _note="probe skipped: E1 baseline \${_gate}"
|
|
21352
|
+
_req_esc=$(printf '%s' "$_req" | json_escape)
|
|
21353
|
+
emit_attempt "$_tid" "$_cls" "$_gate" "$_match" "$_status" "$_req_esc" "$_note"
|
|
21354
|
+
}`;
|
|
21355
|
+
PROBE_SCRIPT_EPILOGUE = `
|
|
21356
|
+
# Assemble the envelope: one JSON object per line \u2192 comma-joined (tr \u2014 no paste dependency on a
|
|
21357
|
+
# foreign image), written to a temp file and renamed so a reader never sees a half-written file.
|
|
21358
|
+
attempts_json=$(tr '\\n' ',' < "$ATTEMPTS_FILE")
|
|
21359
|
+
attempts_json="\${attempts_json%,}"
|
|
21360
|
+
now=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
21361
|
+
printf '{"schemaVersion":1,"generatedAt":"%s","attempts":[%s]}' "$now" "$attempts_json" > "\${OUT_FILE}.tmp"
|
|
21362
|
+
mv -f "\${OUT_FILE}.tmp" "$OUT_FILE"
|
|
21363
|
+
echo "[adr-0071] probe-results written: \${OUT_FILE} ($(wc -l < "$ATTEMPTS_FILE") attempt(s))"`;
|
|
21364
|
+
renderDastProbeScript = (manifest) => {
|
|
21365
|
+
const probeTargets = manifest.targets.filter(
|
|
21366
|
+
(t) => t.probe !== void 0
|
|
21367
|
+
);
|
|
21368
|
+
if (probeTargets.length === 0) return null;
|
|
21369
|
+
const lines = [PROBE_SCRIPT_PROLOGUE];
|
|
21370
|
+
for (const t of probeTargets) {
|
|
21371
|
+
const p = t.probe;
|
|
21372
|
+
const query = p.params.filter((q) => q.kind === "query").map((q) => `${q.name}=${q.value}`).join("&");
|
|
21373
|
+
lines.push("");
|
|
21374
|
+
lines.push(`# target ${t.executionTargetId} (${p.method} ${p.urlPath})`);
|
|
21375
|
+
lines.push("hdr_args=()");
|
|
21376
|
+
for (const h of p.params.filter((q) => q.kind === "header"))
|
|
21377
|
+
lines.push(`hdr_args+=(-H ${shq(`${h.name}: ${h.value}`)})`);
|
|
21378
|
+
lines.push(
|
|
21379
|
+
`probe_one ${shq(t.executionTargetId)} ${shq(p.e1GateClass)} ${shq(p.method)} ${shq(p.urlPath)} ${shq(query)}`
|
|
21380
|
+
);
|
|
21381
|
+
}
|
|
21382
|
+
lines.push(PROBE_SCRIPT_EPILOGUE);
|
|
21383
|
+
return `${lines.join("\n")}
|
|
21384
|
+
`;
|
|
21385
|
+
};
|
|
20559
21386
|
RISK_BY_CODE = {
|
|
20560
21387
|
"3": "High",
|
|
20561
21388
|
"2": "Medium",
|
|
@@ -20794,7 +21621,7 @@ ${rules.join("\n")}
|
|
|
20794
21621
|
};
|
|
20795
21622
|
const negativeOracleEnabled = options.defenseObservations !== void 0 && options.trustTier !== void 0 && options.attemptId !== void 0 && !unparseable && !prov.downgrade;
|
|
20796
21623
|
const observationFor = (executionTargetId) => options.defenseObservations?.find((o) => o.executionTargetId === executionTargetId);
|
|
20797
|
-
const
|
|
21624
|
+
const afterNegativeOracle = baseResolutions.map((r0) => {
|
|
20798
21625
|
const r = withCoverage(r0);
|
|
20799
21626
|
if (unparseable) return { ...r, verdict: "not-tested", reason: "report-unparseable" };
|
|
20800
21627
|
if (prov.downgrade) return { ...r, verdict: "not-tested", reason: prov.reason ?? r.reason };
|
|
@@ -20819,6 +21646,17 @@ ${rules.join("\n")}
|
|
|
20819
21646
|
});
|
|
20820
21647
|
return outcome.verdict === "blocked" ? { ...r, verdict: "blocked", reason: "negative-oracle-observed" } : r;
|
|
20821
21648
|
});
|
|
21649
|
+
const probeByTargetId = new Map(
|
|
21650
|
+
(options.probeAttempts ?? []).map((a) => [a.executionTargetId, a])
|
|
21651
|
+
);
|
|
21652
|
+
const probeEligible = probeByTargetId.size > 0 && !unparseable && !prov.downgrade;
|
|
21653
|
+
const resolutions = probeEligible ? afterNegativeOracle.map((r) => {
|
|
21654
|
+
if (r.verdict !== "not-tested" || r.reason !== "no-alert-observed") return r;
|
|
21655
|
+
const attempt = probeByTargetId.get(r.executionTargetId);
|
|
21656
|
+
if (attempt === void 0) return r;
|
|
21657
|
+
if (!(attempt.gate === "e1-baseline-passed" && attempt.canaryMatched)) return r;
|
|
21658
|
+
return { ...r, verdict: "exploited", reason: "probe-canary" };
|
|
21659
|
+
}) : afterNegativeOracle;
|
|
20822
21660
|
const unmatchedAlerts = parsed.alerts.filter((_a, i) => !matchedAlerts.has(i));
|
|
20823
21661
|
const summary = {
|
|
20824
21662
|
exploited: resolutions.filter((r) => r.verdict === "exploited").length,
|
|
@@ -21138,7 +21976,7 @@ ${rules.join("\n")}
|
|
|
21138
21976
|
};
|
|
21139
21977
|
CHECKLIST_ID4 = "71";
|
|
21140
21978
|
CONTROL_ID4 = "upload-validation";
|
|
21141
|
-
|
|
21979
|
+
MAX_EVIDENCE322 = 50;
|
|
21142
21980
|
CONTROLLER = /@(?:RestController|Controller)\b/;
|
|
21143
21981
|
MULTIPART_PARAM = /\bMultipartFile\b/g;
|
|
21144
21982
|
ALLOWLIST = /\bALLOWED_EXTENSIONS?\b|\ballowedExtensions?\b|\bALLOWED_CONTENT_TYPES?\b|\ballowedContentTypes?\b|\bALLOWED_MIME_TYPES?\b/;
|
|
@@ -21209,7 +22047,7 @@ ${rules.join("\n")}
|
|
|
21209
22047
|
}
|
|
21210
22048
|
];
|
|
21211
22049
|
}
|
|
21212
|
-
const evidence19 = handlers.slice(0,
|
|
22050
|
+
const evidence19 = handlers.slice(0, MAX_EVIDENCE322).map((h) => ({
|
|
21213
22051
|
file: h.file,
|
|
21214
22052
|
line: h.line,
|
|
21215
22053
|
sinkId: `pointer/${CONTROL_ID4}`,
|
|
@@ -21374,7 +22212,7 @@ ${rules.join("\n")}
|
|
|
21374
22212
|
};
|
|
21375
22213
|
}
|
|
21376
22214
|
});
|
|
21377
|
-
var escapeInline, escapeInlinePreservingCodeSpans, escapeCodeSpan, escapeTableCell, fenceFor, SEVERITY_DESC, severityLabel, groupBySeverity, groupByField, categoryOf, groupFindings, countBySeverity2, topFiles, topRootCauses, SEVERITY_SYMBOL, formatDuration, renderHeader, ruleRecallRiskSkips, renderAiStats, renderSummary, renderSnippet, languageHintFromPath, renderFinding, renderGroup, renderFindingsSection, renderFooter, renderReport, createMarkdownReporter, SEVERITY_DESC2, SEVERITY_RANK, SEVERITY_LABEL, pickModal, groupByRule, formatDuration2, renderCompactHeader, renderSeverityTable, renderRulesTable, renderCompactSummary, MAX_INLINE_LOCATIONS, renderRuleSection, renderCompactFindings, renderCompactFooter, renderCompactReport, createMarkdownCompactReporter, JSON_SCHEMA_VERSION, buildRunBlock, buildRangeBlock, buildFindingBlock, projectSkipReasons, buildAiStatsBlock, buildJsonDocument, renderJsonReport, createJsonReporter, SARIF_SCHEMA, SARIF_VERSION, SEVERITY_TO_LEVEL, toFileUri, toArtifactUri, buildRegion, buildResult, buildRules, sarifSkipReasons, buildInvocation, buildSarifReport, renderSarifReport, createSarifReporter, VERDICT_LABEL, noteFor, renderHeader2, renderPolicy, countVerdict, renderOverview, renderChecklistTable, renderEvidence, renderScenario, renderConfirmedDetails, renderControlGaps, renderInconclusiveLeads, renderChecklistCoverage, REASON_HEADING, REASON_NOTE, renderUnassessedGroup, renderUnassessed, renderCoverage, renderFooter2, renderAssessmentReport, renderAssessmentJson, renderVerificationManifest, renderClientVerificationReadme, E1_PROVENANCE_BADGE, VERDICT_BADGE, renderVerificationRunReport, VERDICT_BADGE2, renderClientVerificationRunReport, RUNTIME_BADGE, meaningFor, countSuffix, renderChecklistCorrelation, CODE_BADGE, DAST_PROVENANCE_BADGE, RUNTIME_BADGE2, runtimeCell, dastFullyUnscanned, dastRuntimeCell, clientRuntimeCell, sastCell, meaningFor2, renderHeader3, renderOverview2, renderCorrelationReport, PLAN_FILE, MANIFEST_FILE, REPORT_FILE, renderDastReadme, VERDICT_BADGE3, verdictCell, PROVENANCE_BADGE, COVERAGE_BADGE, hoursOf2, coverageCause, COVERAGE_COUNT, renderDastRunReport, locationOf, renderSastRunReport, UNASSESSED_LABEL, renderUnassessedSection, metaLine, fileNameOf, renderHandoffPacket, renderHandoffManifest;
|
|
22215
|
+
var escapeInline, escapeInlinePreservingCodeSpans, escapeCodeSpan, escapeTableCell, fenceFor, SEVERITY_DESC, severityLabel, groupBySeverity, groupByField, categoryOf, groupFindings, countBySeverity2, topFiles, topRootCauses, SEVERITY_SYMBOL, formatDuration, renderHeader, ruleRecallRiskSkips, renderAiStats, renderSummary, renderSnippet, languageHintFromPath, renderFinding, renderGroup, renderFindingsSection, renderFooter, renderReport, createMarkdownReporter, SEVERITY_DESC2, SEVERITY_RANK, SEVERITY_LABEL, pickModal, groupByRule, formatDuration2, renderCompactHeader, renderSeverityTable, renderRulesTable, renderCompactSummary, MAX_INLINE_LOCATIONS, renderRuleSection, renderCompactFindings, renderCompactFooter, renderCompactReport, createMarkdownCompactReporter, JSON_SCHEMA_VERSION, buildRunBlock, buildRangeBlock, buildFindingBlock, projectSkipReasons, buildAiStatsBlock, buildJsonDocument, renderJsonReport, createJsonReporter, SARIF_SCHEMA, SARIF_VERSION, SEVERITY_TO_LEVEL, toFileUri, toArtifactUri, buildRegion, buildResult, buildRules, sarifSkipReasons, buildInvocation, buildSarifReport, renderSarifReport, createSarifReporter, VERDICT_LABEL, noteFor, renderHeader2, renderPolicy, countVerdict, renderOverview, renderChecklistTable, renderEvidence, renderScenario, renderConfirmedDetails, renderControlGaps, renderInconclusiveLeads, renderChecklistCoverage, REASON_HEADING, REASON_NOTE, renderUnassessedGroup, renderUnassessed, renderCoverage, renderFooter2, renderAssessmentReport, renderAssessmentJson, renderVerificationManifest, renderClientVerificationReadme, E1_PROVENANCE_BADGE, VERDICT_BADGE, renderVerificationRunReport, VERDICT_BADGE2, renderClientVerificationRunReport, RUNTIME_BADGE, meaningFor, countSuffix, renderChecklistCorrelation, CODE_BADGE, DAST_PROVENANCE_BADGE, RUNTIME_BADGE2, runtimeCell, dastFullyUnscanned, dastRuntimeCell, clientRuntimeCell, sastCell, meaningFor2, renderHeader3, renderOverview2, renderCorrelationReport, PLAN_FILE, MANIFEST_FILE, REPORT_FILE, DAST_PROBE_SCRIPT_FILE2, DAST_PROBE_FILE, renderDastReadme, VERDICT_BADGE3, verdictCell, PROVENANCE_BADGE, COVERAGE_BADGE, hoursOf2, coverageCause, COVERAGE_COUNT, renderDastRunReport, locationOf, renderSastRunReport, UNASSESSED_LABEL, renderUnassessedSection, metaLine, fileNameOf, renderHandoffPacket, renderHandoffManifest;
|
|
21378
22216
|
var init_dist6 = __esm({
|
|
21379
22217
|
"../reporters/dist/index.js"() {
|
|
21380
22218
|
init_dist2();
|
|
@@ -21648,9 +22486,9 @@ ${fence}`;
|
|
|
21648
22486
|
}
|
|
21649
22487
|
return lines.join("\n");
|
|
21650
22488
|
};
|
|
21651
|
-
renderGroup = (
|
|
21652
|
-
const heading = `### ${escapeInline(
|
|
21653
|
-
const items =
|
|
22489
|
+
renderGroup = (group2) => {
|
|
22490
|
+
const heading = `### ${escapeInline(group2.label)} (${group2.findings.length})`;
|
|
22491
|
+
const items = group2.findings.map(renderFinding).join("\n\n---\n\n");
|
|
21654
22492
|
return `${heading}
|
|
21655
22493
|
|
|
21656
22494
|
${items}`;
|
|
@@ -21849,31 +22687,31 @@ ${body}`;
|
|
|
21849
22687
|
return lines.join("\n");
|
|
21850
22688
|
};
|
|
21851
22689
|
MAX_INLINE_LOCATIONS = 30;
|
|
21852
|
-
renderRuleSection = (
|
|
21853
|
-
const conf =
|
|
21854
|
-
const fixBadge =
|
|
21855
|
-
const heading = `### ${escapeCodeSpan(
|
|
21856
|
-
const bodyLines = [heading, "", `> ${escapeInlinePreservingCodeSpans(
|
|
21857
|
-
if (
|
|
22690
|
+
renderRuleSection = (group2) => {
|
|
22691
|
+
const conf = group2.confidenceRange ? group2.confidenceRange.min === group2.confidenceRange.max ? `${group2.confidenceRange.min}% confidence` : `confidence ${group2.confidenceRange.min}-${group2.confidenceRange.max}%` : "no confidence";
|
|
22692
|
+
const fixBadge = group2.fixableCount > 0 ? ` \xB7 \u{1F527} ${group2.fixableCount} fixable${group2.hasUnsafeFix ? " (unsafe)" : ""}` : "";
|
|
22693
|
+
const heading = `### ${escapeCodeSpan(group2.ruleId)} \u2014 ${group2.findings.length} finding(s) \xB7 ${SEVERITY_LABEL[group2.severity]} \xB7 ${conf}${fixBadge}`;
|
|
22694
|
+
const bodyLines = [heading, "", `> ${escapeInlinePreservingCodeSpans(group2.message)}`];
|
|
22695
|
+
if (group2.suggestion) {
|
|
21858
22696
|
bodyLines.push("");
|
|
21859
|
-
bodyLines.push(`**Suggestion**: ${escapeInlinePreservingCodeSpans(
|
|
22697
|
+
bodyLines.push(`**Suggestion**: ${escapeInlinePreservingCodeSpans(group2.suggestion)}`);
|
|
21860
22698
|
}
|
|
21861
|
-
if (
|
|
22699
|
+
if (group2.fixableCount > 0) {
|
|
21862
22700
|
bodyLines.push("");
|
|
21863
22701
|
bodyLines.push(
|
|
21864
|
-
`**Fix**: \`cs fix${
|
|
22702
|
+
`**Fix**: \`cs fix${group2.hasUnsafeFix ? " --unsafe" : ""}\` applies ${group2.fixableCount} edit(s) for this rule (run with \`--dry-run\` first to preview).`
|
|
21865
22703
|
);
|
|
21866
22704
|
}
|
|
21867
|
-
const baseline =
|
|
21868
|
-
const locationLines =
|
|
22705
|
+
const baseline = group2.baselineConfidence;
|
|
22706
|
+
const locationLines = group2.findings.map((f) => {
|
|
21869
22707
|
const loc = `${f.file}:${f.range.line}:${f.range.column}`;
|
|
21870
22708
|
const confBadge = f.confidence !== void 0 && f.confidence !== baseline ? ` _(${f.confidence}%)_` : "";
|
|
21871
22709
|
return `- ${escapeCodeSpan(loc)}${confBadge}`;
|
|
21872
22710
|
});
|
|
21873
22711
|
bodyLines.push("");
|
|
21874
|
-
if (
|
|
22712
|
+
if (group2.findings.length > MAX_INLINE_LOCATIONS) {
|
|
21875
22713
|
bodyLines.push(
|
|
21876
|
-
`<details><summary>Locations (${
|
|
22714
|
+
`<details><summary>Locations (${group2.findings.length}) \u2014 click to expand</summary>`
|
|
21877
22715
|
);
|
|
21878
22716
|
bodyLines.push("");
|
|
21879
22717
|
bodyLines.push(...locationLines);
|
|
@@ -23332,6 +24170,8 @@ ${body}`;
|
|
|
23332
24170
|
PLAN_FILE = "code-sentinel-dast-plan.yaml";
|
|
23333
24171
|
MANIFEST_FILE = "code-sentinel-dast.json";
|
|
23334
24172
|
REPORT_FILE = "code-sentinel-zap-report.json";
|
|
24173
|
+
DAST_PROBE_SCRIPT_FILE2 = "code-sentinel-dast-probe.sh";
|
|
24174
|
+
DAST_PROBE_FILE = "probe-results.json";
|
|
23335
24175
|
renderDastReadme = (plan, meta) => {
|
|
23336
24176
|
const version2 = meta.toolVersion ? ` \xB7 code-sentinel ${meta.toolVersion}` : "";
|
|
23337
24177
|
const lines = [
|
|
@@ -23500,12 +24340,17 @@ ${body}`;
|
|
|
23500
24340
|
lines.push("");
|
|
23501
24341
|
}
|
|
23502
24342
|
lines.push(
|
|
23503
|
-
`> **Sau khi ch\
|
|
24343
|
+
`> **Sau khi ch\u1EA7y**: \`cs dast-verify\` ingest report + \`${MANIFEST_FILE}\` b\u1EB1ng **strict join**`,
|
|
23504
24344
|
"> `executionTargetId` (ADR-0051 `#8.2`: c\xF9ng scan rule + HTTP method + \u0111\xFAng param, ho\u1EB7c route",
|
|
23505
24345
|
"> template cho path-injection) \u2192 flip `suspected \u2192 exploited/not-tested`; m\u1ED9t alert kh\u1EDBp NHI\u1EC0U H\u01A0N",
|
|
23506
24346
|
"> m\u1ED9t target l\xE0 `ambiguous-match` \u2192 `not-tested`, kh\xF4ng bao gi\u1EDD th\xE0nh `exploited` sai. Sau \u0111\xF3 fold",
|
|
23507
|
-
"> v\xE0o `cs correlate` theo kh\xF3a \
|
|
23508
|
-
"> Client-side (DOM-XSS/redirect) c\u1EA7n AJAX spider \u2014 t\
|
|
24347
|
+
"> v\xE0o `cs correlate` theo kh\xF3a \u011020 c\u1EA1nh tr\u01B0\u1EDBc E1/JUnit + E1.9/Playwright.",
|
|
24348
|
+
"> Client-side (DOM-XSS/redirect) c\u1EA7n AJAX spider \u2014 t\u01B0\u01A1ng lai sau.",
|
|
24349
|
+
">",
|
|
24350
|
+
"> **ADR-0071 \u2014 canary probe (object-store)**: khi manifest c\xF3 target mang probe spec, c\xF9ng th\u01B0 m\u1EE5c c\xF2n ch\u1EE9a",
|
|
24351
|
+
`> \`${DAST_PROBE_SCRIPT_FILE2}\` \u2014 script probe SINH T\u1EF0 \u0110\u1ED8NG, runtime fire SAU khi E1 baseline gate PASSED,`,
|
|
24352
|
+
`> \`${DAST_PROBE_FILE}\` n\u01A1i c\xF9ng th\u01B0 m\u1EE5c; \`cs dast-verify\` t\u1EF1 \u0111\u1ECDc n\u1EBFu file t\u1ED3n t\u1EA1i. Canary trong response`,
|
|
24353
|
+
"> \u2192 `exploited` (b\u1EB1ng ch\u1EE9ng D\u01AF\u01A0NG); kh\xF4ng match/skip \u2192 `not-tested` \u2014 probe kh\xF4ng bao gi\u1EDD sinh `blocked`.",
|
|
23509
24354
|
""
|
|
23510
24355
|
);
|
|
23511
24356
|
return lines.join("\n");
|
|
@@ -23516,7 +24361,11 @@ ${body}`;
|
|
|
23516
24361
|
"not-tested": "\u26AA not-tested",
|
|
23517
24362
|
suspected: "\u{1F7E1} suspected"
|
|
23518
24363
|
};
|
|
23519
|
-
verdictCell = (r) =>
|
|
24364
|
+
verdictCell = (r) => {
|
|
24365
|
+
if (r.reason === "ambiguous-match") return "\u26AA not-tested (ambiguous)";
|
|
24366
|
+
if (r.reason === "probe-canary") return "\u{1F534} exploited (canary)";
|
|
24367
|
+
return VERDICT_BADGE3[r.verdict];
|
|
24368
|
+
};
|
|
23520
24369
|
PROVENANCE_BADGE = {
|
|
23521
24370
|
verified: "\u2705 verified",
|
|
23522
24371
|
unverified: "\u26AA unverified",
|
|
@@ -23598,6 +24447,16 @@ ${body}`;
|
|
|
23598
24447
|
"> HTTP method + \u0111\xFAng param (query/header/body) ho\u1EB7c route template (path). M\u1ED9t alert kh\u1EDBp NHI\u1EC0U H\u01A0N",
|
|
23599
24448
|
"> m\u1ED9t target = `ambiguous-match` \u2192 `not-tested` (KH\xD4NG ph\u1EA3i `exploited`) v\xEC kh\xF4ng quy \u0111\u01B0\u1EE3c v\u1EC1 m\u1ED9t",
|
|
23600
24449
|
"> b\u1EC1 m\u1EB7t runtime; b\u1EB1ng ch\u1EE9ng c\u1EE7a m\u1ED9t target kh\u1EDBp \u0111\u01B0\u1EE3c fan-out ra m\u1ECDi scenario link.",
|
|
24450
|
+
// The canary paragraph is DATA-DRIVEN like the `blocked` one: with no probe upgrade the sentence
|
|
24451
|
+
// would describe a path that did not run this time.
|
|
24452
|
+
...resolutions.some((r) => r.reason === "probe-canary") ? [
|
|
24453
|
+
">",
|
|
24454
|
+
"> \u{1F9EA} **M\u1ED9t ph\u1EA7n `exploited` \u0111\u1EBFn t\u1EEB canary probe** ([ADR-0071]): E1 baseline \u0111\xE3 ch\u1EE9ng minh",
|
|
24455
|
+
"> request-shape ghi \u0111\u01B0\u1EE3c object store; E2 replay \u0110\xDANG shape \u0111\xF3 v\u1EDBi bucket-victim v\xE0 nh\u1EADn l\u1EA1i",
|
|
24456
|
+
"> canary token \u2014 ghi ch\xE9o tenant \u0110\xC3 \u0110\u01AF\u1EE2C CH\u1EE8NG MINH \u1EDF runtime, kh\xF4ng ph\u1EA3i suy \u0111o\xE1n t\u1EEB v\u1EAFng-m\u1EB7t",
|
|
24457
|
+
"> c\u1EE7a ZAP. Verdict v\u1EABn KH\xD4NG h\u1EA1 c\u1EA5p `CONFIRMED-VULN` \u2014 \u0111\u01B0\u1EDDng t\u1EA5n c\xF4ng trong M\xC3 v\u1EABn c\xF2n, V\u1EAAN ph\u1EA3i",
|
|
24458
|
+
"> s\u1EEDa m\xE3."
|
|
24459
|
+
] : [],
|
|
23601
24460
|
"",
|
|
23602
24461
|
`**Th\u1EDDi \u0111i\u1EC3m**: ${meta.generatedAt.toISOString()}${version2}`
|
|
23603
24462
|
];
|
|
@@ -23735,10 +24594,19 @@ ${body}`;
|
|
|
23735
24594
|
lines.push(
|
|
23736
24595
|
`- **Sink**: \`${escapeInline(`${r.sinkFile}:${r.sinkLine}`)}\` (\u0111\u01B0\u1EDDng t\u1EA5n c\xF4ng taint \u0111\xE3 ch\u1EE9ng minh)`
|
|
23737
24596
|
);
|
|
23738
|
-
if (r.
|
|
23739
|
-
|
|
23740
|
-
|
|
23741
|
-
|
|
24597
|
+
if (r.reason === "probe-canary") {
|
|
24598
|
+
lines.push(
|
|
24599
|
+
"- **B\u1EB1ng ch\u1EE9ng canary** ([ADR-0071]): E1 baseline \u0111\xE3 ch\u1EE9ng minh request-shape ghi \u0111\u01B0\u1EE3c object store; E2 replay \u0111\xFAng shape v\u1EDBi bucket-victim (bucket principal KH\xD4NG s\u1EDF h\u1EEFu) v\xE0 nh\u1EADn l\u1EA1i canary token \u2192 ghi ch\xE9o tenant ch\u1EE9ng minh \u0111\u01B0\u1EE3c \u1EDF runtime. \u0110\u1ED1i chi\u1EBFu `probe-results.json` trong artifacts c\u1EE7a c\xF9ng l\u1EA7n ch\u1EA1y."
|
|
24600
|
+
);
|
|
24601
|
+
lines.push(
|
|
24602
|
+
"- **Vi\u1EC7c c\u1EA7n l\xE0m**: x\xE1c nh\u1EADn canary token kh\u1EDBp v\xE0 probe-results.json c\xF9ng l\u1EA7n ch\u1EA1y v\u1EDBi report ZAP, r\u1ED3i s\u1EEDa l\u1ED7 h\u1ED5ng trong m\xE3 (\u0111\u01B0\u1EDDng t\u1EA5n c\xF4ng \u0111\xE3 \u0111\u01B0\u1EE3c taint ch\u1EE9ng minh)."
|
|
24603
|
+
);
|
|
24604
|
+
} else {
|
|
24605
|
+
if (r.detail !== void 0) lines.push(`- **B\u1EB1ng ch\u1EE9ng ZAP**: ${escapeInline(r.detail)}`);
|
|
24606
|
+
lines.push(
|
|
24607
|
+
"- **Vi\u1EC7c c\u1EA7n l\xE0m**: x\xE1c nh\u1EADn alert kh\xF4ng ph\u1EA3i false-positive c\u1EE7a ZAP, r\u1ED3i s\u1EEDa l\u1ED7 h\u1ED5ng trong m\xE3 (\u0111\u01B0\u1EDDng t\u1EA5n c\xF4ng \u0111\xE3 \u0111\u01B0\u1EE3c taint ch\u1EE9ng minh)."
|
|
24608
|
+
);
|
|
24609
|
+
}
|
|
23742
24610
|
lines.push("");
|
|
23743
24611
|
}
|
|
23744
24612
|
}
|
|
@@ -29283,7 +30151,7 @@ async function evaluateSliceWithAi(options) {
|
|
|
29283
30151
|
return { vulnerable: false, reason: `LLM execution error: ${message}` };
|
|
29284
30152
|
}
|
|
29285
30153
|
}
|
|
29286
|
-
var OLLAMA_DEFAULT_BASE, NETMIND_DEFAULT_BASE, OPENCODE_GO_DEFAULT_BASE, stripTrailingSlash2, buildLanguageModel, resolveModelOverride, pingTarget, shouldUseRawJsonChat, openAICompatibleChatUrl, REASONING_HEADROOM_TOKENS, NETMIND_MINIMAX_M3_MODEL, NETMIND_SMALL_PROMPT_MAX_CHARS, NETMIND_MEDIUM_PROMPT_MAX_CHARS, NETMIND_SMALL_OUTPUT_TOKENS, NETMIND_MEDIUM_OUTPUT_TOKENS, NETMIND_LARGE_OUTPUT_TOKENS, NETMIND_MAX_OUTPUT_TOKENS, supportsNetmindJsonResponseFormat, emptyResponseDiagnostics, effectiveMaxTokensFor, completeRawOpenAICompatibleJsonChat, createAiSdkProvider, createFallbackClient, numberLines, renderPrompt, cache, loadPromptTemplate, nullableOptional, AI_VIOLATION_MESSAGE_MAX_LENGTH, aiViolationSchema, aiResponseSchema, stripCodeFence, parseAiResponse, VIETNAMESE_OUTPUT_POLICY_VERSION, VIETNAMESE_OUTPUT_INSTRUCTION, TOKEN_BUDGET_WARN_DEFAULT, CHARS_PER_TOKEN, SAFETY_MARGIN, estimateTokens, formatTokenWarning, CACHE_NAMESPACE, DEFAULT_PROVIDER_RETRY_MAX_RETRIES, DEFAULT_PROVIDER_RETRY_MAX_DELAY_MS, DEFAULT_ADAPTIVE_RETRY_MAX_RETRIES, DEFAULT_ADAPTIVE_CONTEXT_REDUCTION_FACTOR, DEFAULT_ADAPTIVE_TIMEOUT_MULTIPLIER, DEFAULT_ADAPTIVE_MAX_DELAY_MS, DEFAULT_PROVIDER_TIMEOUT_MS, sleep, parseRetryDelayMs, providerRetryDelayMs, adaptiveFailureKind, compactClusterContext, findingDedupeKey, dedupeFindings, capFindings, createAiExecutor, PATH_FAST_PATHS, SPRING_BOOT_PATTERNS, ANGULAR_PATTERNS, FLUTTER_PATTERNS, ENTRY_HINTS, ALL_PATTERNS, matchesRule, classifyLayer, classifyLayers, PRIMARY_LAYER_CANDIDATES, TEST_AND_GENERATED, LAYER_SUFFIXES, FILE_SUFFIX_RE, ANY_EXT_RE, dropExt, stripPascalSuffix, normalize3, extractDomainTokens, extractDomainTokensBatch, TRIVIAL_TOKENS, sharesDomainToken, TS_IMPORT_RE, JAVA_IMPORT_RE, extractImports, POSIX_SEP_RE, sharedDirDepth, resolveImportTarget, KIND_STRENGTH, upsertEdge, buildEdges, ADVICE_ANNOTATION, isGlobalAdviceFile, findGlobalAdvicePaths, DEFAULT_MAX_CANDIDATES, DEFAULT_MAX_SUPPORT_FILES, DEFAULT_TOKEN_BUDGET, SCORE_DIRECT_NEIGHBOR, SCORE_SECOND_DEGREE, SCORE_SIBLING_STEM, SCORE_ANGULAR_TEMPLATE_SIBLING, SCORE_DOMAIN_TOKEN, PENALTY_TEST_VS_NON_TEST, PENALTY_GENERATED, SCORE_GLOBAL_ADVICE, prefilterCandidates, layerFlowBonus, isTest, isGenerated, scoreFor, tokensOf, trimToBudget, toMember, clusterIdFor, createClusterAssembler, CLUSTER_TREE_BUILDER_VERSION, DEFAULT_MODULE_DEPTH, posixDirname, moduleGroupKey, uniqueSortedPaths, memberFingerprint, featureNodeFor, moduleNodeFor, appNodeFor, countCrossModuleEdges, createClusterTreeBuilder, TRANSACTIONAL, TYPE_DECL3, METHOD_NAME2, MUTATION_CALL, LEADING_ANNOTATION2, SPRING_TX_SUPPORT_IMPORT, PROGRAMMATIC_TYPE, PROGRAMMATIC_CALL, INLINE_TEMPLATE_CALL, CONTROL_FLOW_NAMES, maskNonCode, methodNameFromHeader, methodAt, delegatedTargetAt, collectProgrammaticReceivers, readAttr, skipToDeclaration2, countMutations, lineOf19, configuredReadOnly, extractProgrammaticFromFile, extractFromFile2, extractTransactionBoundaries, renderPrDiffPrompt, nullableOptional2, prDiffResponseSchema, createPrDiffReviewer, renderGroupedRulePrompt, confidenceLabelSchema, severitySchema2, groupedResponseSchema, labelToConfidence, createGroupedRuleReviewer, renderPerRulePrompt, createPerRuleReviewer, DEFAULT_MAX_TOKENS, SYSTEM_PROMPT, SCHEMA_PROMPT, clip, buildUserPrompt, extractJsonObject, describeUnusableAnswer, createRuntimeAuthHypothesisResolver, extractJsonObject2;
|
|
30154
|
+
var OLLAMA_DEFAULT_BASE, NETMIND_DEFAULT_BASE, OPENCODE_GO_DEFAULT_BASE, stripTrailingSlash2, buildLanguageModel, resolveModelOverride, pingTarget, shouldUseRawJsonChat, openAICompatibleChatUrl, REASONING_HEADROOM_TOKENS, NETMIND_MINIMAX_M3_MODEL, NETMIND_SMALL_PROMPT_MAX_CHARS, NETMIND_MEDIUM_PROMPT_MAX_CHARS, NETMIND_SMALL_OUTPUT_TOKENS, NETMIND_MEDIUM_OUTPUT_TOKENS, NETMIND_LARGE_OUTPUT_TOKENS, NETMIND_MAX_OUTPUT_TOKENS, supportsNetmindJsonResponseFormat, emptyResponseDiagnostics, effectiveMaxTokensFor, completeRawOpenAICompatibleJsonChat, createAiSdkProvider, createFallbackClient, numberLines, renderPrompt, cache, loadPromptTemplate, nullableOptional, AI_VIOLATION_MESSAGE_MAX_LENGTH, aiViolationSchema, aiResponseSchema, stripCodeFence, parseAiResponse, VIETNAMESE_OUTPUT_POLICY_VERSION, VIETNAMESE_OUTPUT_INSTRUCTION, TOKEN_BUDGET_WARN_DEFAULT, CHARS_PER_TOKEN, SAFETY_MARGIN, estimateTokens, formatTokenWarning, CACHE_NAMESPACE, DEFAULT_PROVIDER_RETRY_MAX_RETRIES, DEFAULT_PROVIDER_RETRY_MAX_DELAY_MS, DEFAULT_ADAPTIVE_RETRY_MAX_RETRIES, DEFAULT_ADAPTIVE_CONTEXT_REDUCTION_FACTOR, DEFAULT_ADAPTIVE_TIMEOUT_MULTIPLIER, DEFAULT_ADAPTIVE_MAX_DELAY_MS, DEFAULT_PROVIDER_TIMEOUT_MS, sleep, parseRetryDelayMs, providerRetryDelayMs, adaptiveFailureKind, compactClusterContext, findingDedupeKey, dedupeFindings, capFindings, createAiExecutor, PATH_FAST_PATHS, SPRING_BOOT_PATTERNS, ANGULAR_PATTERNS, FLUTTER_PATTERNS, ENTRY_HINTS, ALL_PATTERNS, matchesRule, classifyLayer, classifyLayers, PRIMARY_LAYER_CANDIDATES, TEST_AND_GENERATED, LAYER_SUFFIXES, FILE_SUFFIX_RE, ANY_EXT_RE, dropExt, stripPascalSuffix, normalize3, extractDomainTokens, extractDomainTokensBatch, TRIVIAL_TOKENS, sharesDomainToken, TS_IMPORT_RE, JAVA_IMPORT_RE, extractImports, POSIX_SEP_RE, sharedDirDepth, resolveImportTarget, KIND_STRENGTH, upsertEdge, buildEdges, ADVICE_ANNOTATION, isGlobalAdviceFile, findGlobalAdvicePaths, DEFAULT_MAX_CANDIDATES, DEFAULT_MAX_SUPPORT_FILES, DEFAULT_TOKEN_BUDGET, SCORE_DIRECT_NEIGHBOR, SCORE_SECOND_DEGREE, SCORE_SIBLING_STEM, SCORE_ANGULAR_TEMPLATE_SIBLING, SCORE_DOMAIN_TOKEN, PENALTY_TEST_VS_NON_TEST, PENALTY_GENERATED, SCORE_GLOBAL_ADVICE, prefilterCandidates, layerFlowBonus, isTest, isGenerated, scoreFor, tokensOf, trimToBudget, toMember, clusterIdFor, createClusterAssembler, CLUSTER_TREE_BUILDER_VERSION, DEFAULT_MODULE_DEPTH, posixDirname, moduleGroupKey, uniqueSortedPaths, memberFingerprint, featureNodeFor, moduleNodeFor, appNodeFor, countCrossModuleEdges, createClusterTreeBuilder, TRANSACTIONAL, TYPE_DECL3, METHOD_NAME2, MUTATION_CALL, LEADING_ANNOTATION2, SPRING_TX_SUPPORT_IMPORT, PROGRAMMATIC_TYPE, PROGRAMMATIC_CALL, INLINE_TEMPLATE_CALL, CONTROL_FLOW_NAMES, maskNonCode, methodNameFromHeader, methodAt, delegatedTargetAt, collectProgrammaticReceivers, readAttr, skipToDeclaration2, countMutations, lineOf19, configuredReadOnly, extractProgrammaticFromFile, extractFromFile2, extractTransactionBoundaries, renderPrDiffPrompt, nullableOptional2, prDiffResponseSchema, createPrDiffReviewer, renderGroupedRulePrompt, confidenceLabelSchema, severitySchema2, groupedResponseSchema, labelToConfidence, createGroupedRuleReviewer, renderPerRulePrompt, createPerRuleReviewer, DEFAULT_MAX_TOKENS, SYSTEM_PROMPT, SCHEMA_PROMPT, clip, buildUserPrompt, extractJsonObject, describeUnusableAnswer, createRuntimeAuthHypothesisResolver, DEFAULT_MAX_TOKENS2, SYSTEM_PROMPT2, SCHEMA_PROMPT2, clip2, buildUserPrompt2, describeUnusableAnswer2, createRuntimeDataSeedResolver, extractJsonObject2;
|
|
29287
30155
|
var init_dist7 = __esm({
|
|
29288
30156
|
"../ai-engine/dist/index.js"() {
|
|
29289
30157
|
init_dist();
|
|
@@ -31965,6 +32833,148 @@ ${buildUserPrompt(request, options.maxEvidenceChars, logger)}`,
|
|
|
31965
32833
|
}
|
|
31966
32834
|
}
|
|
31967
32835
|
});
|
|
32836
|
+
DEFAULT_MAX_TOKENS2 = 4e3;
|
|
32837
|
+
SYSTEM_PROMPT2 = [
|
|
32838
|
+
"You analyse a Java/Spring service and decide WHICH ROWS its relational database must contain so",
|
|
32839
|
+
"its HTTP endpoints can be exercised against an EMPTY, disposable database. You are helping a",
|
|
32840
|
+
"security test harness seed pre-existing state (the entity row a path variable references, or the",
|
|
32841
|
+
"lookup rows a request payload needs). You never invent a schema: if the evidence does not show",
|
|
32842
|
+
"the tables and columns, say so.",
|
|
32843
|
+
"",
|
|
32844
|
+
"Answer with ONE JSON object and nothing else. Do not output SQL and do not invent identifiers:",
|
|
32845
|
+
"a separate deterministic step renders your rows into INSERT statements."
|
|
32846
|
+
].join("\n");
|
|
32847
|
+
SCHEMA_PROMPT2 = [
|
|
32848
|
+
"{",
|
|
32849
|
+
' "scheme": "<short label, letters/digits/dot/dash/underscore, e.g. sql-insert>",',
|
|
32850
|
+
' "targets": [',
|
|
32851
|
+
' { "httpMethod": "GET",',
|
|
32852
|
+
' "path": "<copy VERBATIM from the endpoint list>",',
|
|
32853
|
+
' "table": "<SQL table name>",',
|
|
32854
|
+
' "rows": [ { "<column>": "<string>" | <number> | <boolean> | null } ] }',
|
|
32855
|
+
" ],",
|
|
32856
|
+
' "evidence": ["<file you read this from>"]',
|
|
32857
|
+
"}",
|
|
32858
|
+
"",
|
|
32859
|
+
"Rules that will cause your answer to be REJECTED:",
|
|
32860
|
+
"- a table or column name that is not a SQL identifier (letters/digits/underscore, starting with",
|
|
32861
|
+
" a letter or underscore, at most 64 characters)",
|
|
32862
|
+
"- a value that is an object, an array, or an SQL expression (no NOW(), no sequence calls, no",
|
|
32863
|
+
" function calls of any kind)",
|
|
32864
|
+
"- more than 32 targets, more than 64 rows in one target, more than 32 columns in one row",
|
|
32865
|
+
"- two targets with the same httpMethod + path + table",
|
|
32866
|
+
"",
|
|
32867
|
+
"MATCHING: one target per listed endpoint that needs pre-existing state, matched EXACTLY by",
|
|
32868
|
+
"httpMethod and path \u2014 copy the path VERBATIM, a path that does not join is silently useless. An",
|
|
32869
|
+
"endpoint that needs no state gets NO target.",
|
|
32870
|
+
"",
|
|
32871
|
+
"WHAT TO SEED:",
|
|
32872
|
+
"- an endpoint whose path carries a variable (`{id}`) needs the entity ROW it will look up. The",
|
|
32873
|
+
"harness exercises the benign baseline with identifier '1', so include one row whose",
|
|
32874
|
+
"primary-key column equals 1.",
|
|
32875
|
+
"- a PUT/DELETE/PATCH needs the row it mutates to already exist \u2014 same primary-key rule.",
|
|
32876
|
+
"- a POST whose body references other rows by identifier needs those LOOKUP rows present, with",
|
|
32877
|
+
"the exact identifier values the payload will carry.",
|
|
32878
|
+
"- seed referenced/parent rows too: a row with a foreign key must have its parent present, or the",
|
|
32879
|
+
"INSERT itself fails and the seed is worthless.",
|
|
32880
|
+
"",
|
|
32881
|
+
"CHOOSING columns and values: include every column the evidence shows the application READING on",
|
|
32882
|
+
"this row, and every NOT NULL column without a default. A row missing a column the app reads",
|
|
32883
|
+
"makes the request fail AFTER the seed \u2014 the worst outcome, because it looks like a working seed.",
|
|
32884
|
+
"Match the JSON type to the column: strings for varchar/text/enum, numbers for numerics, booleans",
|
|
32885
|
+
"for booleans, and null ONLY for a nullable column the flow tolerates.",
|
|
32886
|
+
"",
|
|
32887
|
+
"If the evidence does not show the schema, return exactly: null"
|
|
32888
|
+
].join("\n");
|
|
32889
|
+
clip2 = (text2, max) => text2.length <= max ? text2 : `${text2.slice(0, max)}
|
|
32890
|
+
\u2026 [${text2.length - max} more characters]`;
|
|
32891
|
+
buildUserPrompt2 = (req, maxEvidence, logger) => {
|
|
32892
|
+
const parts = [];
|
|
32893
|
+
if (req.endpoints.length > 0) {
|
|
32894
|
+
parts.push(
|
|
32895
|
+
"",
|
|
32896
|
+
"Endpoints that will be exercised, with the state their signatures imply:",
|
|
32897
|
+
...req.endpoints.slice(0, 40).map((e) => {
|
|
32898
|
+
const reqs = e.seedRequirements.map((r) => `${r.kind} ${r.param} (${r.javaType})`).join(", ");
|
|
32899
|
+
return ` ${e.httpMethod} ${e.path}${reqs.length > 0 ? ` [${reqs}]` : ""}`;
|
|
32900
|
+
})
|
|
32901
|
+
);
|
|
32902
|
+
if (req.endpoints.length > 40) parts.push(` \u2026 and ${req.endpoints.length - 40} more`);
|
|
32903
|
+
}
|
|
32904
|
+
parts.push("", "Evidence:");
|
|
32905
|
+
let used = 0;
|
|
32906
|
+
const dropped = [];
|
|
32907
|
+
for (const ex of req.excerpts) {
|
|
32908
|
+
if (maxEvidence !== void 0 && used >= maxEvidence) {
|
|
32909
|
+
dropped.push(ex.path);
|
|
32910
|
+
continue;
|
|
32911
|
+
}
|
|
32912
|
+
const body = maxEvidence === void 0 ? ex.content : clip2(ex.content, maxEvidence - used);
|
|
32913
|
+
used += body.length;
|
|
32914
|
+
parts.push(`--- ${ex.path} ---`, body);
|
|
32915
|
+
}
|
|
32916
|
+
if (dropped.length > 0) {
|
|
32917
|
+
logger?.warn(
|
|
32918
|
+
`runtime-data-seed resolver: the ${maxEvidence}-character ceiling DROPPED ${dropped.length} excerpt(s): ${dropped.join(", ")}`
|
|
32919
|
+
);
|
|
32920
|
+
}
|
|
32921
|
+
if (req.priorRejection !== void 0 && req.priorRejection.length > 0) {
|
|
32922
|
+
parts.push(
|
|
32923
|
+
"",
|
|
32924
|
+
"Your PREVIOUS answer was REJECTED for this reason \u2014 fix ONLY this and keep everything else:",
|
|
32925
|
+
` ${req.priorRejection}`
|
|
32926
|
+
);
|
|
32927
|
+
}
|
|
32928
|
+
parts.push("", "Respond with the JSON object described above, or null.");
|
|
32929
|
+
return parts.join("\n");
|
|
32930
|
+
};
|
|
32931
|
+
describeUnusableAnswer2 = (text2) => {
|
|
32932
|
+
const bare = text2.replace(/^```(?:json)?/i, "").replace(/```$/, "").trim();
|
|
32933
|
+
if (/^null[.,]?$/i.test(bare)) {
|
|
32934
|
+
return "the model DECLINED (answered null) \u2014 the evidence did not show it a schema; this is the prompt/evidence to change, not the schema.";
|
|
32935
|
+
}
|
|
32936
|
+
if (!text2.includes("{")) {
|
|
32937
|
+
return `the model answered PROSE with no JSON object at all (${text2.length} chars) \u2014 it did not follow the output contract; tighten the instruction, not the schema.`;
|
|
32938
|
+
}
|
|
32939
|
+
return `the model answered something containing '{' but no BALANCED, parseable object could be read from it (${text2.length} chars) \u2014 the shape is close; check the schema prompt.`;
|
|
32940
|
+
};
|
|
32941
|
+
createRuntimeDataSeedResolver = (options) => ({
|
|
32942
|
+
resolve: async (request) => {
|
|
32943
|
+
const { client, logger } = options;
|
|
32944
|
+
try {
|
|
32945
|
+
const result = await client.complete({
|
|
32946
|
+
system: SYSTEM_PROMPT2,
|
|
32947
|
+
user: `${SCHEMA_PROMPT2}
|
|
32948
|
+
|
|
32949
|
+
${buildUserPrompt2(request, options.maxEvidenceChars, logger)}`,
|
|
32950
|
+
model: options.model ?? "",
|
|
32951
|
+
temperature: 0,
|
|
32952
|
+
maxTokens: options.maxTokens ?? DEFAULT_MAX_TOKENS2
|
|
32953
|
+
// responseFormat is deliberately ABSENT — see the header. Asking for JSON mode emptied the
|
|
32954
|
+
// response on the measured provider, which is indistinguishable from "found nothing".
|
|
32955
|
+
});
|
|
32956
|
+
if (!result.ok) {
|
|
32957
|
+
logger?.warn(`runtime-data-seed resolver: provider call FAILED \u2014 ${result.error.message}`);
|
|
32958
|
+
throw result.error;
|
|
32959
|
+
}
|
|
32960
|
+
const text2 = result.value.text.trim();
|
|
32961
|
+
if (text2.length === 0) {
|
|
32962
|
+
logger?.warn(
|
|
32963
|
+
"runtime-data-seed resolver: the model returned an EMPTY response; no hypothesis."
|
|
32964
|
+
);
|
|
32965
|
+
return null;
|
|
32966
|
+
}
|
|
32967
|
+
const parsed = extractJsonObject(text2);
|
|
32968
|
+
if (parsed === null) {
|
|
32969
|
+
logger?.warn(`runtime-data-seed resolver: ${describeUnusableAnswer2(text2)}`);
|
|
32970
|
+
}
|
|
32971
|
+
return parsed;
|
|
32972
|
+
} catch (e) {
|
|
32973
|
+
logger?.warn(`runtime-data-seed resolver: provider call THREW \u2014 ${e.message}`);
|
|
32974
|
+
throw e;
|
|
32975
|
+
}
|
|
32976
|
+
}
|
|
32977
|
+
});
|
|
31968
32978
|
extractJsonObject2 = (text2) => {
|
|
31969
32979
|
const start = text2.indexOf("{");
|
|
31970
32980
|
if (start === -1) return null;
|
|
@@ -42261,11 +43271,11 @@ var definedBuildValue = (value, fallback) => typeof value === "string" && value.
|
|
|
42261
43271
|
var getCliBuildMetadata = (version2) => ({
|
|
42262
43272
|
version: version2,
|
|
42263
43273
|
gitSha: definedBuildValue(
|
|
42264
|
-
"
|
|
43274
|
+
"44783c9956ee" ,
|
|
42265
43275
|
"unknown"
|
|
42266
43276
|
),
|
|
42267
43277
|
buildTimestamp: definedBuildValue(
|
|
42268
|
-
"2026-09-
|
|
43278
|
+
"2026-09-08T06:55:48.668Z" ,
|
|
42269
43279
|
"unknown"
|
|
42270
43280
|
),
|
|
42271
43281
|
configSchemaRange: definedBuildValue(
|
|
@@ -42679,7 +43689,7 @@ var SecretCommandError = class extends Error {
|
|
|
42679
43689
|
code;
|
|
42680
43690
|
};
|
|
42681
43691
|
var nativeRunner = {
|
|
42682
|
-
run: (command, args, input4) => new Promise((
|
|
43692
|
+
run: (command, args, input4) => new Promise((resolve55, reject) => {
|
|
42683
43693
|
const child = spawn(command, args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
42684
43694
|
let stdout = "";
|
|
42685
43695
|
let stderr = "";
|
|
@@ -42693,7 +43703,7 @@ var nativeRunner = {
|
|
|
42693
43703
|
});
|
|
42694
43704
|
child.on("error", (error) => reject(error));
|
|
42695
43705
|
child.on("close", (code2) => {
|
|
42696
|
-
if (code2 === 0)
|
|
43706
|
+
if (code2 === 0) resolve55(stdout);
|
|
42697
43707
|
else reject(new SecretCommandError(command, code2, stderr.trim() || `${command} failed`));
|
|
42698
43708
|
});
|
|
42699
43709
|
if (input4 !== void 0) child.stdin.end(input4);
|
|
@@ -43834,6 +44844,7 @@ init_dist5();
|
|
|
43834
44844
|
init_zod();
|
|
43835
44845
|
var SUITE_MANIFEST = "code-sentinel-suite.json";
|
|
43836
44846
|
var DAST_MANIFEST = "code-sentinel-dast.json";
|
|
44847
|
+
var DAST_PROBE_FILE2 = "probe-results.json";
|
|
43837
44848
|
var CLIENT_SUITE_MANIFEST = "code-sentinel-client-suite.json";
|
|
43838
44849
|
var toolVersion = () => {
|
|
43839
44850
|
const req = createRequire(import.meta.url);
|
|
@@ -43890,7 +44901,24 @@ var dastScenarioRefSchema = external_exports.object({
|
|
|
43890
44901
|
checklistId: external_exports.string(),
|
|
43891
44902
|
vulnerabilityClass: external_exports.string(),
|
|
43892
44903
|
sinkFile: external_exports.string(),
|
|
43893
|
-
sinkLine: external_exports.number()
|
|
44904
|
+
sinkLine: external_exports.number(),
|
|
44905
|
+
// [ADR-0071] additive: the sink-family discriminator stamped onto the scenario. Kept so Zod
|
|
44906
|
+
// does not STRIP it on read (mirrors the `#8.3.2` rule below).
|
|
44907
|
+
sinkId: external_exports.string().optional()
|
|
44908
|
+
});
|
|
44909
|
+
var dastProbeSpecSchema = external_exports.object({
|
|
44910
|
+
kind: external_exports.literal("object-store-cross-tenant"),
|
|
44911
|
+
method: external_exports.string(),
|
|
44912
|
+
urlPath: external_exports.string(),
|
|
44913
|
+
params: external_exports.array(
|
|
44914
|
+
external_exports.object({
|
|
44915
|
+
name: external_exports.string(),
|
|
44916
|
+
kind: external_exports.enum(["query", "path", "body", "header"]),
|
|
44917
|
+
value: external_exports.string()
|
|
44918
|
+
})
|
|
44919
|
+
),
|
|
44920
|
+
bodyJson: external_exports.string().optional(),
|
|
44921
|
+
e1GateClass: external_exports.string()
|
|
43894
44922
|
});
|
|
43895
44923
|
var dastManifestSchema = external_exports.object({
|
|
43896
44924
|
schemaVersion: external_exports.literal(2),
|
|
@@ -43907,7 +44935,9 @@ var dastManifestSchema = external_exports.object({
|
|
|
43907
44935
|
path: external_exports.string(),
|
|
43908
44936
|
injectionName: external_exports.string(),
|
|
43909
44937
|
injectionKind: external_exports.enum(["query", "path", "body", "header"]),
|
|
43910
|
-
scenarios: external_exports.array(dastScenarioRefSchema)
|
|
44938
|
+
scenarios: external_exports.array(dastScenarioRefSchema),
|
|
44939
|
+
// [ADR-0071] additive: the canary probe the runtime harness MAY execute for this surface.
|
|
44940
|
+
probe: dastProbeSpecSchema.optional()
|
|
43911
44941
|
})
|
|
43912
44942
|
),
|
|
43913
44943
|
skipped: external_exports.array(
|
|
@@ -43947,6 +44977,37 @@ var readDastAttestation = async (attestationPath) => {
|
|
|
43947
44977
|
const raw = await readFile(attestationPath, "utf8");
|
|
43948
44978
|
return dastAttestationSchema.parse(JSON.parse(raw));
|
|
43949
44979
|
};
|
|
44980
|
+
var dastProbeAttemptSchema = external_exports.object({
|
|
44981
|
+
executionTargetId: external_exports.string(),
|
|
44982
|
+
e1GateClass: external_exports.string(),
|
|
44983
|
+
gate: external_exports.enum([
|
|
44984
|
+
"e1-baseline-passed",
|
|
44985
|
+
"e1-baseline-missing",
|
|
44986
|
+
"e1-baseline-skipped",
|
|
44987
|
+
"e1-baseline-errored"
|
|
44988
|
+
]),
|
|
44989
|
+
canaryMatched: external_exports.boolean(),
|
|
44990
|
+
canaryToken: external_exports.string().optional(),
|
|
44991
|
+
httpStatus: external_exports.number().optional(),
|
|
44992
|
+
requestedPath: external_exports.string().optional(),
|
|
44993
|
+
note: external_exports.string().optional()
|
|
44994
|
+
});
|
|
44995
|
+
var dastProbeResultsSchema = external_exports.object({
|
|
44996
|
+
schemaVersion: external_exports.literal(1),
|
|
44997
|
+
generatedAt: external_exports.string(),
|
|
44998
|
+
attempts: external_exports.array(dastProbeAttemptSchema)
|
|
44999
|
+
});
|
|
45000
|
+
var readDastProbesIfPresent = async (planDir) => {
|
|
45001
|
+
const probesPath = join(planDir, DAST_PROBE_FILE2);
|
|
45002
|
+
let raw;
|
|
45003
|
+
try {
|
|
45004
|
+
raw = await readFile(probesPath, "utf8");
|
|
45005
|
+
} catch (e) {
|
|
45006
|
+
if (e.code === "ENOENT") return [];
|
|
45007
|
+
throw e;
|
|
45008
|
+
}
|
|
45009
|
+
return dastProbeResultsSchema.parse(JSON.parse(raw)).attempts;
|
|
45010
|
+
};
|
|
43950
45011
|
var dastDefenseObservationSchema = external_exports.object({
|
|
43951
45012
|
negativeOracleId: external_exports.string(),
|
|
43952
45013
|
decision: external_exports.enum(["reject", "deny", "allow"]),
|
|
@@ -44251,6 +45312,14 @@ var runAssess = async (options, deps = {}) => {
|
|
|
44251
45312
|
console.error(red("--emit-evidence is only meaningful with --emit-tests."));
|
|
44252
45313
|
return EXIT.USAGE;
|
|
44253
45314
|
}
|
|
45315
|
+
if (options.dataSeed !== void 0 && options.emitTests === void 0) {
|
|
45316
|
+
console.error(red("--data-seed is only meaningful with --emit-tests."));
|
|
45317
|
+
return EXIT.USAGE;
|
|
45318
|
+
}
|
|
45319
|
+
if (options.runtimeAuth !== void 0 && options.emitTests === void 0) {
|
|
45320
|
+
console.error(red("--runtime-auth is only meaningful with --emit-tests."));
|
|
45321
|
+
return EXIT.USAGE;
|
|
45322
|
+
}
|
|
44254
45323
|
if (options.scope !== void 0) {
|
|
44255
45324
|
if (!isReviewScope(options.scope)) {
|
|
44256
45325
|
console.error(
|
|
@@ -44660,13 +45729,84 @@ var runAssess = async (options, deps = {}) => {
|
|
|
44660
45729
|
}))
|
|
44661
45730
|
) : void 0;
|
|
44662
45731
|
const bootClass = detectSpringBootClass(files, options.module);
|
|
45732
|
+
let seedPlan;
|
|
45733
|
+
if (options.dataSeed !== void 0) {
|
|
45734
|
+
const seedPath = resolve(options.dataSeed);
|
|
45735
|
+
try {
|
|
45736
|
+
const raw = JSON.parse(await readFile(seedPath, "utf8"));
|
|
45737
|
+
const hypothesis = validateRuntimeDataSeedHypothesis(raw);
|
|
45738
|
+
if (hypothesis === null) {
|
|
45739
|
+
console.error(
|
|
45740
|
+
red(`--data-seed ${options.dataSeed} kh\xF4ng qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng).`)
|
|
45741
|
+
);
|
|
45742
|
+
return EXIT.USAGE;
|
|
45743
|
+
}
|
|
45744
|
+
const auditColumns = detectSeedAuditColumns(files);
|
|
45745
|
+
const enrichedHypothesis = applySeedAuditColumns(hypothesis, auditColumns);
|
|
45746
|
+
const addedAuditColumns = seedAuditAddedColumns(hypothesis, enrichedHypothesis);
|
|
45747
|
+
if (addedAuditColumns.length > 0) {
|
|
45748
|
+
console.error(
|
|
45749
|
+
dim(
|
|
45750
|
+
`[data-seed] B\u1ED5 sung ${addedAuditColumns.length} c\u1ED9t audit NOT NULL t\u1EEB entity: ${addedAuditColumns.join(", ")} (raw JDBC INSERT kh\xF4ng qua AuditingEntityListener \u2014 tr\xE1nh ERROR 1364).`
|
|
45751
|
+
)
|
|
45752
|
+
);
|
|
45753
|
+
}
|
|
45754
|
+
seedPlan = buildDataSeedPlan(enrichedHypothesis);
|
|
45755
|
+
console.error(
|
|
45756
|
+
dim(
|
|
45757
|
+
`[data-seed] E1 s\u1EBD gieo ${hypothesis.targets.length} target v\xE0o @BeforeAll (scheme \`${hypothesis.scheme}\`).`
|
|
45758
|
+
)
|
|
45759
|
+
);
|
|
45760
|
+
} catch (e) {
|
|
45761
|
+
console.error(
|
|
45762
|
+
red(`Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c --data-seed ${options.dataSeed}: ${e.message}`)
|
|
45763
|
+
);
|
|
45764
|
+
return EXIT.USAGE;
|
|
45765
|
+
}
|
|
45766
|
+
}
|
|
45767
|
+
let runtimeAuth;
|
|
45768
|
+
if (options.runtimeAuth !== void 0) {
|
|
45769
|
+
const authPath = resolve(options.runtimeAuth);
|
|
45770
|
+
try {
|
|
45771
|
+
const raw = JSON.parse(await readFile(authPath, "utf8"));
|
|
45772
|
+
const hypothesis = validateRuntimeAuthHypothesis(raw);
|
|
45773
|
+
if (hypothesis === null) {
|
|
45774
|
+
console.warn(
|
|
45775
|
+
yellow(
|
|
45776
|
+
`--runtime-auth ${options.runtimeAuth} kh\xF4ng qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t \u2014 E1 ch\u1EA1y KH\xD4NG auth runtime (baseline 401 \u21D2 not-tested nh\u01B0 tr\u01B0\u1EDBc).`
|
|
45777
|
+
)
|
|
45778
|
+
);
|
|
45779
|
+
} else if (hypothesis.transport !== "bearer-header") {
|
|
45780
|
+
console.warn(
|
|
45781
|
+
yellow(
|
|
45782
|
+
`--runtime-auth: transport '${hypothesis.transport}' ch\u01B0a h\u1ED7 tr\u1EE3 \u1EDF E1 (ch\u1EC9 bearer-header) \u2014 E1 ch\u1EA1y KH\xD4NG auth runtime.`
|
|
45783
|
+
)
|
|
45784
|
+
);
|
|
45785
|
+
} else {
|
|
45786
|
+
runtimeAuth = { envVar: "CS_RUNTIME_TOKEN" };
|
|
45787
|
+
console.error(
|
|
45788
|
+
dim(
|
|
45789
|
+
`[runtime-auth] E1 g\u1EAFn Bearer runtime token t\u1EEB $CS_RUNTIME_TOKEN (scheme \`${hypothesis.scheme}\`) \u2014 token do pipeline mint, suite kh\xF4ng t\u1EF1 mint.`
|
|
45790
|
+
)
|
|
45791
|
+
);
|
|
45792
|
+
}
|
|
45793
|
+
} catch (e) {
|
|
45794
|
+
console.warn(
|
|
45795
|
+
yellow(
|
|
45796
|
+
`Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c --runtime-auth ${options.runtimeAuth}: ${e.message} \u2014 E1 ch\u1EA1y KH\xD4NG auth runtime.`
|
|
45797
|
+
)
|
|
45798
|
+
);
|
|
45799
|
+
}
|
|
45800
|
+
}
|
|
44663
45801
|
const suite = generateVerificationSuite(scenarios, {
|
|
44664
45802
|
...bootClass !== null ? { bootClass } : {},
|
|
44665
45803
|
...dbTier ? { dbTier } : {},
|
|
44666
45804
|
...options.dbRuntime ? { dbRuntime: options.dbRuntime } : {},
|
|
44667
45805
|
...authFills ? { authFills } : {},
|
|
44668
45806
|
// ADR-0049 (#2b): --emit-evidence makes each @Test write a dual-run evidence sidecar.
|
|
44669
|
-
...options.emitEvidence ? { emitEvidence: true } : {}
|
|
45807
|
+
...options.emitEvidence ? { emitEvidence: true } : {},
|
|
45808
|
+
...seedPlan !== void 0 ? { seedPlan } : {},
|
|
45809
|
+
...runtimeAuth !== void 0 ? { runtimeAuth } : {}
|
|
44670
45810
|
});
|
|
44671
45811
|
const emitDir = resolve(target, options.emitTests);
|
|
44672
45812
|
const confirmedPlan = validateHarnessPlan(buildHarnessPlan(files), {
|
|
@@ -44941,6 +46081,10 @@ var runAssess = async (options, deps = {}) => {
|
|
|
44941
46081
|
`,
|
|
44942
46082
|
"utf8"
|
|
44943
46083
|
);
|
|
46084
|
+
const probeScript = renderDastProbeScript(dastManifest);
|
|
46085
|
+
if (probeScript !== null) {
|
|
46086
|
+
await writeFile(resolve(emitDir, DAST_PROBE_SCRIPT_FILE), probeScript, "utf8");
|
|
46087
|
+
}
|
|
44944
46088
|
} catch (e) {
|
|
44945
46089
|
console.error(red(`Kh\xF4ng ghi \u0111\u01B0\u1EE3c k\u1EBF ho\u1EA1ch DAST: ${e.message}`));
|
|
44946
46090
|
return EXIT.RUNTIME;
|
|
@@ -45183,7 +46327,7 @@ var openBrowser = async (url) => {
|
|
|
45183
46327
|
else await execFile2("xdg-open", [url]);
|
|
45184
46328
|
};
|
|
45185
46329
|
var credentialStore = () => createPlatformCredentialStore();
|
|
45186
|
-
var sleep2 = (milliseconds) => new Promise((
|
|
46330
|
+
var sleep2 = (milliseconds) => new Promise((resolve55) => setTimeout(resolve55, milliseconds));
|
|
45187
46331
|
var defaults = () => ({
|
|
45188
46332
|
store: credentialStore(),
|
|
45189
46333
|
start: startDeviceAuthorization,
|
|
@@ -46236,7 +47380,7 @@ var resolveGroupedRoutingLimits = (input4) => {
|
|
|
46236
47380
|
const tokenBudget = Math.max(2e3, input4.tokenBudget ?? 5e4);
|
|
46237
47381
|
const fileTokens = Math.max(1, input4.estimateTokens(input4.profile.file.content));
|
|
46238
47382
|
const ruleTexts = input4.groups.flatMap(
|
|
46239
|
-
(
|
|
47383
|
+
(group2) => group2.rules.map((rule) => `${rule.id}
|
|
46240
47384
|
${rule.title}
|
|
46241
47385
|
${rule.description ?? ""}`)
|
|
46242
47386
|
);
|
|
@@ -46283,7 +47427,7 @@ var buildFullReviewSmartSelection = (input4) => {
|
|
|
46283
47427
|
}
|
|
46284
47428
|
return selected;
|
|
46285
47429
|
};
|
|
46286
|
-
var selectRulesForGroup = (
|
|
47430
|
+
var selectRulesForGroup = (group2, profile, maxRules) => group2.rules.filter(
|
|
46287
47431
|
(rule) => classifyRuleApplicability(rule, profile) !== PR_RULE_APPLICABILITY.NOT_APPLICABLE
|
|
46288
47432
|
).sort(
|
|
46289
47433
|
(a, b) => (b.prRouting?.riskWeight ?? 0) - (a.prRouting?.riskWeight ?? 0) || a.id.localeCompare(b.id)
|
|
@@ -46318,11 +47462,11 @@ var buildAiReviewPlan = (input4) => {
|
|
|
46318
47462
|
});
|
|
46319
47463
|
limitsByFile.set(profile.file.path, limits);
|
|
46320
47464
|
let groupsForFile = 0;
|
|
46321
|
-
for (const
|
|
47465
|
+
for (const group2 of groups) {
|
|
46322
47466
|
if (groupsForFile >= limits.maxGroupsPerFile) break;
|
|
46323
|
-
const rules = selectRulesForGroup(
|
|
47467
|
+
const rules = selectRulesForGroup(group2, profile, limits.maxRulesPerGroup);
|
|
46324
47468
|
if (rules.length === 0) continue;
|
|
46325
|
-
groupedCalls.push({ profile, groupId:
|
|
47469
|
+
groupedCalls.push({ profile, groupId: group2.id, rules });
|
|
46326
47470
|
groupsForFile += 1;
|
|
46327
47471
|
}
|
|
46328
47472
|
}
|
|
@@ -46332,8 +47476,8 @@ var buildAiReviewPlan = (input4) => {
|
|
|
46332
47476
|
if (maxSpecializedCalls > 0) {
|
|
46333
47477
|
const candidates = [];
|
|
46334
47478
|
for (const profile of primaryProfiles) {
|
|
46335
|
-
for (const
|
|
46336
|
-
for (const rule of
|
|
47479
|
+
for (const group2 of groups) {
|
|
47480
|
+
for (const rule of group2.rules) {
|
|
46337
47481
|
if (!ruleMatchesProfile(rule, profile)) continue;
|
|
46338
47482
|
candidates.push({ profile, rule });
|
|
46339
47483
|
}
|
|
@@ -49990,7 +51134,7 @@ var NodeFsHandler = class {
|
|
|
49990
51134
|
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
|
49991
51135
|
}
|
|
49992
51136
|
}).on(EV.ERROR, this._boundHandleError);
|
|
49993
|
-
return new Promise((
|
|
51137
|
+
return new Promise((resolve55, reject) => {
|
|
49994
51138
|
if (!stream)
|
|
49995
51139
|
return reject();
|
|
49996
51140
|
stream.once(STR_END, () => {
|
|
@@ -49999,7 +51143,7 @@ var NodeFsHandler = class {
|
|
|
49999
51143
|
return;
|
|
50000
51144
|
}
|
|
50001
51145
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
50002
|
-
|
|
51146
|
+
resolve55(void 0);
|
|
50003
51147
|
previous.getChildren().filter((item15) => {
|
|
50004
51148
|
return item15 !== directory && !current.has(item15);
|
|
50005
51149
|
}).forEach((item15) => {
|
|
@@ -50958,11 +52102,11 @@ var getLocalEffectiveConfig = async (input4) => {
|
|
|
50958
52102
|
}
|
|
50959
52103
|
};
|
|
50960
52104
|
var LABEL_WIDTH = 20;
|
|
50961
|
-
var
|
|
52105
|
+
var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
50962
52106
|
var pick = (source, path) => {
|
|
50963
52107
|
let current = source;
|
|
50964
52108
|
for (const key of path) {
|
|
50965
|
-
if (!
|
|
52109
|
+
if (!isRecord4(current)) return void 0;
|
|
50966
52110
|
current = current[key];
|
|
50967
52111
|
}
|
|
50968
52112
|
return current;
|
|
@@ -50970,7 +52114,7 @@ var pick = (source, path) => {
|
|
|
50970
52114
|
var asString6 = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
|
|
50971
52115
|
var countOf = (value) => {
|
|
50972
52116
|
if (Array.isArray(value)) return value.length;
|
|
50973
|
-
if (
|
|
52117
|
+
if (isRecord4(value)) return Object.keys(value).length;
|
|
50974
52118
|
return 0;
|
|
50975
52119
|
};
|
|
50976
52120
|
var row = (label, value) => ` ${label.padEnd(LABEL_WIDTH)}${value}`;
|
|
@@ -52249,11 +53393,11 @@ var runWatchLoop = async (target, baseOptions) => {
|
|
|
52249
53393
|
ignored,
|
|
52250
53394
|
onBatch: (changed) => runIteration(changed)
|
|
52251
53395
|
});
|
|
52252
|
-
await new Promise((
|
|
53396
|
+
await new Promise((resolve55) => {
|
|
52253
53397
|
const onSigint = () => {
|
|
52254
53398
|
console.log();
|
|
52255
53399
|
console.log(dim("Stopping watcher\u2026"));
|
|
52256
|
-
|
|
53400
|
+
resolve55();
|
|
52257
53401
|
};
|
|
52258
53402
|
process.once("SIGINT", onSigint);
|
|
52259
53403
|
});
|
|
@@ -52659,6 +53803,17 @@ Ch\u1EA1y \`cs assess --emit-dast <dir>\` \u0111\u1EC3 sinh k\u1EBF ho\u1EA1ch t
|
|
|
52659
53803
|
);
|
|
52660
53804
|
return EXIT.USAGE;
|
|
52661
53805
|
}
|
|
53806
|
+
let dastProbeAttempts = [];
|
|
53807
|
+
try {
|
|
53808
|
+
dastProbeAttempts = await readDastProbesIfPresent(options.dastPlan);
|
|
53809
|
+
} catch (e) {
|
|
53810
|
+
console.error(
|
|
53811
|
+
red(
|
|
53812
|
+
`Kh\xF4ng \u0111\u1ECDc/parse \u0111\u01B0\u1EE3c ${DAST_PROBE_FILE2} t\u1EA1i ${resolve(options.dastPlan, DAST_PROBE_FILE2)}: ${e.message}`
|
|
53813
|
+
)
|
|
53814
|
+
);
|
|
53815
|
+
return EXIT.USAGE;
|
|
53816
|
+
}
|
|
52662
53817
|
dastReportPathResolved = resolve(options.dastReport);
|
|
52663
53818
|
try {
|
|
52664
53819
|
const rawDastReport = await readFile(dastReportPathResolved, "utf8");
|
|
@@ -52672,7 +53827,8 @@ Ch\u1EA1y \`cs assess --emit-dast <dir>\` \u0111\u1EC3 sinh k\u1EBF ho\u1EA1ch t
|
|
|
52672
53827
|
...messages !== void 0 ? { messages, scanCompleted: options.dastScanCompleted === true } : {},
|
|
52673
53828
|
...dastDefenseObservations !== void 0 ? { defenseObservations: dastDefenseObservations } : {},
|
|
52674
53829
|
...dastTrustTier !== void 0 ? { trustTier: dastTrustTier } : {},
|
|
52675
|
-
...dastAttemptId !== void 0 ? { attemptId: dastAttemptId } : {}
|
|
53830
|
+
...dastAttemptId !== void 0 ? { attemptId: dastAttemptId } : {},
|
|
53831
|
+
...dastProbeAttempts.length > 0 ? { probeAttempts: dastProbeAttempts } : {}
|
|
52676
53832
|
});
|
|
52677
53833
|
} catch (e) {
|
|
52678
53834
|
console.error(
|
|
@@ -52921,6 +54077,17 @@ Ch\u1EA1y \`cs assess --emit-dast <dir>\` \u0111\u1EC3 sinh k\u1EBF ho\u1EA1ch t
|
|
|
52921
54077
|
);
|
|
52922
54078
|
return EXIT.USAGE;
|
|
52923
54079
|
}
|
|
54080
|
+
let probeAttempts = [];
|
|
54081
|
+
try {
|
|
54082
|
+
probeAttempts = await readDastProbesIfPresent(options.plan);
|
|
54083
|
+
} catch (e) {
|
|
54084
|
+
console.error(
|
|
54085
|
+
red(
|
|
54086
|
+
`Kh\xF4ng \u0111\u1ECDc/parse \u0111\u01B0\u1EE3c ${DAST_PROBE_FILE2} t\u1EA1i ${resolve(options.plan, DAST_PROBE_FILE2)}: ${e.message}`
|
|
54087
|
+
)
|
|
54088
|
+
);
|
|
54089
|
+
return EXIT.USAGE;
|
|
54090
|
+
}
|
|
52924
54091
|
const reportPath = resolve(options.report);
|
|
52925
54092
|
let rawReport;
|
|
52926
54093
|
try {
|
|
@@ -53006,7 +54173,9 @@ Ch\u1EA1y \`cs assess --emit-dast <dir>\` \u0111\u1EC3 sinh k\u1EBF ho\u1EA1ch t
|
|
|
53006
54173
|
...messages !== void 0 ? { messages, scanCompleted: options.scanCompleted === true } : {},
|
|
53007
54174
|
...defenseObservations !== void 0 ? { defenseObservations } : {},
|
|
53008
54175
|
...trustTier !== void 0 ? { trustTier } : {},
|
|
53009
|
-
...attemptId !== void 0 ? { attemptId } : {}
|
|
54176
|
+
...attemptId !== void 0 ? { attemptId } : {},
|
|
54177
|
+
// [ADR-0071] probe pass 5 — only when attempts exist, else byte-identical.
|
|
54178
|
+
...probeAttempts.length > 0 ? { probeAttempts } : {}
|
|
53010
54179
|
};
|
|
53011
54180
|
const runReport2 = ingestDast(manifest, parsed, ingestOptions);
|
|
53012
54181
|
const version2 = toolVersion();
|
|
@@ -53076,6 +54245,13 @@ Ch\u1EA1y \`cs assess --emit-dast <dir>\` \u0111\u1EC3 sinh k\u1EBF ho\u1EA1ch t
|
|
|
53076
54245
|
);
|
|
53077
54246
|
}
|
|
53078
54247
|
}
|
|
54248
|
+
if (probeAttempts.length > 0) {
|
|
54249
|
+
console.log(
|
|
54250
|
+
dim(
|
|
54251
|
+
` \u{1F9EA} canary probe: ${probeAttempts.length} l\u1EA7n th\u1EED (ADR-0071) \u2014 ch\u1EC9 n\xE2ng not-tested \u2192 exploited khi canary kh\u1EDBp V\xC0 gate E1 pass; kh\xF4ng bao gi\u1EDD h\u1EA1 verdict`
|
|
54252
|
+
)
|
|
54253
|
+
);
|
|
54254
|
+
}
|
|
53079
54255
|
if (!runReport2.reportHasSites && runReport2.resolutions.length > 0) {
|
|
53080
54256
|
console.log(dim(" (report ZAP kh\xF4ng c\xF3 site n\xE0o \u2014 t\u1EA5t c\u1EA3 not-tested)"));
|
|
53081
54257
|
}
|
|
@@ -54719,7 +55895,7 @@ var unwrapProjectReviewConfig = (value) => {
|
|
|
54719
55895
|
}
|
|
54720
55896
|
return typeof value === "object" && value !== null ? value : {};
|
|
54721
55897
|
};
|
|
54722
|
-
var
|
|
55898
|
+
var isRecord5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
54723
55899
|
var aiProviderConfigKey = (provider) => {
|
|
54724
55900
|
switch (provider) {
|
|
54725
55901
|
case "viettel-netmind":
|
|
@@ -54742,14 +55918,14 @@ var mergeIfMissing = (target, key, value) => {
|
|
|
54742
55918
|
if (value !== void 0 && target[key] === void 0) target[key] = value;
|
|
54743
55919
|
};
|
|
54744
55920
|
var materializeDashboardRuntimeConfig = (config) => {
|
|
54745
|
-
const ai =
|
|
55921
|
+
const ai = isRecord5(config.ai) ? { ...config.ai } : {};
|
|
54746
55922
|
const provider = typeof ai.provider === "string" ? ai.provider : typeof config.aiProvider === "string" ? config.aiProvider : void 0;
|
|
54747
55923
|
mergeIfMissing(ai, "provider", provider);
|
|
54748
55924
|
mergeIfMissing(ai, "timeoutMs", config.aiTimeoutMs);
|
|
54749
55925
|
if (provider && provider !== "none") {
|
|
54750
55926
|
const providerKey = aiProviderConfigKey(provider);
|
|
54751
55927
|
if (providerKey) {
|
|
54752
|
-
const providerConfig =
|
|
55928
|
+
const providerConfig = isRecord5(ai[providerKey]) ? { ...ai[providerKey] } : {};
|
|
54753
55929
|
if (typeof config.aiModel === "string" && config.aiModel.trim().length > 0) {
|
|
54754
55930
|
mergeIfMissing(providerConfig, "model", config.aiModel.trim());
|
|
54755
55931
|
}
|
|
@@ -54760,7 +55936,7 @@ var materializeDashboardRuntimeConfig = (config) => {
|
|
|
54760
55936
|
}
|
|
54761
55937
|
}
|
|
54762
55938
|
if (Object.keys(ai).length > 0) config.ai = ai;
|
|
54763
|
-
const review =
|
|
55939
|
+
const review = isRecord5(config.review) ? { ...config.review } : {};
|
|
54764
55940
|
mergeIfMissing(review, "minSeverity", config.minSeverity);
|
|
54765
55941
|
mergeIfMissing(review, "extraInstructions", config.extraInstructions);
|
|
54766
55942
|
mergeIfMissing(
|
|
@@ -54769,7 +55945,7 @@ var materializeDashboardRuntimeConfig = (config) => {
|
|
|
54769
55945
|
config.baseline === "capture" ? "apply" : config.baseline ?? (config.findingsMode === "all" ? "ignore" : void 0)
|
|
54770
55946
|
);
|
|
54771
55947
|
if (Object.keys(review).length > 0) config.review = review;
|
|
54772
|
-
const report2 =
|
|
55948
|
+
const report2 = isRecord5(config.report) ? { ...config.report } : {};
|
|
54773
55949
|
const reportFormat = config.reportFormat === "both" ? "markdown" : config.reportFormat;
|
|
54774
55950
|
mergeIfMissing(report2, "format", reportFormat);
|
|
54775
55951
|
mergeIfMissing(report2, "output", config.reportOutput);
|
|
@@ -54814,7 +55990,7 @@ var isConfigSyncFormatError = (error) => error instanceof Error && error.message
|
|
|
54814
55990
|
var parseConfigFile = (text2) => parse$1(text2);
|
|
54815
55991
|
var localConfigToDashboardPolicy = (value) => {
|
|
54816
55992
|
const parsed = codeReviewConfigSchema.parse(value);
|
|
54817
|
-
const raw =
|
|
55993
|
+
const raw = isRecord5(value) ? value : {};
|
|
54818
55994
|
const policy = {};
|
|
54819
55995
|
for (const key of Object.keys(raw)) {
|
|
54820
55996
|
if (key === "dashboard") continue;
|
|
@@ -55549,9 +56725,194 @@ var runRuntimeAuthSeed = async (options) => {
|
|
|
55549
56725
|
return EXIT.SUCCESS;
|
|
55550
56726
|
};
|
|
55551
56727
|
|
|
56728
|
+
// src/commands/runtime-data-seed.command.ts
|
|
56729
|
+
init_dist7();
|
|
56730
|
+
init_dist2();
|
|
56731
|
+
init_dist5();
|
|
56732
|
+
init_dist();
|
|
56733
|
+
init_composition();
|
|
56734
|
+
init_load();
|
|
56735
|
+
init_exit_codes();
|
|
56736
|
+
init_find_files();
|
|
56737
|
+
var CONFIG_GLOBS2 = [
|
|
56738
|
+
"**/application*.yml",
|
|
56739
|
+
"**/application*.yaml",
|
|
56740
|
+
"**/application*.properties",
|
|
56741
|
+
"**/bootstrap*.yml",
|
|
56742
|
+
"**/bootstrap*.yaml",
|
|
56743
|
+
"**/bootstrap*.properties"
|
|
56744
|
+
];
|
|
56745
|
+
var DB_BUILD_GLOBS2 = ["**/pom.xml", "**/build.gradle", "**/build.gradle.kts"];
|
|
56746
|
+
var JAVA_GLOBS3 = ["**/*.java"];
|
|
56747
|
+
var SCHEMA_GLOBS = [
|
|
56748
|
+
"**/liquibase/**",
|
|
56749
|
+
"**/flyway/**",
|
|
56750
|
+
"**/db/migration/**",
|
|
56751
|
+
"**/*changelog*.xml",
|
|
56752
|
+
"**/schema.sql",
|
|
56753
|
+
"**/data.sql",
|
|
56754
|
+
"**/import.sql"
|
|
56755
|
+
];
|
|
56756
|
+
var EXCLUDES3 = ["**/node_modules/**", "**/dist/**", "**/target/**"];
|
|
56757
|
+
var MAX_EXCERPTS2 = 40;
|
|
56758
|
+
var ENTITY_RE = /@(Entity|Table)\b/;
|
|
56759
|
+
var buildDataSeedEvidence = (schemaFiles, entityFiles, configs) => [...schemaFiles, ...entityFiles, ...configs].slice(0, MAX_EXCERPTS2);
|
|
56760
|
+
var runRuntimeDataSeed = async (options) => {
|
|
56761
|
+
if (options.emitHypothesis !== void 0 && options.hypothesis !== void 0) {
|
|
56762
|
+
console.error(
|
|
56763
|
+
"[data-seed] --emit-hypothesis v\xE0 --hypothesis lo\u1EA1i tr\u1EEB nhau: m\u1ED9t b\xEAn GI\u1EA2I (ch\u1EA1y ngo\xE0i namespace c\xF4 l\u1EADp, n\u01A1i c\xF3 egress AI), m\u1ED9t b\xEAn TI\xCAU TH\u1EE4 (ch\u1EA1y trong pod, render SQL)."
|
|
56764
|
+
);
|
|
56765
|
+
return EXIT.USAGE;
|
|
56766
|
+
}
|
|
56767
|
+
if (options.renderSql !== void 0 && options.hypothesis === void 0) {
|
|
56768
|
+
console.error("[data-seed] --render-sql c\u1EA7n --hypothesis (lane ti\xEAu th\u1EE5 trong pod).");
|
|
56769
|
+
return EXIT.USAGE;
|
|
56770
|
+
}
|
|
56771
|
+
const source = resolve(process.cwd(), options.source);
|
|
56772
|
+
const configResult = await findFiles({
|
|
56773
|
+
projectRoot: source,
|
|
56774
|
+
include: CONFIG_GLOBS2,
|
|
56775
|
+
exclude: EXCLUDES3
|
|
56776
|
+
});
|
|
56777
|
+
const configs = configResult.ok ? configResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
|
|
56778
|
+
const buildResult2 = await findFiles({
|
|
56779
|
+
projectRoot: source,
|
|
56780
|
+
include: DB_BUILD_GLOBS2,
|
|
56781
|
+
exclude: EXCLUDES3
|
|
56782
|
+
});
|
|
56783
|
+
const javaResult = await findFiles({
|
|
56784
|
+
projectRoot: source,
|
|
56785
|
+
include: JAVA_GLOBS3,
|
|
56786
|
+
exclude: EXCLUDES3
|
|
56787
|
+
});
|
|
56788
|
+
const javaFiles = javaResult.ok ? javaResult.value : [];
|
|
56789
|
+
const endpoints = javaResult.ok ? extractHttpEndpoints(javaResult.value) : [];
|
|
56790
|
+
if (options.emitHypothesis !== void 0) {
|
|
56791
|
+
let resolver = createStubRuntimeDataSeedResolver();
|
|
56792
|
+
if (options.useAi === true) {
|
|
56793
|
+
const logger = createLogger({ level: "warn", destination: "stderr" });
|
|
56794
|
+
const config = await loadConfig(
|
|
56795
|
+
options.config === void 0 ? { cwd: source } : { cwd: source, configPath: resolve(process.cwd(), options.config) }
|
|
56796
|
+
);
|
|
56797
|
+
const client = config.ok ? buildAiClient(config.value.config, logger) : null;
|
|
56798
|
+
if (!config.ok) {
|
|
56799
|
+
console.error(
|
|
56800
|
+
`[data-seed] KH\xD4NG N\u1EA0P \u0110\u01AF\u1EE2C CONFIG (${config.error.message.split(String.fromCharCode(10))[0]}) \u2192 d\xF9ng resolver r\u1ED7ng. \u0110\xE2y l\xE0 l\u1ED7i FILE C\u1EA4U H\xCCNH, kh\xF4ng ph\u1EA3i thi\u1EBFu provider.`
|
|
56801
|
+
);
|
|
56802
|
+
} else if (client === null) {
|
|
56803
|
+
console.error(
|
|
56804
|
+
"[data-seed] --ai \u0111\u01B0\u1EE3c y\xEAu c\u1EA7u nh\u01B0ng kh\xF4ng c\xF3 provider AI n\xE0o c\u1EA5u h\xECnh \u0111\u01B0\u1EE3c (ai.provider=none ho\u1EB7c thi\u1EBFu key) \u2192 d\xF9ng resolver r\u1ED7ng."
|
|
56805
|
+
);
|
|
56806
|
+
} else {
|
|
56807
|
+
const resolverOptions = { client, logger };
|
|
56808
|
+
resolver = createRuntimeDataSeedResolver(resolverOptions);
|
|
56809
|
+
console.error(`[data-seed] H\u1ECFi gi\u1EA3 thuy\u1EBFt d\u1EEF li\u1EC7u qua ${client.name}.`);
|
|
56810
|
+
}
|
|
56811
|
+
}
|
|
56812
|
+
const manifest = buildReachabilityManifest(endpoints, {});
|
|
56813
|
+
const endpointSummaries = dataSeedEndpointSummaries(manifest.entries);
|
|
56814
|
+
const schemaResult = await findFiles({
|
|
56815
|
+
projectRoot: source,
|
|
56816
|
+
include: SCHEMA_GLOBS,
|
|
56817
|
+
exclude: EXCLUDES3
|
|
56818
|
+
});
|
|
56819
|
+
const schemaFiles = schemaResult.ok ? schemaResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
|
|
56820
|
+
const entityFiles = javaFiles.filter((f) => ENTITY_RE.test(f.content)).map((f) => ({ path: f.path, content: f.content }));
|
|
56821
|
+
const excerpts = buildDataSeedEvidence(schemaFiles, entityFiles, configs);
|
|
56822
|
+
if (options.useAi === true) {
|
|
56823
|
+
const chars = excerpts.reduce((n, e) => n + e.content.length, 0);
|
|
56824
|
+
console.error(
|
|
56825
|
+
`[data-seed] B\u1EB1ng ch\u1EE9ng: ${excerpts.length} excerpt \xB7 ${chars} k\xFD t\u1EF1 \xB7 ${endpointSummaries.length} endpoint c\u1EA7n seed.`
|
|
56826
|
+
);
|
|
56827
|
+
}
|
|
56828
|
+
const { hypothesis, outcome, rejectedShape } = await resolveRuntimeDataSeedHypothesis(
|
|
56829
|
+
resolver,
|
|
56830
|
+
{
|
|
56831
|
+
endpoints: endpointSummaries,
|
|
56832
|
+
excerpts
|
|
56833
|
+
}
|
|
56834
|
+
);
|
|
56835
|
+
if (hypothesis === null) {
|
|
56836
|
+
const why = outcome === "resolver-error" ? "G\u1ECCI PROVIDER TH\u1EA4T B\u1EA0I (m\u1EA1ng/egress/kho\xE1) \u2014 kh\xF4ng ph\u1EA3i model kh\xF4ng t\xECm ra g\xEC; xem d\xF2ng WARN c\u1EE7a resolver ngay tr\xEAn" : outcome === "rejected" ? `model C\xD3 tr\u1EA3 l\u1EDDi nh\u01B0ng KH\xD4NG QUA \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng) \u2014 v\u1EA5n \u0111\u1EC1 schema/prompt, kh\xF4ng ph\u1EA3i m\u1EA1ng. H\xECnh d\u1EA1ng nh\u1EADn \u0111\u01B0\u1EE3c: ${rejectedShape ?? "(kh\xF4ng c\xF3)"}` : "kh\xF4ng c\xF3 \u0111\u1EC1 xu\u1EA5t n\xE0o (resolver t\u1EEB ch\u1ED1i, ho\u1EB7c \u0111ang d\xF9ng resolver r\u1ED7ng)";
|
|
56837
|
+
console.error(
|
|
56838
|
+
`[data-seed] ${why} \u2192 KH\xD4NG ghi gi\u1EA3 thuy\u1EBFt; lane runtime s\u1EBD ch\u1EA1y \u0111\u01B0\u1EDDng t\u1EA5t \u0111\u1ECBnh (kh\xF4ng gieo d\u1EEF li\u1EC7u).`
|
|
56839
|
+
);
|
|
56840
|
+
return EXIT.SUCCESS;
|
|
56841
|
+
}
|
|
56842
|
+
const out = resolve(process.cwd(), options.emitHypothesis);
|
|
56843
|
+
await mkdir(resolve(out, ".."), { recursive: true });
|
|
56844
|
+
await writeFile(out, `${JSON.stringify(hypothesis, null, 2)}
|
|
56845
|
+
`, "utf8");
|
|
56846
|
+
console.error(
|
|
56847
|
+
`[data-seed] \u0110\xE3 ghi gi\u1EA3 thuy\u1EBFt \`${hypothesis.scheme}\` (${hypothesis.targets.length} target) ra ${options.emitHypothesis}; KH\xD4NG render SQL \u1EDF \u0111\xE2y.`
|
|
56848
|
+
);
|
|
56849
|
+
return EXIT.SUCCESS;
|
|
56850
|
+
}
|
|
56851
|
+
if (options.hypothesis !== void 0) {
|
|
56852
|
+
const path = resolve(process.cwd(), options.hypothesis);
|
|
56853
|
+
let validated = null;
|
|
56854
|
+
try {
|
|
56855
|
+
const raw = JSON.parse(await readFile(path, "utf8"));
|
|
56856
|
+
validated = validateRuntimeDataSeedHypothesis(raw);
|
|
56857
|
+
if (validated === null) {
|
|
56858
|
+
const problem = describeRuntimeDataSeedHypothesisProblem(raw);
|
|
56859
|
+
console.error(
|
|
56860
|
+
`[data-seed] Gi\u1EA3 thuy\u1EBFt n\u1EA1p t\u1EEB ${options.hypothesis} KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng${problem !== null ? `: ${problem}` : ""}) \u2192 KH\xD4NG render SQL.`
|
|
56861
|
+
);
|
|
56862
|
+
} else {
|
|
56863
|
+
console.error(
|
|
56864
|
+
`[data-seed] D\xF9ng gi\u1EA3 thuy\u1EBFt \`${validated.scheme}\` \u0111\xE3 gi\u1EA3i s\u1EB5n ngo\xE0i namespace c\xF4 l\u1EADp (kh\xF4ng g\u1ECDi model \u1EDF \u0111\xE2y).`
|
|
56865
|
+
);
|
|
56866
|
+
}
|
|
56867
|
+
} catch (e) {
|
|
56868
|
+
console.error(
|
|
56869
|
+
`[data-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt t\u1EEB ${options.hypothesis} (${e.message}) \u2192 KH\xD4NG render SQL.`
|
|
56870
|
+
);
|
|
56871
|
+
}
|
|
56872
|
+
if (validated === null) return EXIT.SUCCESS;
|
|
56873
|
+
const auditColumns = detectSeedAuditColumns(javaFiles);
|
|
56874
|
+
const enriched = applySeedAuditColumns(validated, auditColumns);
|
|
56875
|
+
const addedAuditColumns = seedAuditAddedColumns(validated, enriched);
|
|
56876
|
+
if (addedAuditColumns.length > 0) {
|
|
56877
|
+
console.error(
|
|
56878
|
+
`[data-seed] B\u1ED5 sung ${addedAuditColumns.length} c\u1ED9t audit NOT NULL t\u1EEB entity: ${addedAuditColumns.join(", ")} (raw JDBC INSERT kh\xF4ng qua AuditingEntityListener \u2014 tr\xE1nh ERROR 1364).`
|
|
56879
|
+
);
|
|
56880
|
+
}
|
|
56881
|
+
const dbTier = detectDbTier([
|
|
56882
|
+
...configResult.ok ? configResult.value : [],
|
|
56883
|
+
...buildResult2.ok ? buildResult2.value : []
|
|
56884
|
+
]);
|
|
56885
|
+
const dialect = dbTier?.dialect ?? "generic";
|
|
56886
|
+
let sql2;
|
|
56887
|
+
try {
|
|
56888
|
+
sql2 = renderDataSeedSql(enriched, dialect);
|
|
56889
|
+
} catch (e) {
|
|
56890
|
+
console.error(
|
|
56891
|
+
`[data-seed] Render SQL th\u1EA5t b\u1EA1i (${e.message}) \u2192 KH\xD4NG gieo d\u1EEF li\u1EC7u.`
|
|
56892
|
+
);
|
|
56893
|
+
return EXIT.SUCCESS;
|
|
56894
|
+
}
|
|
56895
|
+
const renderOut = options.renderSql;
|
|
56896
|
+
if (renderOut === void 0) return EXIT.USAGE;
|
|
56897
|
+
const out = resolve(process.cwd(), renderOut);
|
|
56898
|
+
await mkdir(resolve(out, ".."), { recursive: true });
|
|
56899
|
+
await writeFile(out, sql2, "utf8");
|
|
56900
|
+
console.error(
|
|
56901
|
+
`[data-seed] \u0110\xE3 render ${validated.targets.length} target \u2192 ${renderOut} (dialect: ${dialect}).`
|
|
56902
|
+
);
|
|
56903
|
+
console.error(`[data-seed] \u0110\u1ED8 L\u1EC6CH: ${runtimeDataSeedDeviationBanner(validated)}`);
|
|
56904
|
+
return EXIT.SUCCESS;
|
|
56905
|
+
}
|
|
56906
|
+
console.error(
|
|
56907
|
+
"[data-seed] Ch\u01B0a ch\u1EC9 \u0111\u1ECBnh vi\u1EC7c c\u1EA7n l\xE0m: d\xF9ng --emit-hypothesis (gi\u1EA3i ngo\xE0i pod, k\xE8m --ai) ho\u1EB7c --hypothesis + --render-sql (ti\xEAu th\u1EE5 trong pod)."
|
|
56908
|
+
);
|
|
56909
|
+
return EXIT.USAGE;
|
|
56910
|
+
};
|
|
56911
|
+
|
|
55552
56912
|
// src/commands/package.command.ts
|
|
55553
56913
|
init_dist5();
|
|
55554
56914
|
var HYPOTHESIS_ENTRY = ".code-sentinel/auth-hypothesis.json";
|
|
56915
|
+
var DATA_SEED_HYPOTHESIS_ENTRY = ".code-sentinel/data-seed-hypothesis.json";
|
|
55555
56916
|
var AI_TRIAGE_ENTRY = ".code-sentinel/ai-triage-assessment.json";
|
|
55556
56917
|
var formatBytes = (n) => n > 1024 * 1024 ? `${(n / (1024 * 1024)).toFixed(1)} MB` : `${(n / 1024).toFixed(0)} KB`;
|
|
55557
56918
|
var runPackageCommand = async (options) => {
|
|
@@ -55583,10 +56944,11 @@ ${candidates.map((c) => ` ${c}`).join("\n")}
|
|
|
55583
56944
|
return 2;
|
|
55584
56945
|
}
|
|
55585
56946
|
let planWithAuth = plan;
|
|
55586
|
-
const
|
|
56947
|
+
const resolveAuthLocally = options.resolveAuth === true && !options.push;
|
|
56948
|
+
const resolveAuthOnServer = options.resolveAuth === true && options.push === true;
|
|
55587
56949
|
let hypothesisTmp;
|
|
55588
56950
|
let triageTmp;
|
|
55589
|
-
if (
|
|
56951
|
+
if (resolveAuthLocally) {
|
|
55590
56952
|
hypothesisTmp = join(tmpdir(), `cs-auth-hypothesis-${process.pid}-${Date.now()}.json`);
|
|
55591
56953
|
triageTmp = join(tmpdir(), `cs-ai-triage-${process.pid}-${Date.now()}.json`);
|
|
55592
56954
|
await runRuntimeAuthSeed({
|
|
@@ -55607,7 +56969,7 @@ ${candidates.map((c) => ` ${c}`).join("\n")}
|
|
|
55607
56969
|
newEntries.push({ name: HYPOTHESIS_ENTRY, absolutePath: hypothesisTmp });
|
|
55608
56970
|
} else {
|
|
55609
56971
|
process.stderr.write(
|
|
55610
|
-
`cs package:
|
|
56972
|
+
`cs package: kh\xF4ng gi\u1EA3i \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt x\xE1c th\u1EF1c \u2014 ZIP kh\xF4ng mang gi\u1EA3 thuy\u1EBFt, lane runtime s\u1EBD ch\u1EA1y \u0111\u01B0\u1EDDng t\u1EA5t \u0111\u1ECBnh${String.fromCharCode(10)}`
|
|
55611
56973
|
);
|
|
55612
56974
|
}
|
|
55613
56975
|
if (existsSync(triageTmp)) {
|
|
@@ -55615,12 +56977,37 @@ ${candidates.map((c) => ` ${c}`).join("\n")}
|
|
|
55615
56977
|
}
|
|
55616
56978
|
planWithAuth = { ...plan, entries: newEntries };
|
|
55617
56979
|
}
|
|
56980
|
+
let dataSeedTmp;
|
|
56981
|
+
if (options.resolveDataSeed === true) {
|
|
56982
|
+
dataSeedTmp = join(tmpdir(), `cs-data-seed-${process.pid}-${Date.now()}.json`);
|
|
56983
|
+
await runRuntimeDataSeed({
|
|
56984
|
+
source: join(repoRoot, modulePath),
|
|
56985
|
+
useAi: true,
|
|
56986
|
+
emitHypothesis: dataSeedTmp,
|
|
56987
|
+
...options.config === void 0 ? {} : { config: options.config }
|
|
56988
|
+
});
|
|
56989
|
+
if (existsSync(dataSeedTmp)) {
|
|
56990
|
+
planWithAuth = {
|
|
56991
|
+
...planWithAuth,
|
|
56992
|
+
entries: [
|
|
56993
|
+
...planWithAuth.entries,
|
|
56994
|
+
{ name: DATA_SEED_HYPOTHESIS_ENTRY, absolutePath: dataSeedTmp }
|
|
56995
|
+
]
|
|
56996
|
+
};
|
|
56997
|
+
} else {
|
|
56998
|
+
process.stderr.write(
|
|
56999
|
+
`cs package: kh\xF4ng gi\u1EA3i \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt d\u1EEF li\u1EC7u \u2014 ZIP kh\xF4ng mang data-seed, E1.5 s\u1EBD \u0111\u1ECDc baseline-unreachable th\u1EADt${String.fromCharCode(10)}`
|
|
57000
|
+
);
|
|
57001
|
+
}
|
|
57002
|
+
}
|
|
55618
57003
|
const outPath = resolve(
|
|
55619
57004
|
options.out ?? `${basename(plan.modulePath.replace(/\/$/, "")) || "service"}.zip`
|
|
55620
57005
|
);
|
|
55621
57006
|
const bytes = writePackageZip(planWithAuth, outPath);
|
|
55622
57007
|
if (hypothesisTmp !== void 0) rmSync(hypothesisTmp, { force: true });
|
|
57008
|
+
if (hypothesisTmp !== void 0) rmSync(hypothesisTmp, { force: true });
|
|
55623
57009
|
if (triageTmp !== void 0) rmSync(triageTmp, { force: true });
|
|
57010
|
+
if (dataSeedTmp !== void 0) rmSync(dataSeedTmp, { force: true });
|
|
55624
57011
|
process.stdout.write(`Packaged ${plan.modulePath} \u2192 ${outPath} (${formatBytes(bytes)})
|
|
55625
57012
|
`);
|
|
55626
57013
|
process.stdout.write(` ${planWithAuth.entries.length} files
|
|
@@ -55687,6 +57074,9 @@ H\xE3y ch\u1EA1y \`cs auth login\`.`
|
|
|
55687
57074
|
const formData = new FormData();
|
|
55688
57075
|
formData.append("sourceKind", "archive");
|
|
55689
57076
|
formData.append("archive", new Blob([readFileSync3(outPath)]), basename(outPath));
|
|
57077
|
+
if (resolveAuthOnServer) {
|
|
57078
|
+
formData.append("useAi", "true");
|
|
57079
|
+
}
|
|
55690
57080
|
const res = await fetch(url, {
|
|
55691
57081
|
method: "POST",
|
|
55692
57082
|
headers: { authorization: `Bearer ${token}` },
|
|
@@ -57293,7 +58683,7 @@ var runServerRunner = async (options = {}) => {
|
|
|
57293
58683
|
init_dist5();
|
|
57294
58684
|
init_exit_codes();
|
|
57295
58685
|
init_find_files();
|
|
57296
|
-
var
|
|
58686
|
+
var CONFIG_GLOBS3 = [
|
|
57297
58687
|
"**/application*.yml",
|
|
57298
58688
|
"**/application*.yaml",
|
|
57299
58689
|
"**/application*.properties",
|
|
@@ -57316,7 +58706,7 @@ var runRuntimeAuthToken = async (options) => {
|
|
|
57316
58706
|
const source = resolve(process.cwd(), options.source);
|
|
57317
58707
|
const filesResult = await findFiles({
|
|
57318
58708
|
projectRoot: source,
|
|
57319
|
-
include:
|
|
58709
|
+
include: CONFIG_GLOBS3,
|
|
57320
58710
|
exclude: CONFIG_EXCLUDES
|
|
57321
58711
|
});
|
|
57322
58712
|
if (!filesResult.ok) {
|
|
@@ -57424,31 +58814,51 @@ var countConcluded = (doc) => {
|
|
|
57424
58814
|
}
|
|
57425
58815
|
return concluded;
|
|
57426
58816
|
};
|
|
58817
|
+
var BASELINE_STATUS_RE = /trả HTTP (\d{3})/;
|
|
57427
58818
|
var detectBaselineRefusal = async (dir) => {
|
|
57428
58819
|
let entries;
|
|
57429
58820
|
try {
|
|
57430
58821
|
entries = await readdir(dir);
|
|
57431
58822
|
} catch {
|
|
57432
|
-
return { refused: false, evidence:
|
|
58823
|
+
return { refused: false, evidence: [] };
|
|
57433
58824
|
}
|
|
57434
58825
|
let total = 0;
|
|
57435
58826
|
let skipped = 0;
|
|
58827
|
+
let measuredStatus;
|
|
58828
|
+
let skipMessage;
|
|
57436
58829
|
for (const entry of entries) {
|
|
57437
58830
|
if (!entry.toLowerCase().endsWith(".xml")) continue;
|
|
57438
58831
|
const content = await readFile(join(dir, entry), "utf8").catch(() => null);
|
|
57439
58832
|
if (content === null) continue;
|
|
57440
58833
|
for (const testCase of parseJUnitXml(content)) {
|
|
57441
58834
|
total += 1;
|
|
57442
|
-
if (testCase.outcome === "skipped")
|
|
58835
|
+
if (testCase.outcome === "skipped") {
|
|
58836
|
+
skipped += 1;
|
|
58837
|
+
if (measuredStatus === void 0 && testCase.message !== void 0) {
|
|
58838
|
+
const match = BASELINE_STATUS_RE.exec(testCase.message);
|
|
58839
|
+
const statusText = match?.[1];
|
|
58840
|
+
if (statusText !== void 0) {
|
|
58841
|
+
measuredStatus = Number(statusText);
|
|
58842
|
+
skipMessage = testCase.message;
|
|
58843
|
+
}
|
|
58844
|
+
}
|
|
58845
|
+
}
|
|
57443
58846
|
}
|
|
57444
58847
|
}
|
|
57445
|
-
if (total === 0 || skipped !== total) return { refused: false, evidence:
|
|
57446
|
-
|
|
57447
|
-
|
|
57448
|
-
evidence: {
|
|
58848
|
+
if (total === 0 || skipped !== total) return { refused: false, evidence: [] };
|
|
58849
|
+
const rows = [
|
|
58850
|
+
{
|
|
57449
58851
|
source: "e1.junit",
|
|
57450
58852
|
verbatim: `Tests run: ${total}, Skipped: ${skipped} \u2014 every generated test skipped on the E1.5 baseline gate`
|
|
57451
58853
|
}
|
|
58854
|
+
];
|
|
58855
|
+
if (skipMessage !== void 0) {
|
|
58856
|
+
rows.push({ source: "e1.junit.skipMessage", verbatim: skipMessage });
|
|
58857
|
+
}
|
|
58858
|
+
return {
|
|
58859
|
+
refused: true,
|
|
58860
|
+
evidence: rows,
|
|
58861
|
+
...measuredStatus !== void 0 ? { measuredStatus } : {}
|
|
57452
58862
|
};
|
|
57453
58863
|
};
|
|
57454
58864
|
var runRuntimeOutcome = async (options) => {
|
|
@@ -57495,7 +58905,8 @@ var runRuntimeOutcome = async (options) => {
|
|
|
57495
58905
|
evidence17.push({ source: "app.bootFailure", verbatim: bootFailure });
|
|
57496
58906
|
}
|
|
57497
58907
|
const appExitCode = options.appExitCode;
|
|
57498
|
-
|
|
58908
|
+
const appDiedAbnormally = appServedHttp && appExitCode !== void 0 && Number.isInteger(appExitCode) && !RUNNER_ENDED_EXIT_CODES.has(appExitCode);
|
|
58909
|
+
if (appDiedAbnormally) {
|
|
57499
58910
|
evidence17.push({
|
|
57500
58911
|
source: "app.exitCode",
|
|
57501
58912
|
verbatim: `application exited ${appExitCode} after serving HTTP (not the runner's lifetime cap or teardown signal)`
|
|
@@ -57511,10 +58922,12 @@ var runRuntimeOutcome = async (options) => {
|
|
|
57511
58922
|
const scenariosConcluded = countConcluded(correlationDoc);
|
|
57512
58923
|
if (correlationDoc !== null) delivered.push("correlation");
|
|
57513
58924
|
let oracleRefusedOnBaseline = false;
|
|
58925
|
+
let measuredBaselineStatus;
|
|
57514
58926
|
if (options.junitDir !== void 0) {
|
|
57515
58927
|
const refusal = await detectBaselineRefusal(resolve(cwd, options.junitDir));
|
|
57516
58928
|
oracleRefusedOnBaseline = refusal.refused;
|
|
57517
|
-
|
|
58929
|
+
evidence17.push(...refusal.evidence);
|
|
58930
|
+
if (refusal.measuredStatus !== void 0) measuredBaselineStatus = refusal.measuredStatus;
|
|
57518
58931
|
if (refusal.refused || scenariosConcluded > 0) delivered.push("e1-evidence");
|
|
57519
58932
|
}
|
|
57520
58933
|
const signals = {
|
|
@@ -57527,7 +58940,11 @@ var runRuntimeOutcome = async (options) => {
|
|
|
57527
58940
|
appServedHttp,
|
|
57528
58941
|
scenariosGenerated,
|
|
57529
58942
|
scenariosConcluded,
|
|
58943
|
+
...measuredBaselineStatus !== void 0 ? { authBaselineStatus: measuredBaselineStatus } : {},
|
|
57530
58944
|
...oracleRefusedOnBaseline ? { oracleRefusedOnBaseline: true } : {},
|
|
58945
|
+
...options.e2Scanned !== void 0 ? { e2ScannedCount: options.e2Scanned } : {},
|
|
58946
|
+
...options.e2AuthGated !== void 0 ? { e2AuthGatedCount: options.e2AuthGated } : {},
|
|
58947
|
+
...appDiedAbnormally ? { appDiedAbnormally: true } : {},
|
|
57531
58948
|
...options.runnerFault !== void 0 ? { runnerFault: options.runnerFault } : {}
|
|
57532
58949
|
};
|
|
57533
58950
|
const { tier, stopReason } = classifyRuntimeOutcome(signals);
|
|
@@ -57538,7 +58955,11 @@ var runRuntimeOutcome = async (options) => {
|
|
|
57538
58955
|
if (stopReason === "runner-fault" && options.runnerFault === void 0) {
|
|
57539
58956
|
evidence17.push({
|
|
57540
58957
|
source: "ladder.derivation",
|
|
57541
|
-
|
|
58958
|
+
// Two different derivations reach `runner-fault` here, and saying the wrong one is how a
|
|
58959
|
+
// reader is sent at the wrong subsystem. When the app DIED, an auth-gate signal may well
|
|
58960
|
+
// have been present — it was simply not the cause — so the old wording ("no auth-gate
|
|
58961
|
+
// signal explained it") would have been false in exactly the case that matters most.
|
|
58962
|
+
verbatim: appDiedAbnormally ? "the oracle had work and produced no conclusion because the application process died under it; any auth-gate signal describes a target that was no longer running" : "the oracle had work and produced no conclusion; no measured baseline status and no E2 telemetry explained it, so the remainder is ours"
|
|
57542
58963
|
});
|
|
57543
58964
|
}
|
|
57544
58965
|
if (options.runnerFault !== void 0) {
|
|
@@ -58870,6 +60291,12 @@ var buildProgram = () => {
|
|
|
58870
60291
|
).option(
|
|
58871
60292
|
"--emit-evidence",
|
|
58872
60293
|
"with --emit-tests: each @Test also writes a dual-run evidence sidecar for `cs verify --evidence` (ADR-0049)"
|
|
60294
|
+
).option(
|
|
60295
|
+
"--data-seed <file>",
|
|
60296
|
+
"with --emit-tests: seed the resolved data hypothesis (ADR-0070) in the suite @BeforeAll so the E1.5 baseline passes; resolve it once via `cs package --resolve-data-seed`"
|
|
60297
|
+
).option(
|
|
60298
|
+
"--runtime-auth <file>",
|
|
60299
|
+
"with --emit-tests: the E1 suite attaches a REAL bearer token from $CS_RUNTIME_TOKEN (minted by the pipeline; ADR-0070 part c) instead of the E1.5 Spring-Security-Test principal; resolve it once via `cs package --resolve-auth`"
|
|
58873
60300
|
).option(
|
|
58874
60301
|
"--json <path>",
|
|
58875
60302
|
"also write the machine-readable assessment JSON (audit spine) to <path> (ADR-0036)"
|
|
@@ -58920,6 +60347,8 @@ var buildProgram = () => {
|
|
|
58920
60347
|
...typeof opts.dbRuntime === "string" && opts.dbRuntime.length > 0 ? { dbRuntime: opts.dbRuntime } : {},
|
|
58921
60348
|
...opts.authLlm === true ? { authLlm: true } : {},
|
|
58922
60349
|
...opts.emitEvidence === true ? { emitEvidence: true } : {},
|
|
60350
|
+
...typeof opts.dataSeed === "string" && opts.dataSeed.length > 0 ? { dataSeed: opts.dataSeed } : {},
|
|
60351
|
+
...typeof opts.runtimeAuth === "string" && opts.runtimeAuth.length > 0 ? { runtimeAuth: opts.runtimeAuth } : {},
|
|
58923
60352
|
...typeof opts.json === "string" && opts.json.length > 0 ? { json: opts.json } : {},
|
|
58924
60353
|
// [ADR-0061]/[ADR-0063]/[ADR-0064] — the three artifact folds. These were DECLARED as
|
|
58925
60354
|
// options and never forwarded, so `cs assess --review-report x.json` parsed the flag and
|
|
@@ -58940,7 +60369,7 @@ var buildProgram = () => {
|
|
|
58940
60369
|
silent: opts.silent === true
|
|
58941
60370
|
});
|
|
58942
60371
|
});
|
|
58943
|
-
program.command("verify").description(
|
|
60372
|
+
program.command("verify", internalCommand).description(
|
|
58944
60373
|
"X\xE1c minh Pentest \u2014 ingest k\u1EBFt qu\u1EA3 JUnit c\u1EE7a CI, flip verdict suspected\u2192exploited/blocked (ADR-0033)"
|
|
58945
60374
|
).requiredOption(
|
|
58946
60375
|
"--tests <dir>",
|
|
@@ -58969,7 +60398,7 @@ var buildProgram = () => {
|
|
|
58969
60398
|
silent: opts.silent === true
|
|
58970
60399
|
});
|
|
58971
60400
|
});
|
|
58972
|
-
program.command("client-verify").description(
|
|
60401
|
+
program.command("client-verify", internalCommand).description(
|
|
58973
60402
|
"X\xE1c minh Pentest CLIENT \u2014 ingest report Playwright c\u1EE7a CI, flip verdict suspected\u2192exploited/blocked (ADR-0044)"
|
|
58974
60403
|
).requiredOption(
|
|
58975
60404
|
"--tests <dir>",
|
|
@@ -58985,7 +60414,7 @@ var buildProgram = () => {
|
|
|
58985
60414
|
silent: opts.silent === true
|
|
58986
60415
|
});
|
|
58987
60416
|
});
|
|
58988
|
-
program.command("runtime-auth-token").description(
|
|
60417
|
+
program.command("runtime-auth-token", internalCommand).description(
|
|
58989
60418
|
"Mint token auth runtime (JHipster JWT) t\u1EEB source \u0111\xE3 stage \u2014 in ra stdout \u0111\u1EC3 workflow capture (ADR-0065)"
|
|
58990
60419
|
).requiredOption("--source <dir>", "th\u01B0 m\u1EE5c source \u0111\xE3 stage (ch\u1EE9a config mang signing key)").option(
|
|
58991
60420
|
"--recipe <path>",
|
|
@@ -58996,7 +60425,7 @@ var buildProgram = () => {
|
|
|
58996
60425
|
...typeof opts.recipe === "string" && opts.recipe.length > 0 ? { recipe: opts.recipe } : {}
|
|
58997
60426
|
});
|
|
58998
60427
|
});
|
|
58999
|
-
program.command("runtime-auth-seed").description(
|
|
60428
|
+
program.command("runtime-auth-seed", internalCommand).description(
|
|
59000
60429
|
"Gieo state phi\xEAn x\xE1c th\u1EF1c cho t\u1EA7ng runtime r\u1ED3i in token ra stdout \u2014 ch\u1EA1y TR\u01AF\u1EDAC khi app kh\u1EDFi \u0111\u1ED9ng (ADR-0068)"
|
|
59001
60430
|
).requiredOption("--source <dir>", "th\u01B0 m\u1EE5c source \u0111\xE3 stage (ch\u1EE9a config mang signing key)").option("--redis-host <host>", "host c\u1EE7a Redis sidecar d\xF9ng-m\u1ED9t-l\u1EA7n", "127.0.0.1").option("--redis-port <port>", "port c\u1EE7a Redis sidecar d\xF9ng-m\u1ED9t-l\u1EA7n", "6379").option(
|
|
59002
60431
|
"--ai",
|
|
@@ -59022,12 +60451,50 @@ var buildProgram = () => {
|
|
|
59022
60451
|
redisPort: Number.isInteger(port) && port > 0 ? port : 6379
|
|
59023
60452
|
});
|
|
59024
60453
|
});
|
|
60454
|
+
program.command("runtime-data-seed", internalCommand).description(
|
|
60455
|
+
"Gieo d\u1EEF li\u1EC7u nghi\u1EC7p v\u1EE5 cho baseline E1.5 (ADR-0070) \u2014 gi\u1EA3i gi\u1EA3 thuy\u1EBFt ngo\xE0i pod ho\u1EB7c render SQL trong pod"
|
|
60456
|
+
).requiredOption("--source <dir>", "th\u01B0 m\u1EE5c source \u0111\xE3 stage (ch\u1EE9a changelog/entity mang schema)").option(
|
|
60457
|
+
"--ai",
|
|
60458
|
+
"h\u1ECFi model xem c\u1EA7n gieo h\xE0ng n\xE0o (ADR-0070 part b) \u2014 m\u1EB7c \u0111\u1ECBnh T\u1EAET, ch\u1EA1y offline"
|
|
60459
|
+
).option(
|
|
60460
|
+
"--config <file>",
|
|
60461
|
+
"file c\u1EA5u h\xECnh t\u01B0\u1EDDng minh (c\u1EA7n cho --ai: kho\xE1 API ch\u1EC9 t\u1EDBi provider qua n\u1ED9i suy config)"
|
|
60462
|
+
).option(
|
|
60463
|
+
"--emit-hypothesis <file>",
|
|
60464
|
+
"GI\u1EA2I gi\u1EA3 thuy\u1EBFt r\u1ED3i D\u1EEANG, ghi ra file \u2014 ch\u1EA1y NGO\xC0I namespace c\xF4 l\u1EADp (n\u01A1i g\u1ECDi \u0111\u01B0\u1EE3c provider)"
|
|
60465
|
+
).option(
|
|
60466
|
+
"--hypothesis <file>",
|
|
60467
|
+
"TI\xCAU TH\u1EE4 gi\u1EA3 thuy\u1EBFt \u0111\xE3 gi\u1EA3i s\u1EB5n (\u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t l\u1EA1i) thay v\xEC h\u1ECFi model \u2014 ch\u1EA1y TRONG pod"
|
|
60468
|
+
).option(
|
|
60469
|
+
"--render-sql <out>",
|
|
60470
|
+
"render gi\u1EA3 thuy\u1EBFt th\xE0nh M\u1ED8T file SQL cho db sidecar \xE1p sau khi app kh\u1ECFe (lane E2) \u2014 c\u1EA7n --hypothesis"
|
|
60471
|
+
).action(async (opts) => {
|
|
60472
|
+
process.exitCode = await runRuntimeDataSeed({
|
|
60473
|
+
source: opts.source,
|
|
60474
|
+
useAi: opts.ai === true,
|
|
60475
|
+
...typeof opts.config === "string" && opts.config.length > 0 ? { config: opts.config } : {},
|
|
60476
|
+
...typeof opts.emitHypothesis === "string" && opts.emitHypothesis.length > 0 ? { emitHypothesis: opts.emitHypothesis } : {},
|
|
60477
|
+
...typeof opts.hypothesis === "string" && opts.hypothesis.length > 0 ? { hypothesis: opts.hypothesis } : {},
|
|
60478
|
+
...typeof opts.renderSql === "string" && opts.renderSql.length > 0 ? { renderSql: opts.renderSql } : {}
|
|
60479
|
+
});
|
|
60480
|
+
});
|
|
60481
|
+
program.command("pentest").description("\u0110\xF3ng g\xF3i, gi\u1EA3i quy\u1EBFt x\xE1c th\u1EF1c b\u1EB1ng AI v\xE0 \u0111\u1EA9y m\xE3 ngu\u1ED3n l\xEAn Server Pentest").requiredOption("--source <dir>", "th\u01B0 m\u1EE5c g\u1ED1c repository").option("--module <path>", "module c\u1EA7n \u0111\xF3ng g\xF3i, \u0111\u01B0\u1EDDng d\u1EABn t\u01B0\u01A1ng \u0111\u1ED1i so v\u1EDBi g\u1ED1c repo").action(async (options) => {
|
|
60482
|
+
process.exitCode = await runPackageCommand({
|
|
60483
|
+
...options,
|
|
60484
|
+
resolveAuth: true,
|
|
60485
|
+
resolveDataSeed: true,
|
|
60486
|
+
push: true
|
|
60487
|
+
});
|
|
60488
|
+
});
|
|
59025
60489
|
program.command("package").description("\u0110\xF3ng g\xF3i M\u1ED8T service (k\xE8m parent pom + jar khai b\xE1o) th\xE0nh ZIP, c\xF3 t\u1EF1 ki\u1EC3m").requiredOption("--source <dir>", "th\u01B0 m\u1EE5c g\u1ED1c repository").option("--module <path>", "module c\u1EA7n \u0111\xF3ng g\xF3i, \u0111\u01B0\u1EDDng d\u1EABn t\u01B0\u01A1ng \u0111\u1ED1i so v\u1EDBi g\u1ED1c repo").option("--out <file>", "\u0111\u01B0\u1EDDng d\u1EABn file zip \u0111\u1EA7u ra").option(
|
|
59026
60490
|
"--resolve-auth",
|
|
59027
|
-
"h\u1ECFi model gi\
|
|
60491
|
+
"h\u1ECFi model gi\u1EA3i thuy\u1EBFt x\xE1c th\u1EF1c NGAY T\u1EA0I \u0110\xC2Y (n\u1EBFu kh\xF4ng push) ho\u1EB7c T\u1EA0I SERVER (n\u1EBFu c\xF3 push)"
|
|
60492
|
+
).option(
|
|
60493
|
+
"--resolve-data-seed",
|
|
60494
|
+
"h\u1ECFi model gi\u1EA3 thuy\u1EBFt d\u1EEF li\u1EC7u (ADR-0070) NGAY T\u1EA0I \u0110\xC2Y r\u1ED3i nh\xFAng v\xE0o ZIP \u2014 E1.5 c\u1EA7n baseline \u0111i qua \u0111\u01B0\u1EE3c"
|
|
59028
60495
|
).option(
|
|
59029
60496
|
"--config <file>",
|
|
59030
|
-
"file c\u1EA5u h\xECnh cho --resolve-auth (kho\xE1 API ch\u1EC9 t\u1EDBi provider qua n\u1ED9i suy config)"
|
|
60497
|
+
"file c\u1EA5u h\xECnh cho --resolve-auth / --resolve-data-seed (kho\xE1 API ch\u1EC9 t\u1EDBi provider qua n\u1ED9i suy config)"
|
|
59031
60498
|
).option(
|
|
59032
60499
|
"--push",
|
|
59033
60500
|
"\u0110\xF3ng g\xF3i xong t\u1EF1 \u0111\u1ED9ng \u0111\u1EA9y l\xEAn m\xE1y ch\u1EE7 Pentest (t\u01B0\u01A1ng \u0111\u01B0\u01A1ng upload Dashboard)"
|
|
@@ -59036,12 +60503,13 @@ var buildProgram = () => {
|
|
|
59036
60503
|
process.exitCode = await runPackageCommand({
|
|
59037
60504
|
...options,
|
|
59038
60505
|
resolveAuth: options.resolveAuth === true,
|
|
60506
|
+
resolveDataSeed: options.resolveDataSeed === true,
|
|
59039
60507
|
...typeof options.config === "string" && options.config.length > 0 ? { config: options.config } : {},
|
|
59040
60508
|
push: options.push === true
|
|
59041
60509
|
});
|
|
59042
60510
|
}
|
|
59043
60511
|
);
|
|
59044
|
-
program.command("runtime-outcome").description(
|
|
60512
|
+
program.command("runtime-outcome", internalCommand).description(
|
|
59045
60513
|
"T\xEDnh b\u1EADc k\u1EBFt qu\u1EA3 T0-T4 (ADR-0069) cho m\u1ED9t l\u1EA7n n\u1ED9p ZIP \u2014 in JSON \u0111\u1EC3 g\u1EAFn v\xE0o payload ho\xE0n t\u1EA5t"
|
|
59046
60514
|
).option("--archive <path>", "file ZIP \u0111\xE3 n\u1ED9p (l\u1EA5y t\xEDn hi\u1EC7u T0/T1 qua preflight)").option("--assessment <path>", "audit.json t\u1EEB `cs assess` (c\xF3 m\u1EB7t = lane t\u0129nh \u0111\xE3 ch\u1EA1y tr\u1ECDn)").option("--suite <path>", "code-sentinel-suite.json (\u0111\u1EBFm k\u1ECBch b\u1EA3n E1 sinh ra)").option("--dast-manifest <path>", "code-sentinel-dast.json (\u0111\u1EBFm k\u1ECBch b\u1EA3n E2 sinh ra)").option("--dast-report <path>", "b\xE1o c\xE1o ZAP (c\xF3 m\u1EB7t = \u0111\xE3 giao b\u1EB1ng ch\u1EE9ng E2)").option("--correlation <path>", "code-sentinel-correlation.json (\u0111\u1EBFm k\u1ECBch b\u1EA3n \u0111\xE3 k\u1EBFt lu\u1EADn)").option("--junit-dir <dir>", "th\u01B0 m\u1EE5c JUnit XML c\u1EE7a E1 (ph\xE1t hi\u1EC7n oracle t\u1EEB ch\u1ED1i v\xEC baseline)").option(
|
|
59047
60515
|
"--build-outcome <state>",
|
|
@@ -59053,6 +60521,12 @@ var buildProgram = () => {
|
|
|
59053
60521
|
).option(
|
|
59054
60522
|
"--app-exit-code <n>",
|
|
59055
60523
|
"m\xE3 tho\xE1t c\u1EE7a ti\u1EBFn tr\xECnh app (124 = tr\u1EA7n th\u1EDDi gian c\u1EE7a runner, 143 = SIGTERM teardown \u2014 c\u1EA3 hai KH\xD4NG ph\u1EA3i l\u1ED7i app)"
|
|
60524
|
+
).option(
|
|
60525
|
+
"--e2-scanned <n>",
|
|
60526
|
+
"QUAN S\xC1T E2: s\u1ED1 message ZAP \u0111\xE3 qu\xE9t \u1EE9ng d\u1EE5ng (telemetry real-HTTP, [ADR-0070])"
|
|
60527
|
+
).option(
|
|
60528
|
+
"--e2-auth-gated <n>",
|
|
60529
|
+
"QUAN S\xC1T E2: s\u1ED1 response 401/403 trong s\u1ED1 message ZAP \u0111\xE3 qu\xE9t ([ADR-0070])"
|
|
59056
60530
|
).option(
|
|
59057
60531
|
"--runner-fault <message>",
|
|
59058
60532
|
"CH\u1EC8 \u0111\u1EB7t khi ch\xEDnh runner h\u1ECFng (\xE9p stopReason runner-fault)"
|
|
@@ -59087,12 +60561,16 @@ var buildProgram = () => {
|
|
|
59087
60561
|
// A non-numeric value is DROPPED rather than coerced: `Number('')` is 0 and `Number('x')`
|
|
59088
60562
|
// is NaN, and either would let a value nobody measured decide whether the run is clean.
|
|
59089
60563
|
...Number.isInteger(Number(opts.appExitCode)) && String(opts.appExitCode).trim() !== "" ? { appExitCode: Number(opts.appExitCode) } : {},
|
|
60564
|
+
// Same drop-don't-coerce rule as --app-exit-code: a value nobody measured (empty
|
|
60565
|
+
// string, NaN) must not decide how the run is classified.
|
|
60566
|
+
...Number.isInteger(Number(opts.e2Scanned)) && String(opts.e2Scanned).trim() !== "" ? { e2Scanned: Number(opts.e2Scanned) } : {},
|
|
60567
|
+
...Number.isInteger(Number(opts.e2AuthGated)) && String(opts.e2AuthGated).trim() !== "" ? { e2AuthGated: Number(opts.e2AuthGated) } : {},
|
|
59090
60568
|
...typeof opts.runnerFault === "string" ? { runnerFault: opts.runnerFault } : {},
|
|
59091
60569
|
...Array.isArray(opts.stepFailure) ? { stepFailures: opts.stepFailure } : {},
|
|
59092
60570
|
...Array.isArray(opts.deviation) ? { deviations: opts.deviation } : {}
|
|
59093
60571
|
});
|
|
59094
60572
|
});
|
|
59095
|
-
program.command("correlate").description(
|
|
60573
|
+
program.command("correlate", internalCommand).description(
|
|
59096
60574
|
"\u0110\u1ED1i chi\u1EBFu xuy\xEAn t\u1EA7ng \u2014 m\xE3 \xD7 E1/JUnit \xD7 E2/DAST \xD7 E1.9/Playwright to\xE0n checklist (ADR-0036/0038/0044)"
|
|
59097
60575
|
).requiredOption("--assessment <path>", "file JSON m\xE1y-\u0111\u1ECDc t\u1EEB `cs assess --json <path>`").option(
|
|
59098
60576
|
"--tests <dir>",
|
|
@@ -59169,7 +60647,7 @@ var buildProgram = () => {
|
|
|
59169
60647
|
silent: opts.silent === true
|
|
59170
60648
|
});
|
|
59171
60649
|
});
|
|
59172
|
-
program.command("dast-verify").description(
|
|
60650
|
+
program.command("dast-verify", internalCommand).description(
|
|
59173
60651
|
"X\xE1c minh DAST \u2014 ingest report ZAP c\u1EE7a b\u1EA1n, flip verdict scan target suspected\u2192exploited/blocked (ADR-0038)"
|
|
59174
60652
|
).requiredOption(
|
|
59175
60653
|
"--plan <dir>",
|
|
@@ -59220,7 +60698,7 @@ var buildProgram = () => {
|
|
|
59220
60698
|
silent: opts.silent === true
|
|
59221
60699
|
});
|
|
59222
60700
|
});
|
|
59223
|
-
program.command("sast-verify").description("External SAST \u2014 ingest Semgrep SARIF, corroborate checklist (ADR-0048)").requiredOption("--assessment <path>", "file JSON t\u1EEB `cs assess --json <path>`").requiredOption("--report <path>", "file SARIF do team ch\u1EA1y Semgrep sinh ra").option("-o, --output <file>", "report output (default code-sentinel-sast-verification.md)").option("--silent", "no console summary; only write the report file").action(async (opts) => {
|
|
60701
|
+
program.command("sast-verify", internalCommand).description("External SAST \u2014 ingest Semgrep SARIF, corroborate checklist (ADR-0048)").requiredOption("--assessment <path>", "file JSON t\u1EEB `cs assess --json <path>`").requiredOption("--report <path>", "file SARIF do team ch\u1EA1y Semgrep sinh ra").option("-o, --output <file>", "report output (default code-sentinel-sast-verification.md)").option("--silent", "no console summary; only write the report file").action(async (opts) => {
|
|
59224
60702
|
process.exitCode = await runSastVerify({
|
|
59225
60703
|
...typeof opts.assessment === "string" && opts.assessment.length > 0 ? { assessment: opts.assessment } : {},
|
|
59226
60704
|
...typeof opts.report === "string" && opts.report.length > 0 ? { report: opts.report } : {},
|