mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 12:37:55 +01:00
test(evals): report remaining fixed private scanner reasons
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
5d91105991
commit
e757e44737
2 files changed
+13
-1
No files matched your search
@@ -108,3 +108,15 @@ it("reports fixed embedded HTML and reporter text bounds while excluding unknown
|
||||
]);
|
||||
expect(JSON.stringify(diagnostic)).not.toMatch(/private-error|html-report/);
|
||||
});
|
||||
|
||||
|
||||
it("retains each remaining fixed scanner reason without dynamic text", () => {
|
||||
const reasons = ["embedded report encoding could not be inspected", "reporter symlink cannot be inspected",
|
||||
"credential in reporter filename", "reporter JSON could not be safely parsed"];
|
||||
const diagnostic = privateAttemptDiagnostic({ stage: "package-original", observation: { privacy: { issues: [
|
||||
...reasons.map(reason => ({ file: "html-report/index.html", reason })),
|
||||
{ file: "private-filename", reason: "zip could not be inspected: private-error" },
|
||||
] } } });
|
||||
expect(diagnostic.carrierReasons).toEqual(reasons.map(reason => ({ source: "reporter", carrier: "embedded-html", reason, count: 1 })));
|
||||
expect(JSON.stringify(diagnostic)).not.toMatch(/private-filename|private-error|html-report/);
|
||||
});
|
||||
@@ -33,7 +33,7 @@ function closedPackagingBudget(input: unknown, message: string) {
|
||||
export interface PrivateAttemptDiagnosticInput { stage: unknown; result?: unknown; error?: unknown; observation?: unknown; evidence?: unknown }
|
||||
const record = (value: unknown): Record<string, any> => value && typeof value === "object" ? value as Record<string, any> : {};
|
||||
const member = (value: unknown, choices: string[]) => typeof value === "string" && choices.includes(value) ? value : "unknown";
|
||||
const reporterReasons = ["zip inspection exceeded its expanded-byte bound", "zip inspection exceeded its time bound", "exact secret value", "secret-shaped value", "embedded report exceeded its byte bound", "reporter text exceeds inspection bound"];
|
||||
const reporterReasons = ["zip inspection exceeded its expanded-byte bound", "zip inspection exceeded its time bound", "exact secret value", "secret-shaped value", "embedded report exceeded its byte bound", "reporter text exceeds inspection bound", "embedded report encoding could not be inspected", "reporter symlink cannot be inspected", "credential in reporter filename", "reporter JSON could not be safely parsed"];
|
||||
function carrierReasons(input: unknown, source: "reporter" | "packaging") {
|
||||
const findings = (Array.isArray(input) ? input : []).map(issue => {
|
||||
const file = typeof record(issue).file === "string" ? record(issue).file.replace(/\\/g, "/") : "";
|
||||
|
||||
Reference in new issue
Block a user