Add evidence-backed investigation workflows
This commit is contained in:
@@ -14,6 +14,14 @@ describe("runtime configuration", () => {
|
||||
expect(result.value.hopperTargetKind).toBe("executable");
|
||||
expect(result.value.hopperLoaderArgs).toEqual([]);
|
||||
expect(result.value.logLevel).toBe("info");
|
||||
expect(result.value.referenceSourcePolicy).toEqual({
|
||||
roots: [],
|
||||
secretPatterns: [],
|
||||
maxBytes: 16 * 1024 * 1024,
|
||||
maxEntries: 10_000,
|
||||
maxDepth: 32,
|
||||
maxPathBytes: 4_096,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -38,6 +46,22 @@ describe("runtime configuration", () => {
|
||||
executableRoots: [],
|
||||
workingRoots: [],
|
||||
allowedEnvironment: [],
|
||||
allowExternalNetwork: false,
|
||||
},
|
||||
evidenceFilePolicy: {
|
||||
roots: [],
|
||||
maxBytes: 64 * 1024 * 1024,
|
||||
maxDepth: 64,
|
||||
maxStringLength: 1024 * 1024,
|
||||
maxNodes: 1_000_000,
|
||||
},
|
||||
referenceSourcePolicy: {
|
||||
roots: [],
|
||||
secretPatterns: [],
|
||||
maxBytes: 16 * 1024 * 1024,
|
||||
maxEntries: 10_000,
|
||||
maxDepth: 32,
|
||||
maxPathBytes: 4_096,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -60,4 +84,38 @@ describe("runtime configuration", () => {
|
||||
expect(configured.ok && configured.value.logLevel).toBe("debug");
|
||||
expect(parseConfig({ REA_LOG_LEVEL: "verbose" }).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("parses reference source policy roots and secret patterns", () => {
|
||||
const result = parseConfig({
|
||||
REA_REFERENCE_ROOTS_JSON: '["/approved", "/srv/reference"]',
|
||||
REA_REFERENCE_SECRET_PATTERNS_JSON: '["*.env", "*.pem", "secrets/"]',
|
||||
});
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok) {
|
||||
expect(result.value.referenceSourcePolicy).toEqual({
|
||||
roots: ["/approved", "/srv/reference"],
|
||||
secretPatterns: ["*.env", "*.pem", "secrets/"],
|
||||
maxBytes: 16 * 1024 * 1024,
|
||||
maxEntries: 10_000,
|
||||
maxDepth: 32,
|
||||
maxPathBytes: 4_096,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it.each(["not-json", "{}", '["/ok", 1]'])(
|
||||
"rejects invalid reference source roots: %s",
|
||||
(encoded) => {
|
||||
expect(parseConfig({ REA_REFERENCE_ROOTS_JSON: encoded }).ok).toBe(false);
|
||||
},
|
||||
);
|
||||
|
||||
it.each(["not-json", "{}", '["*.ok", 1]'])(
|
||||
"rejects invalid reference source secret patterns: %s",
|
||||
(encoded) => {
|
||||
expect(
|
||||
parseConfig({ REA_REFERENCE_SECRET_PATTERNS_JSON: encoded }).ok,
|
||||
).toBe(false);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user