Clean-Room Engineering Case Study: How TruthLens (an offline multimodal ad-compliance and anti-counterfeiting investigation platform) integrated
starshield-forensics v0.4.1(MIT, pure Python>= 3.10standard library, zero external dependencies) alongsideRFC 3161Trusted Time-Stamping to neutralize vanishing posts and altered compliance certificates—achieving 0% false positives on commercial promotional graphics.
1. Three Classic Failure Modes in E-Commerce & Regulatory Evidence Triage
Suppose an online storefront ("Albion BioNutra Ltd"—all entities and artifacts in this case study are 100% clean-room synthetic test fixtures) markets an unlicensed herbal syrup as "clinically proven to reverse insulin resistance" and an unapproved cosmetic cream as "erasing melasma in 7 days." When challenged by a marketplace compliance auditor or consumer-protection counsel, the seller uploads a crisp PDF titled ISO-17025 Accredited Lab Certificate — PASS and a high-resolution scan of a Hospital Clinical Assay Sheet.
In real-world regulatory filings and pre-litigation triage, naive evidence collection routinely collapses against three predictable counter-arguments:
- Midnight Deletion + "Local Clock Rollback" Defense Minutes after a complaint is filed, the seller deletes or edits the offending listing. During evidentiary review, defense counsel argues: "All screenshots and
SHA-256hashes were generated on the complainant's own laptop; nothing prevented them from rolling back their system clock before hashing." A bareSHA-256digest proves post-hash immutability, not objective wall-clock existence prior to deletion. - Incrementally Doctored PDF Lab Reports (
ISO 32000-1) Bad actors rarely forge a laboratory report from scratch. Instead, they take a genuine passing PDF certificate issued for a benign beverage, open it in a desktop PDF editor, overwrite the product name or change"Detected (Fail)"to"Not Detected (Pass)", and hit Save. Visually—and to text-only OCR/LLM pipelines—the certificate looks completely legitimate. - The "Photoshop False-Positive" Trap on E-Commerce Graphics Running a naive image-forensics script across every image on an e-commerce product page is a guaranteed disaster: 99% of legitimate commercial promotional banners are designed in Adobe Photoshop. Flagging a routine autumn sale banner because it contains
Photoshop 8BIMmetadata destroys investigator credibility in seconds.
To close all three gaps simultaneously, the TruthLens (H4.3) engineering team paired its local RFC 3161 evidence vault with the zero-dependency container inspectors inside starshield-forensics v0.4.1 (pip install starshield-forensics).
2. Four Underlying Standards in Plain Engineering Terms
| Standard | Role in the Triage Pipeline | What It Proves—and Its Exact Boundary |
|---|---|---|
FIPS 180-4 (SHA-256) | Tamper-evident content digest over raw/ captures & MANIFEST.json | Single-bit changes invalidate the 64-hex digest; cannot alone defeat local system-clock rollback claims. |
IETF RFC 3161 (TSP) | Blind third-party cryptographic time-stamping implemented in TruthLens's downstream EvidenceVault | Sends only the 64-hex bundle_sha256 (0 bytes of raw screenshots or merchant names leave the host) to an independent TSA (e.g., DigiCert), returning a signed TIMESTAMP.tsr verifiable offline via openssl ts -verify. (Note: implemented in TruthLens's vault layer alongside upstream starshield-forensics v0.4.1, directly validating ecosystem demand for standardized offline RFC 3161 token verification.) |
ISO 32000-1 (PDF 1.7) | Structural %%EOF & xref revision inspection via starshield.pdf_containers | Genuine LIMS/laboratory exports emit a single xref + %%EOF pass (incremental_revision_count == 1). Desktop PDF edits typically append an Incremental Update (incremental_revision_count >= 2) and expose a /Producer mismatch across revisions. |
ISO/IEC 10918-1 & RFC 2083 | APP13 / Photoshop 3.0 / 8BIM & PNG iCCP inspection via starshield.image_containers | Bounded, CRC-verified segment parsing (16 MiB per-stream / 32 MiB cumulative decompression caps) pinpoints exact byte offsets of desktop image-editing resource blocks inside purported raw lab-assay scans. |
3. Three Architectural Decisions That Made Production Integration Work
3.1 Domain Gate Before Container Triage (0% Poster False Positives)
Because starshield-forensics uses 100% Python >= 3.10 standard library modules with zero C extensions, adding "starshield-forensics>=0.4.1" to pyproject.toml introduced zero dependency conflicts inside an air-gapped local inference environment.
Crucially, TruthLens placed a deterministic Certificate & Lab-Report Domain Gate directly in front of the container probes:
- Browser-rendered viewport snapshots (
page_snapshot.png): Skipped (synthesized by the collector itself). - Ordinary commercial promotional banners: Silently skipped—even if edited in Photoshop—so legal dossiers never cry wolf over routine graphic design (
0%false positives). - Uploaded
.pdfdocuments & images claiming official certification (COA,ISO 17025,SGS,Clinical Assay,Lab Report,Regulatory License): Immediately routed intoStarShield's structural container inspectors.
The entire production integration takes under 30 lines of Python:
from starshield.image_containers import inspect_image_container from starshield.pdf_containers import inspect_pdf_container CERT_KEYWORDS = ( "certificate of analysis", "test report", "lab report", "clinical", "assay", "iso 17025", "sgs", "intertek", "registration", "license", ) def triage_credential_container( raw_bytes: bytes, filename: str, ocr_text: str, is_browser_snapshot: bool, ) -> dict: if is_browser_snapshot: return {"gate_decision": "SKIPPED_BROWSER_RENDER", "suspicious": False} if raw_bytes.startswith(b"%PDF-") or filename.lower().endswith(".pdf"): report = inspect_pdf_container(raw_bytes, label=filename) suspicious = bool(report.get("has_multiple_revisions")) or bool( report.get("trailing_bytes_after_final_eof") ) return { "gate_decision": "INSPECTED_PDF_DOCUMENT", "suspicious": suspicious, "detail": report, } corpus = f"{filename}\n{ocr_text}".lower() if not any(kw in corpus for kw in CERT_KEYWORDS): # Routine promotional graphics legitimately use Photoshop; skip to enforce 0% FP return {"gate_decision": "SKIPPED_ORDINARY_POSTER", "suspicious": False} img_report = inspect_image_container(raw_bytes, label=filename) has_ps_8bim = bool(img_report.get("photoshop_app13_8bim_offsets")) return { "gate_decision": "INSPECTED_CERTIFICATE_IMAGE", "suspicious": has_ps_8bim, "detail": img_report, } 3.2 Preserving Epistemic Discipline (DERIVED + Benign Alternative Explanations)
A common pitfall in automated compliance tooling is over-claiming "100% mathematical proof of forgery." StarShield Forensics enforces strict epistemic hygiene at the API level: every structural finding is tagged epistemic_tier: "DERIVED" and paired with explicit alternative_explanations (for example, noting that legitimate digital signature workflows or PDF linearization can also produce multiple %%EOF markers).
TruthLens surfaces those caveats verbatim inside its generated regulatory dossier—instructing enforcement officers to issue an official verification inquiry to the named laboratory for the original certificate archive, rather than over-stating standalone binary proof.
3.3 Clean-Room 4-Scenario Benchmark Results
| Synthetic Fixture | Real-World Scenario | Domain Gate Action | StarShield v0.4.1 Structural Output | End-to-End Outcome |
|---|---|---|---|---|
| Fixture 1: Single-pass LIMS Lab Report PDF | Legitimate vendor submits unaltered laboratory export | INSPECTED_PDF_DOCUMENT | incremental_revision_count = 1has_multiple_revisions = False | Clean Pass (0 FP) |
| Fixture 2: Incrementally Edited Lab Report PDF | Seller overwrites product name & pass/fail table in PDF editor | INSPECTED_PDF_DOCUMENT | incremental_revision_count = 2has_multiple_revisions = True | Flagged: Unlawful health claim + multi-revision PDF lead |
| Fixture 3: Photoshopped Seasonal Skincare Promo JPEG | Legitimate e-commerce designer exports promo banner from PS | SKIPPED_ORDINARY_POSTER | Bypassed by Domain Gate | Clean Pass (0% Poster Noise) |
| Fixture 4: Doctored "SGS Whitening Assay" Scan JPEG | Seller alters raw scan values in Photoshop (APP13/8BIM) | INSPECTED_CERTIFICATE_IMAGE | Exact photoshop_app13_8bim_offsets byte offset pinpointed | Flagged: Certificate image pipeline anomaly |
Every archived bundle simultaneously seals its bundle_sha256 with an RFC 3161 TIMESTAMP.tsr receipt verifiable on any workstation via standard OpenSSL:
Status info: Status: Granted. TST info: Policy OID: 2.16.840.1.114412.7.1 Hash Algorithm: sha256 Time stamp: Nov 30 17:40:56 2026 GMT 4. Try the Container Probes Locally in 5 Seconds (Zero Install)
You can inspect your own synthetic PDFs, JPEG/PNG containers, or corrupted Chromium/Electron LevelDB stores offline without installing a C compiler or uploading sensitive files anywhere:
# Instant clean-room demo via uvx (Python >= 3.10 stdlib only) uvx --from starshield-forensics starshield demo # Or install from PyPI (PEP 740 attested) / Homebrew pip install starshield-forensics brew install Ziqi/tap/starshield-forensics - GitHub Repository: https://github.com/Ziqi/starshield-forensics (
v0.4.1· MIT · OpenSSF Best Practices Silver#16602· Scorecard8.0/10· SLSA Build Level 3) - Documentation & Validation Report (
UK FSR FSA – DIG 100&ISO/IEC 17025aligned): https://ziqi.github.io/starshield/ - Archival Concept DOI: https://doi.org/10.5281/zenodo.24145804

