auditor-lambda 0.2.8 → 0.2.9
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/README.md +6 -0
- package/audit-code-wrapper-lib.mjs +1 -1
- package/dist/adapters/eslint.js +9 -5
- package/dist/cli.d.ts +42 -1
- package/dist/cli.js +114 -64
- package/dist/extractors/bucketing.d.ts +4 -0
- package/dist/extractors/bucketing.js +6 -2
- package/dist/extractors/disposition.d.ts +4 -0
- package/dist/extractors/disposition.js +6 -2
- package/dist/extractors/fileInventory.js +24 -28
- package/dist/extractors/flows.d.ts +5 -0
- package/dist/extractors/flows.js +18 -38
- package/dist/extractors/pathPatterns.d.ts +10 -3
- package/dist/extractors/pathPatterns.js +109 -61
- package/dist/extractors/surfaces.d.ts +4 -0
- package/dist/extractors/surfaces.js +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/io/artifacts.d.ts +55 -40
- package/dist/io/artifacts.js +73 -110
- package/dist/io/json.js +52 -21
- package/dist/io/runArtifacts.d.ts +1 -1
- package/dist/io/runArtifacts.js +26 -3
- package/dist/orchestrator/advance.js +83 -62
- package/dist/orchestrator/flowCoverage.js +11 -5
- package/dist/orchestrator/flowPlanning.d.ts +7 -2
- package/dist/orchestrator/flowPlanning.js +46 -21
- package/dist/orchestrator/flowRequeue.js +28 -8
- package/dist/orchestrator/internalExecutors.js +12 -8
- package/dist/orchestrator/planning.js +25 -3
- package/dist/orchestrator/requeue.js +11 -1
- package/dist/orchestrator/taskBuilder.d.ts +4 -2
- package/dist/orchestrator/taskBuilder.js +153 -52
- package/dist/orchestrator/unitBuilder.d.ts +3 -1
- package/dist/orchestrator/unitBuilder.js +24 -16
- package/dist/prompts/renderWorkerPrompt.d.ts +1 -1
- package/dist/prompts/renderWorkerPrompt.js +16 -8
- package/dist/providers/claudeCodeProvider.d.ts +4 -1
- package/dist/providers/claudeCodeProvider.js +8 -5
- package/dist/providers/localSubprocessProvider.d.ts +4 -0
- package/dist/providers/localSubprocessProvider.js +7 -2
- package/dist/providers/spawnLoggedCommand.d.ts +9 -1
- package/dist/providers/spawnLoggedCommand.js +77 -29
- package/dist/reporting/synthesis.d.ts +2 -0
- package/dist/reporting/synthesis.js +12 -9
- package/dist/supervisor/operatorHandoff.js +48 -18
- package/dist/supervisor/runLedger.d.ts +1 -1
- package/dist/supervisor/runLedger.js +112 -5
- package/dist/supervisor/sessionConfig.js +10 -10
- package/dist/types/externalAnalyzer.d.ts +3 -0
- package/dist/types/flowCoverage.d.ts +5 -1
- package/dist/types/flowCoverage.js +5 -1
- package/dist/types/flows.d.ts +5 -1
- package/dist/types/flows.js +1 -1
- package/dist/types/runLedger.d.ts +5 -1
- package/dist/types/runLedger.js +6 -1
- package/dist/types/runtimeValidation.d.ts +12 -3
- package/dist/types/runtimeValidation.js +16 -1
- package/dist/types/sessionConfig.d.ts +15 -2
- package/dist/types/sessionConfig.js +15 -1
- package/dist/types/surfaces.d.ts +4 -1
- package/dist/types/surfaces.js +1 -1
- package/dist/types/workerSession.d.ts +9 -0
- package/dist/types/workerSession.js +5 -1
- package/dist/validation/artifacts.d.ts +1 -1
- package/dist/validation/artifacts.js +33 -20
- package/dist/validation/auditResults.d.ts +2 -2
- package/dist/validation/auditResults.js +7 -15
- package/dist/validation/basic.d.ts +9 -1
- package/dist/validation/basic.js +40 -3
- package/dist/validation/sessionConfig.d.ts +4 -2
- package/dist/validation/sessionConfig.js +62 -15
- package/docs/agent-integrations.md +29 -9
- package/docs/next-steps.md +21 -4
- package/docs/packaging.md +14 -0
- package/docs/product-direction.md +22 -0
- package/docs/production-launch-bar.md +2 -0
- package/docs/releasing.md +17 -0
- package/docs/remediation-baseline.md +75 -0
- package/docs/run-flow.md +23 -11
- package/docs/session-config.md +50 -5
- package/docs/supervisor.md +7 -0
- package/docs/workflow-refactor-brief.md +177 -0
- package/package.json +1 -1
- package/schemas/audit_result.schema.json +4 -1
- package/schemas/audit_task.schema.json +3 -1
- package/schemas/coverage_matrix.schema.json +3 -3
- package/schemas/critical_flows.schema.json +6 -2
- package/schemas/file_disposition.schema.json +2 -2
- package/schemas/finding.schema.json +9 -4
- package/schemas/flow_coverage.schema.json +2 -2
- package/schemas/repo_manifest.schema.json +4 -4
- package/schemas/risk_register.schema.json +2 -2
- package/schemas/runtime_validation_report.schema.json +2 -2
- package/schemas/runtime_validation_tasks.schema.json +8 -2
- package/schemas/surface_manifest.schema.json +6 -3
- package/schemas/unit_manifest.schema.json +3 -2
- package/skills/audit-code/SKILL.md +5 -0
package/dist/extractors/flows.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { isAuditExcludedStatus } from "./disposition.js";
|
|
2
|
-
import { isSecuritySensitivePath, isDataLayerPath, isConcurrencyPath, isInterfacePath, isDeploymentConfigPath, } from "./pathPatterns.js";
|
|
2
|
+
import { EXTRACTOR_HEURISTIC_NOTE, isAsyncTaskPath, isBillingPath, isIdentityPath, isSecuritySensitivePath, isDataLayerPath, isConcurrencyPath, isInterfacePath, isDeploymentConfigPath, normalizeExtractorPath, } from "./pathPatterns.js";
|
|
3
3
|
function inferConcerns(paths) {
|
|
4
4
|
const concerns = new Set();
|
|
5
5
|
for (const path of paths) {
|
|
6
|
-
const normalized = path
|
|
6
|
+
const normalized = normalizeExtractorPath(path);
|
|
7
7
|
if (isSecuritySensitivePath(normalized))
|
|
8
8
|
concerns.add("security");
|
|
9
|
-
if (isDataLayerPath(normalized) ||
|
|
10
|
-
normalized.includes("invoice") ||
|
|
11
|
-
normalized.includes("payment"))
|
|
9
|
+
if (isDataLayerPath(normalized) || isBillingPath(normalized))
|
|
12
10
|
concerns.add("data_integrity");
|
|
13
11
|
if (isConcurrencyPath(normalized))
|
|
14
12
|
concerns.add("reliability");
|
|
@@ -18,47 +16,26 @@ function inferConcerns(paths) {
|
|
|
18
16
|
return concerns.size > 0 ? [...concerns] : ["correctness"];
|
|
19
17
|
}
|
|
20
18
|
function relatedPaths(entry, availablePaths) {
|
|
21
|
-
const normalized = entry
|
|
19
|
+
const normalized = normalizeExtractorPath(entry);
|
|
22
20
|
const linked = new Set([entry]);
|
|
23
21
|
for (const path of availablePaths) {
|
|
24
|
-
const lower = path
|
|
22
|
+
const lower = normalizeExtractorPath(path);
|
|
25
23
|
if (path === entry)
|
|
26
24
|
continue;
|
|
27
25
|
// Auth / session flows: link sibling auth, session, token, user paths
|
|
28
|
-
if (isSecuritySensitivePath(normalized) &&
|
|
29
|
-
(lower.includes("auth") ||
|
|
30
|
-
lower.includes("session") ||
|
|
31
|
-
lower.includes("token") ||
|
|
32
|
-
lower.includes("user"))) {
|
|
26
|
+
if (isSecuritySensitivePath(normalized) && isIdentityPath(lower)) {
|
|
33
27
|
linked.add(path);
|
|
34
28
|
}
|
|
35
29
|
// Billing / payment flows: link ledger and subscription paths
|
|
36
|
-
if ((normalized
|
|
37
|
-
normalized.includes("invoice") ||
|
|
38
|
-
normalized.includes("payment")) &&
|
|
39
|
-
(lower.includes("billing") ||
|
|
40
|
-
lower.includes("invoice") ||
|
|
41
|
-
lower.includes("payment") ||
|
|
42
|
-
lower.includes("ledger") ||
|
|
43
|
-
lower.includes("subscription"))) {
|
|
30
|
+
if (isBillingPath(normalized) && isBillingPath(lower)) {
|
|
44
31
|
linked.add(path);
|
|
45
32
|
}
|
|
46
33
|
// Async / queue flows: link worker, job, retry, and task paths
|
|
47
|
-
if (isConcurrencyPath(normalized) &&
|
|
48
|
-
(lower.includes("queue") ||
|
|
49
|
-
lower.includes("retry") ||
|
|
50
|
-
lower.includes("worker") ||
|
|
51
|
-
lower.includes("job") ||
|
|
52
|
-
lower.includes("task"))) {
|
|
34
|
+
if (isConcurrencyPath(normalized) && isAsyncTaskPath(lower)) {
|
|
53
35
|
linked.add(path);
|
|
54
36
|
}
|
|
55
37
|
// Deployment / infra flows: link docker, k8s, terraform, workflow paths
|
|
56
|
-
if (isDeploymentConfigPath(normalized) &&
|
|
57
|
-
(lower.includes("deploy") ||
|
|
58
|
-
lower.includes("docker") ||
|
|
59
|
-
lower.includes("workflow") ||
|
|
60
|
-
lower.includes("k8s") ||
|
|
61
|
-
lower.includes("terraform"))) {
|
|
38
|
+
if (isDeploymentConfigPath(normalized) && isDeploymentConfigPath(lower)) {
|
|
62
39
|
linked.add(path);
|
|
63
40
|
}
|
|
64
41
|
}
|
|
@@ -76,6 +53,11 @@ function dedupeFlows(flows) {
|
|
|
76
53
|
}
|
|
77
54
|
return deduped;
|
|
78
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Builds coarse critical-flow coverage from shared path heuristics. These
|
|
58
|
+
* bootstrap flows are intentionally conservative and should be reviewed when a
|
|
59
|
+
* repo uses unconventional naming or layout conventions.
|
|
60
|
+
*/
|
|
79
61
|
export function buildCriticalFlowManifest(repoManifest, surfaceManifest, disposition) {
|
|
80
62
|
const dispositionMap = new Map(disposition?.files.map((item) => [item.path, item.status]) ?? []);
|
|
81
63
|
const availablePaths = repoManifest.files
|
|
@@ -95,14 +77,12 @@ export function buildCriticalFlowManifest(repoManifest, surfaceManifest, disposi
|
|
|
95
77
|
paths,
|
|
96
78
|
concerns: inferConcerns(paths),
|
|
97
79
|
confidence: paths.length > 1 ? "high" : "low",
|
|
98
|
-
notes: [
|
|
99
|
-
"Heuristic critical-flow inference from detected surfaces and related paths.",
|
|
100
|
-
],
|
|
80
|
+
notes: [EXTRACTOR_HEURISTIC_NOTE],
|
|
101
81
|
});
|
|
102
82
|
}
|
|
103
83
|
for (const path of availablePaths) {
|
|
104
|
-
const
|
|
105
|
-
if (isDataLayerPath(
|
|
84
|
+
const normalized = normalizeExtractorPath(path);
|
|
85
|
+
if (isDataLayerPath(normalized)) {
|
|
106
86
|
flows.push({
|
|
107
87
|
id: `flow:data:${path.replace(/[^a-zA-Z0-9:_-]/g, "-")}`,
|
|
108
88
|
name: `data evolution flow for ${path}`,
|
|
@@ -110,7 +90,7 @@ export function buildCriticalFlowManifest(repoManifest, surfaceManifest, disposi
|
|
|
110
90
|
paths: relatedPaths(path, availablePaths),
|
|
111
91
|
concerns: ["data_integrity", "reliability"],
|
|
112
92
|
confidence: "high",
|
|
113
|
-
notes: [
|
|
93
|
+
notes: [EXTRACTOR_HEURISTIC_NOTE],
|
|
114
94
|
});
|
|
115
95
|
}
|
|
116
96
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Shared bootstrap heuristics for the extractor layer. These rules run before
|
|
3
|
+
* richer graph/unit analysis exists, so they intentionally favor recall over
|
|
4
|
+
* precision and always normalize case plus path separators first.
|
|
5
5
|
*/
|
|
6
|
+
export declare const EXTRACTOR_HEURISTIC_NOTE = "Heuristic path classification normalizes case and path separators, then matches conservative keyword groups; confirm unusual repo layouts manually.";
|
|
7
|
+
export declare function normalizeExtractorPath(path: string): string;
|
|
6
8
|
export declare function isNodeModulesOrGit(normalized: string): boolean;
|
|
7
9
|
export declare function isBuildOutput(normalized: string): boolean;
|
|
8
10
|
export declare function isVendorPath(normalized: string): boolean;
|
|
@@ -20,3 +22,8 @@ export declare function isScriptPath(normalized: string): boolean;
|
|
|
20
22
|
export declare function isDeploymentConfigPath(normalized: string): boolean;
|
|
21
23
|
export declare function isGeneratedPath(normalized: string): boolean;
|
|
22
24
|
export declare function isSurfacePath(normalized: string): boolean;
|
|
25
|
+
export declare function isBackgroundSurfacePath(normalized: string): boolean;
|
|
26
|
+
export declare function isNetworkSurfacePath(normalized: string): boolean;
|
|
27
|
+
export declare function isBillingPath(normalized: string): boolean;
|
|
28
|
+
export declare function isIdentityPath(normalized: string): boolean;
|
|
29
|
+
export declare function isAsyncTaskPath(normalized: string): boolean;
|
|
@@ -1,100 +1,148 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Shared bootstrap heuristics for the extractor layer. These rules run before
|
|
3
|
+
* richer graph/unit analysis exists, so they intentionally favor recall over
|
|
4
|
+
* precision and always normalize case plus path separators first.
|
|
5
5
|
*/
|
|
6
|
+
export const EXTRACTOR_HEURISTIC_NOTE = "Heuristic path classification normalizes case and path separators, then matches conservative keyword groups; confirm unusual repo layouts manually.";
|
|
7
|
+
const BINARY_EXTENSIONS = [
|
|
8
|
+
".png",
|
|
9
|
+
".jpg",
|
|
10
|
+
".jpeg",
|
|
11
|
+
".gif",
|
|
12
|
+
".pdf",
|
|
13
|
+
".zip",
|
|
14
|
+
];
|
|
15
|
+
const LOCKFILE_NAMES = [
|
|
16
|
+
"package-lock.json",
|
|
17
|
+
"pnpm-lock.yaml",
|
|
18
|
+
"yarn.lock",
|
|
19
|
+
"cargo.lock",
|
|
20
|
+
"composer.lock",
|
|
21
|
+
"go.sum",
|
|
22
|
+
];
|
|
23
|
+
const TEST_KEYWORDS = ["test", "spec", "__tests__"];
|
|
24
|
+
const INTERFACE_KEYWORDS = ["route", "controller", "handler"];
|
|
25
|
+
const DATA_LAYER_KEYWORDS = ["model", "schema", "migration", "seed"];
|
|
26
|
+
const SECURITY_KEYWORDS = [
|
|
27
|
+
"auth",
|
|
28
|
+
"secret",
|
|
29
|
+
"token",
|
|
30
|
+
"permission",
|
|
31
|
+
"session",
|
|
32
|
+
];
|
|
33
|
+
const CONCURRENCY_KEYWORDS = [
|
|
34
|
+
"queue",
|
|
35
|
+
"worker",
|
|
36
|
+
"job",
|
|
37
|
+
"cache",
|
|
38
|
+
"retry",
|
|
39
|
+
"lock",
|
|
40
|
+
];
|
|
41
|
+
const SCRIPT_KEYWORDS = ["script"];
|
|
42
|
+
const DEPLOYMENT_KEYWORDS = [
|
|
43
|
+
"docker",
|
|
44
|
+
"terraform",
|
|
45
|
+
"deploy",
|
|
46
|
+
"workflow",
|
|
47
|
+
"k8s",
|
|
48
|
+
];
|
|
49
|
+
const SURFACE_KEYWORDS = ["route", "controller", "worker", "job", "command"];
|
|
50
|
+
const BILLING_KEYWORDS = [
|
|
51
|
+
"billing",
|
|
52
|
+
"invoice",
|
|
53
|
+
"payment",
|
|
54
|
+
"ledger",
|
|
55
|
+
"subscription",
|
|
56
|
+
];
|
|
57
|
+
const IDENTITY_KEYWORDS = ["user"];
|
|
58
|
+
const ASYNC_TASK_KEYWORDS = ["task"];
|
|
59
|
+
export function normalizeExtractorPath(path) {
|
|
60
|
+
return path.replace(/\\/g, "/").toLowerCase();
|
|
61
|
+
}
|
|
62
|
+
function splitSegments(normalized) {
|
|
63
|
+
return normalized.split("/").filter(Boolean);
|
|
64
|
+
}
|
|
65
|
+
function hasSegment(normalized, segment) {
|
|
66
|
+
return splitSegments(normalized).includes(segment);
|
|
67
|
+
}
|
|
68
|
+
function includesAny(normalized, values) {
|
|
69
|
+
return values.some((value) => normalized.includes(value));
|
|
70
|
+
}
|
|
71
|
+
function endsWithAny(normalized, suffixes) {
|
|
72
|
+
return suffixes.some((suffix) => normalized.endsWith(suffix));
|
|
73
|
+
}
|
|
74
|
+
function baseName(normalized) {
|
|
75
|
+
const segments = splitSegments(normalized);
|
|
76
|
+
return segments.at(-1) ?? normalized;
|
|
77
|
+
}
|
|
6
78
|
export function isNodeModulesOrGit(normalized) {
|
|
7
|
-
|
|
8
|
-
return segments.includes("node_modules") || segments.includes(".git");
|
|
79
|
+
return hasSegment(normalized, "node_modules") || hasSegment(normalized, ".git");
|
|
9
80
|
}
|
|
10
81
|
export function isBuildOutput(normalized) {
|
|
11
|
-
return normalized
|
|
82
|
+
return hasSegment(normalized, "dist") || hasSegment(normalized, "build");
|
|
12
83
|
}
|
|
13
84
|
export function isVendorPath(normalized) {
|
|
14
85
|
return normalized.includes("vendor") || normalized.includes("third_party");
|
|
15
86
|
}
|
|
16
87
|
export function isBinaryArtifact(normalized) {
|
|
17
|
-
return (normalized
|
|
18
|
-
normalized.endsWith(".jpg") ||
|
|
19
|
-
normalized.endsWith(".jpeg") ||
|
|
20
|
-
normalized.endsWith(".gif") ||
|
|
21
|
-
normalized.endsWith(".pdf") ||
|
|
22
|
-
normalized.endsWith(".zip"));
|
|
88
|
+
return endsWithAny(normalized, BINARY_EXTENSIONS);
|
|
23
89
|
}
|
|
24
90
|
export function isLogPath(normalized) {
|
|
25
|
-
return normalized.endsWith(".log") || normalized
|
|
91
|
+
return normalized.endsWith(".log") || includesAny(normalized, ["stdout.log", "stderr.log"]);
|
|
26
92
|
}
|
|
27
93
|
export function isLicensePath(normalized) {
|
|
28
|
-
const base = normalized
|
|
94
|
+
const base = baseName(normalized);
|
|
29
95
|
return base === "license" || base.startsWith("license.");
|
|
30
96
|
}
|
|
31
97
|
export function isLockfilePath(normalized) {
|
|
32
|
-
return (normalized
|
|
33
|
-
normalized.endsWith("pnpm-lock.yaml") ||
|
|
34
|
-
normalized.endsWith("yarn.lock") ||
|
|
35
|
-
normalized.endsWith("cargo.lock") ||
|
|
36
|
-
normalized.endsWith("composer.lock") ||
|
|
37
|
-
normalized.endsWith("go.sum"));
|
|
98
|
+
return endsWithAny(normalized, LOCKFILE_NAMES);
|
|
38
99
|
}
|
|
39
100
|
export function isDocPath(normalized) {
|
|
40
|
-
return normalized.endsWith(".md") || normalized
|
|
101
|
+
return normalized.endsWith(".md") || hasSegment(normalized, "docs");
|
|
41
102
|
}
|
|
42
103
|
export function isTestPath(normalized) {
|
|
43
|
-
return (normalized
|
|
44
|
-
normalized.includes("spec") ||
|
|
45
|
-
normalized.includes("__tests__"));
|
|
104
|
+
return includesAny(normalized, TEST_KEYWORDS);
|
|
46
105
|
}
|
|
47
106
|
export function isInterfacePath(normalized) {
|
|
48
|
-
return (normalized
|
|
49
|
-
normalized.includes("controller") ||
|
|
50
|
-
normalized.includes("handler") ||
|
|
51
|
-
normalized.includes("api/"));
|
|
107
|
+
return includesAny(normalized, INTERFACE_KEYWORDS) || hasSegment(normalized, "api");
|
|
52
108
|
}
|
|
53
109
|
export function isDataLayerPath(normalized) {
|
|
54
|
-
return (normalized
|
|
55
|
-
normalized.includes("schema") ||
|
|
56
|
-
normalized.includes("migration") ||
|
|
57
|
-
normalized.includes("seed") ||
|
|
58
|
-
normalized.includes("db/"));
|
|
110
|
+
return includesAny(normalized, DATA_LAYER_KEYWORDS) || hasSegment(normalized, "db");
|
|
59
111
|
}
|
|
60
112
|
export function isSecuritySensitivePath(normalized) {
|
|
61
|
-
return (normalized
|
|
62
|
-
normalized.includes("secret") ||
|
|
63
|
-
normalized.includes("token") ||
|
|
64
|
-
normalized.includes("permission") ||
|
|
65
|
-
normalized.includes("session"));
|
|
113
|
+
return includesAny(normalized, SECURITY_KEYWORDS);
|
|
66
114
|
}
|
|
67
115
|
export function isConcurrencyPath(normalized) {
|
|
68
|
-
return (normalized
|
|
69
|
-
normalized.includes("worker") ||
|
|
70
|
-
normalized.includes("job") ||
|
|
71
|
-
normalized.includes("cache") ||
|
|
72
|
-
normalized.includes("retry") ||
|
|
73
|
-
normalized.includes("lock"));
|
|
116
|
+
return includesAny(normalized, CONCURRENCY_KEYWORDS);
|
|
74
117
|
}
|
|
75
118
|
export function isScriptPath(normalized) {
|
|
76
|
-
return (normalized
|
|
77
|
-
normalized
|
|
78
|
-
normalized
|
|
119
|
+
return (includesAny(normalized, SCRIPT_KEYWORDS) ||
|
|
120
|
+
hasSegment(normalized, "scripts") ||
|
|
121
|
+
hasSegment(normalized, "bin"));
|
|
79
122
|
}
|
|
80
123
|
export function isDeploymentConfigPath(normalized) {
|
|
81
|
-
return (normalized
|
|
82
|
-
normalized.includes("terraform") ||
|
|
83
|
-
normalized.includes("deploy") ||
|
|
84
|
-
normalized.includes("workflow") ||
|
|
85
|
-
normalized.includes("k8s") ||
|
|
86
|
-
normalized.endsWith(".yml") ||
|
|
87
|
-
normalized.endsWith(".yaml"));
|
|
124
|
+
return includesAny(normalized, DEPLOYMENT_KEYWORDS) || endsWithAny(normalized, [".yml", ".yaml"]);
|
|
88
125
|
}
|
|
89
126
|
export function isGeneratedPath(normalized) {
|
|
90
127
|
return normalized.includes("vendor") || normalized.includes("generated");
|
|
91
128
|
}
|
|
92
129
|
export function isSurfacePath(normalized) {
|
|
93
|
-
return (normalized
|
|
94
|
-
normalized
|
|
95
|
-
normalized
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
130
|
+
return (hasSegment(normalized, "api") ||
|
|
131
|
+
includesAny(normalized, SURFACE_KEYWORDS) ||
|
|
132
|
+
hasSegment(normalized, "cli"));
|
|
133
|
+
}
|
|
134
|
+
export function isBackgroundSurfacePath(normalized) {
|
|
135
|
+
return includesAny(normalized, ["worker", "job"]);
|
|
136
|
+
}
|
|
137
|
+
export function isNetworkSurfacePath(normalized) {
|
|
138
|
+
return hasSegment(normalized, "api") || includesAny(normalized, ["route", "controller"]);
|
|
139
|
+
}
|
|
140
|
+
export function isBillingPath(normalized) {
|
|
141
|
+
return includesAny(normalized, BILLING_KEYWORDS);
|
|
142
|
+
}
|
|
143
|
+
export function isIdentityPath(normalized) {
|
|
144
|
+
return isSecuritySensitivePath(normalized) || includesAny(normalized, IDENTITY_KEYWORDS);
|
|
145
|
+
}
|
|
146
|
+
export function isAsyncTaskPath(normalized) {
|
|
147
|
+
return isConcurrencyPath(normalized) || includesAny(normalized, ASYNC_TASK_KEYWORDS);
|
|
100
148
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { RepoManifest } from "../types.js";
|
|
2
2
|
import type { FileDisposition } from "../types/disposition.js";
|
|
3
3
|
import type { SurfaceManifest } from "../types/surfaces.js";
|
|
4
|
+
/**
|
|
5
|
+
* Detects likely execution surfaces from file paths using the shared extractor
|
|
6
|
+
* heuristics, primarily to seed later audit planning.
|
|
7
|
+
*/
|
|
4
8
|
export declare function buildSurfaceManifest(repoManifest: RepoManifest, disposition?: FileDisposition): SurfaceManifest;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { isAuditExcludedStatus } from "./disposition.js";
|
|
2
|
-
import { isSurfacePath } from "./pathPatterns.js";
|
|
2
|
+
import { EXTRACTOR_HEURISTIC_NOTE, isBackgroundSurfacePath, isNetworkSurfacePath, isSurfacePath, normalizeExtractorPath, } from "./pathPatterns.js";
|
|
3
3
|
function methodsForPath(path) {
|
|
4
|
-
const normalized = path
|
|
5
|
-
if (
|
|
4
|
+
const normalized = normalizeExtractorPath(path);
|
|
5
|
+
if (isNetworkSurfacePath(normalized)) {
|
|
6
6
|
return ["GET", "POST"];
|
|
7
7
|
}
|
|
8
8
|
return undefined;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Detects likely execution surfaces from file paths using the shared extractor
|
|
12
|
+
* heuristics, primarily to seed later audit planning.
|
|
13
|
+
*/
|
|
10
14
|
export function buildSurfaceManifest(repoManifest, disposition) {
|
|
11
15
|
const surfaces = [];
|
|
12
16
|
const dispositionMap = new Map(disposition?.files.map((item) => [item.path, item.status]) ?? []);
|
|
@@ -15,19 +19,15 @@ export function buildSurfaceManifest(repoManifest, disposition) {
|
|
|
15
19
|
if (status && isAuditExcludedStatus(status)) {
|
|
16
20
|
continue;
|
|
17
21
|
}
|
|
18
|
-
const normalized = file.path
|
|
22
|
+
const normalized = normalizeExtractorPath(file.path);
|
|
19
23
|
if (isSurfacePath(normalized)) {
|
|
20
24
|
surfaces.push({
|
|
21
25
|
id: `surface:${file.path}`,
|
|
22
|
-
kind: normalized
|
|
23
|
-
? "background"
|
|
24
|
-
: "interface",
|
|
26
|
+
kind: isBackgroundSurfacePath(normalized) ? "background" : "interface",
|
|
25
27
|
entrypoint: file.path,
|
|
26
|
-
exposure: normalized
|
|
27
|
-
? "network"
|
|
28
|
-
: "local",
|
|
28
|
+
exposure: isNetworkSurfacePath(normalized) ? "network" : "local",
|
|
29
29
|
methods: methodsForPath(file.path),
|
|
30
|
-
notes: [
|
|
30
|
+
notes: [EXTRACTOR_HEURISTIC_NOTE],
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import "./cli.js";
|
|
1
|
+
import { runCli } from "./cli.js";
|
|
2
|
+
await runCli(process.argv);
|
package/dist/io/artifacts.d.ts
CHANGED
|
@@ -9,48 +9,62 @@ import type { GraphBundle } from "../types/graph.js";
|
|
|
9
9
|
import type { RiskRegister } from "../types/risk.js";
|
|
10
10
|
import type { RuntimeValidationReport, RuntimeValidationTaskManifest } from "../types/runtimeValidation.js";
|
|
11
11
|
import type { SurfaceManifest } from "../types/surfaces.js";
|
|
12
|
-
|
|
13
|
-
repo_manifest
|
|
14
|
-
file_disposition
|
|
15
|
-
auto_fixes_applied
|
|
16
|
-
unit_manifest
|
|
17
|
-
graph_bundle
|
|
18
|
-
surface_manifest
|
|
19
|
-
critical_flows
|
|
20
|
-
flow_coverage
|
|
21
|
-
risk_register
|
|
22
|
-
coverage_matrix
|
|
23
|
-
runtime_validation_tasks
|
|
24
|
-
runtime_validation_report
|
|
25
|
-
external_analyzer_results
|
|
26
|
-
audit_results
|
|
27
|
-
audit_tasks
|
|
28
|
-
requeue_tasks
|
|
29
|
-
audit_report
|
|
30
|
-
audit_state
|
|
31
|
-
artifact_metadata
|
|
12
|
+
type ArtifactPayloadMap = {
|
|
13
|
+
repo_manifest: RepoManifest;
|
|
14
|
+
file_disposition: FileDisposition;
|
|
15
|
+
auto_fixes_applied: unknown;
|
|
16
|
+
unit_manifest: UnitManifest;
|
|
17
|
+
graph_bundle: GraphBundle;
|
|
18
|
+
surface_manifest: SurfaceManifest;
|
|
19
|
+
critical_flows: CriticalFlowManifest;
|
|
20
|
+
flow_coverage: FlowCoverageManifest;
|
|
21
|
+
risk_register: RiskRegister;
|
|
22
|
+
coverage_matrix: CoverageMatrix;
|
|
23
|
+
runtime_validation_tasks: RuntimeValidationTaskManifest;
|
|
24
|
+
runtime_validation_report: RuntimeValidationReport;
|
|
25
|
+
external_analyzer_results: ExternalAnalyzerResults;
|
|
26
|
+
audit_results: AuditResult[];
|
|
27
|
+
audit_tasks: AuditTask[];
|
|
28
|
+
requeue_tasks: AuditTask[];
|
|
29
|
+
audit_report: string;
|
|
30
|
+
audit_state: AuditState;
|
|
31
|
+
artifact_metadata: ArtifactMetadataManifest;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Audit artifacts accumulate phase-by-phase as the orchestrator advances.
|
|
35
|
+
* Missing keys mean the corresponding artifact has not been produced yet.
|
|
36
|
+
*/
|
|
37
|
+
export type ArtifactBundle = Partial<ArtifactPayloadMap>;
|
|
38
|
+
export type ArtifactBundleKey = keyof ArtifactPayloadMap;
|
|
39
|
+
type ArtifactPhase = "intake" | "analysis" | "execution" | "reporting" | "supervisor";
|
|
40
|
+
interface ArtifactDefinition<K extends ArtifactBundleKey = ArtifactBundleKey> {
|
|
41
|
+
fileName: string;
|
|
42
|
+
phase: ArtifactPhase;
|
|
43
|
+
read: (path: string) => Promise<ArtifactPayloadMap[K] | undefined>;
|
|
44
|
+
write: (path: string, value: ArtifactPayloadMap[K]) => Promise<void>;
|
|
32
45
|
}
|
|
33
|
-
export declare const
|
|
34
|
-
readonly
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
42
|
-
readonly
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
51
|
-
readonly
|
|
52
|
-
readonly
|
|
46
|
+
export declare const ARTIFACT_DEFINITIONS: {
|
|
47
|
+
readonly repo_manifest: ArtifactDefinition<"repo_manifest">;
|
|
48
|
+
readonly file_disposition: ArtifactDefinition<"file_disposition">;
|
|
49
|
+
readonly auto_fixes_applied: ArtifactDefinition<"auto_fixes_applied">;
|
|
50
|
+
readonly unit_manifest: ArtifactDefinition<"unit_manifest">;
|
|
51
|
+
readonly graph_bundle: ArtifactDefinition<"graph_bundle">;
|
|
52
|
+
readonly surface_manifest: ArtifactDefinition<"surface_manifest">;
|
|
53
|
+
readonly critical_flows: ArtifactDefinition<"critical_flows">;
|
|
54
|
+
readonly flow_coverage: ArtifactDefinition<"flow_coverage">;
|
|
55
|
+
readonly risk_register: ArtifactDefinition<"risk_register">;
|
|
56
|
+
readonly coverage_matrix: ArtifactDefinition<"coverage_matrix">;
|
|
57
|
+
readonly runtime_validation_tasks: ArtifactDefinition<"runtime_validation_tasks">;
|
|
58
|
+
readonly runtime_validation_report: ArtifactDefinition<"runtime_validation_report">;
|
|
59
|
+
readonly external_analyzer_results: ArtifactDefinition<"external_analyzer_results">;
|
|
60
|
+
readonly audit_results: ArtifactDefinition<"audit_results">;
|
|
61
|
+
readonly audit_tasks: ArtifactDefinition<"audit_tasks">;
|
|
62
|
+
readonly requeue_tasks: ArtifactDefinition<"requeue_tasks">;
|
|
63
|
+
readonly audit_report: ArtifactDefinition<"audit_report">;
|
|
64
|
+
readonly audit_state: ArtifactDefinition<"audit_state">;
|
|
65
|
+
readonly artifact_metadata: ArtifactDefinition<"artifact_metadata">;
|
|
53
66
|
};
|
|
67
|
+
export declare const ARTIFACT_FILE_TO_BUNDLE_KEY: Record<string, ArtifactBundleKey>;
|
|
54
68
|
export declare function getArtifactValue(bundle: ArtifactBundle, artifactName: string): unknown;
|
|
55
69
|
export declare function loadArtifactBundle(root: string): Promise<ArtifactBundle>;
|
|
56
70
|
export declare function writeCoreArtifacts(root: string, bundle: ArtifactBundle): Promise<void>;
|
|
@@ -59,3 +73,4 @@ export declare function promoteFinalAuditReport(params: {
|
|
|
59
73
|
artifactsDir: string;
|
|
60
74
|
repoRoot: string;
|
|
61
75
|
}): Promise<void>;
|
|
76
|
+
export {};
|