You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(tests): DPDP PII export assertion checks field key name instead of field value, testing nothing meaningful #270
tests/test_documents_endpoint.py asserts 'Warranty' not in entry['field'] for a DPDP PII export test. This checks whether the string 'Warranty' appears in the field key name (e.g., 'title', 'summary') — which is never 'Warranty'. A bug leaking actual PII content into a value key would be completely invisible to this assertion.
Root Cause
tests/test_documents_endpoint.py around line 232:
forentryinpii_entries:
assert'Warranty'notinentry['field'] # ← 'field' is the key name like 'title'# This assertion is trivially True — 'title' doesn't contain 'Warranty'# The actual PII values in entry['value'] are never checked
The test is asserting that a schema key name (e.g., 'title', 'description') doesn't happen to be named 'Warranty' — which is never the case. The actual compliance check should verify that 'Warranty' does NOT appear in the field VALUES that get exported.
Failure Scenario
A bug causes PII content 'Warranty Deed' to appear in entry['value'] when it should be redacted.
'Warranty' not in entry['field'] → 'Warranty' not in 'description' → True.
Test passes. The DPDP PII leakage is undetected.
Audit finds that warranty-deed information is included in PII export responses — DPDP violation.
Proposed Fix
forentryinpii_entries:
# Check that sensitive Warranty content does not appear in exported values:assert'Warranty'notin (entry.get('value') or''), (
f"PII export leaked sensitive content in field '{entry['field']}': {entry.get('value')}"
)
# Also verify field names are from the expected schema:assertentry['field'] in ('name', 'email', 'phone', 'address'), (
f"Unexpected PII field exported: {entry['field']}"
)
Activity
piyushmakhija28 commentedon Jun 21, 2026
Fixed in PR #280 (Sprint R3/R4: fix(sprint-r3): root-cause fixes for all 39 bugs from code review round 3 + Sprint R4 round 4)