@@ -115,8 +115,19 @@ def redact_dict(self, data: dict[str, Any]) -> dict[str, Any]:
115115 """
116116 result = {}
117117 for key , value in data .items ():
118+ # Check if key matches sensitive patterns
119+ key_is_sensitive = any (
120+ rule .pattern .lower () in key .lower ()
121+ for rule in self .rules
122+ if not rule .is_regex
123+ )
124+
118125 if isinstance (value , str ):
119- result [key ] = self .redact_string (value )
126+ # Redact if key is sensitive or value contains sensitive patterns
127+ if key_is_sensitive :
128+ result [key ] = "[REDACTED]"
129+ else :
130+ result [key ] = self .redact_string (value )
120131 elif isinstance (value , dict ):
121132 result [key ] = self .redact_dict (value )
122133 elif isinstance (value , list ):
@@ -458,7 +469,11 @@ def verify(
458469 return False , f"Audit hash mismatch: expected { manifest_data ['attestation' ]['audit_chain_hash' ]} , got { audit_hash } "
459470
460471 # Verify signature if requested
461- if verify_signature and manifest_data ["attestation" ]["author_signature" ]:
472+ if verify_signature :
473+ # Require signature when verification is enabled
474+ if not manifest_data ["attestation" ]["author_signature" ]:
475+ return False , "Signature verification requested but bundle is unsigned. Use --allow-unsigned to bypass (unsafe for production)."
476+
462477 # Use TSBProvenanceVerifier for verification if available
463478 if SIGSTORE_AVAILABLE :
464479 try :
@@ -474,9 +489,9 @@ def verify(
474489 except Exception as exc :
475490 return False , f"Provenance verifier error: { exc } "
476491 else :
477- # Fallback: just check that a signature exists
478- if not manifest_data [ "attestation" ][ "author_signature" ]:
479- return False , "Missing author signature"
492+ # Fallback: signature exists but we can't verify it without sigstore
493+ # This is a security risk but better than nothing
494+ pass
480495
481496 return True , "TSB verification successful"
482497
0 commit comments