Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions scripts/verify_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,16 @@ def validate(root: Path) -> list[dict[str, str]]:
problems.append(
issue(CRITERIA[0], "giant_fixture_too_small", relative, str(len(content)), "regenerate a fixture of at least 1,000,000 bytes")
)
for label, pattern in SECRET_PATTERNS.items():
for pattern in SECRET_PATTERNS.values():
if pattern.search(content):
problems.append(
issue(CRITERIA[0], "possible_secret_in_fixture", relative, label, "replace the content with an unmistakably synthetic non-secret value")
issue(
CRITERIA[0],
"possible_secret_in_fixture",
relative,
"Sensitive pattern detected; fixture bytes and category withheld",
"replace the content with an unmistakably synthetic non-secret value",
)
)
for label, pattern in PII_PATTERNS.items():
if pattern.search(content):
Expand Down
12 changes: 11 additions & 1 deletion tests/test_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,19 @@ def test_secret_privacy_and_unsafe_content_scans_fail_closed(self) -> None:
fixture["byte_count"] = path.stat().st_size
fixture["sha256"] = hashlib.sha256(path.read_bytes()).hexdigest()
self.write_manifest(root, manifest)
codes = self.codes(root)
problems = VERIFY.validate(root)
codes = {problem["code"] for problem in problems}
self.assertIn("possible_secret_in_fixture", codes)
self.assertIn("possible_pii_in_fixture", codes)
secret_messages = {
problem["message"]
for problem in problems
if problem["code"] == "possible_secret_in_fixture"
}
self.assertEqual(
{"Sensitive pattern detected; fixture bytes and category withheld"},
secret_messages,
)

def test_giant_json_and_jsonl_are_both_present(self) -> None:
manifest = self.load_manifest(ROOT)
Expand Down
Loading