Skip to content

fix(pipeline): restore None guard for no_retention in content_hash_value — DPDP violation #281

Closed

Description

@piyushmakhija28

Summary

When doc.no_retention=True, ingest_document calls upsert_document(content_hash_value=hash_value, ...) at line ~511. The guard None if doc.no_retention else hash_value that existed before fix #241 was removed. Content hash is now stored in PostgreSQL even for documents that must leave no trace — DPDP contract violation.

Root cause

Fix #241 rewrote the early-dedup path but dropped the None if doc.no_retention guard on content_hash_value. The inner guard at line 494 only covers the status-downgrade scenario (fallback_only re-ingest), not the hash-persistence scenario for no-retention docs.

Fix

ingestion/pipeline.py line ~511:

# Broken (after #241):
content_hash_value=hash_value,
# Fixed:
content_hash_value=None if doc.no_retention else hash_value,

Impact

Every no-retention upload leaks the content hash to documents.content_hash. A subsequent upload of the same bytes finds the hash row, violating the no-retention privacy contract.

Activity

  1. added
    bugSomething isn't working
    priority: criticalBlocks all requests or crashes startup
    securitySecurity or IDOR concern
    code-reviewFound via automated code review
    on Jun 21, 2026
  2. piyushmakhija28 commented on Jun 21, 2026

    @piyushmakhija28
    ContributorAuthor

    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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcode-reviewFound via automated code reviewpriority: criticalBlocks all requests or crashes startupsecuritySecurity or IDOR concern

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions