manual-sync: tudo-para-ia-mais-humana 2026-05-01_153128
This commit is contained in:
@@ -7,7 +7,7 @@ from uuid import uuid4
|
||||
|
||||
from mais_humana.acceptance import acceptance_markdown, build_acceptance_report
|
||||
from mais_humana.models import ReportBundle
|
||||
from mais_humana.redaction import redaction_markdown, scan_generated_artifacts, scan_text_for_secrets
|
||||
from mais_humana.redaction import redaction_markdown, redact_sensitive_text, scan_generated_artifacts, scan_text_for_secrets
|
||||
from tests.helpers import make_tmp
|
||||
|
||||
|
||||
@@ -60,16 +60,25 @@ Bearer abcdefghijklmnopqrstuvwxyz1234567890
|
||||
findings = scan_text_for_secrets("env.txt", "cloudflare_token=abcdefghijklmnopqrstuvwxyz1234567890")
|
||||
self.assertEqual(len(findings), 1)
|
||||
self.assertEqual(findings[0].pattern_id, "cloudflare_token_assignment")
|
||||
self.assertNotIn("abcdefghijklmnopqrstuvwxyz", findings[0].sample)
|
||||
self.assertIn("[redacted:", findings[0].sample)
|
||||
|
||||
def test_redaction_flags_cfat_even_when_named_as_reference(self) -> None:
|
||||
findings = scan_text_for_secrets("route.md", "tokenRef=cfat_abcdefghijklmnopqrstuvwxyz1234567890")
|
||||
self.assertEqual(len(findings), 1)
|
||||
self.assertEqual(findings[0].pattern_id, "cloudflare_cfat_token")
|
||||
self.assertEqual(findings[0].sample, "cfat_[redacted:41]")
|
||||
|
||||
def test_redaction_allows_single_opaque_reference_line(self) -> None:
|
||||
findings = scan_text_for_secrets("route.md", "credentialRef: cf-token-prod-readonly")
|
||||
self.assertEqual(findings, ())
|
||||
|
||||
def test_redact_sensitive_text_masks_known_secret_shapes(self) -> None:
|
||||
text = "Authorization: Bearer abcdefghijklmnopqrstuvwxyz1234567890\ncloudflare_token=abcdefghijklmnopqrstuvwxyz1234567890"
|
||||
redacted = redact_sensitive_text(text)
|
||||
self.assertNotIn("abcdefghijklmnopqrstuvwxyz1234567890", redacted)
|
||||
self.assertIn("[redacted:", redacted)
|
||||
|
||||
def test_acceptance_report_handles_missing_artifacts(self) -> None:
|
||||
root = make_tmp()
|
||||
bundle = ReportBundle(
|
||||
|
||||
Reference in New Issue
Block a user