root 3708e6abf1 biometric endpoint: scrum-driven hardening
Per 2026-05-03 phase_1_6_gate_3a scrum (10 findings, 0 convergent
location-wise but opus + kimi flagged the same audit-failure issue).

Convergent + load-bearing fix:
  Audit-write failure was silently swallowed (returned 200 with empty
  hmac) after photo + manifest persisted. For BIPA defensibility this
  is wrong — a successful response without an audit row is exactly
  the silent-failure mode the spec exists to prevent. Now: full
  transactional rollback. If audit append fails after photo + manifest
  commit, we remove the photo AND revert the manifest to its
  pre-upload state, then return 500 with error="audit_write_failed".

Other real fixes:

  Orphan-file leak (opus WARN): if put_subject fails AFTER the photo
  is written, the file would orphan on disk with no manifest pointer.
  Now removes the photo on manifest-update failure, before returning 500.

  Content-Type parameter handling (opus WARN): real-world clients send
  `image/jpeg; charset=binary` etc. Parser now strips parameters per
  RFC 9110 §8.3 and matches case-insensitively. New regression test
  content_type_with_parameters_accepted exercises both.

  data_path doc/code mismatch (opus WARN): doc said "relative to the
  configured biometric storage root" but code stored absolute path.
  Now stores relative — operators reading the manifest reconstruct
  the absolute path with their own storage_root, manifests are
  portable across deployments. Tests updated.

  Timestamp-nanosecond collision (kimi WARN): added 8-char uuid
  suffix to filename. Sub-microsecond cadence collision was implausible
  but defense-in-depth is cheap.

  Dead code (opus + kimi INFO): removed unused require_legal_auth
  function (process_upload reimplements the auth check inline)
  and the `let _ = ConsentStatus::Given;` no-op type-shape reference.

Skipped (acceptable in v1):
  - qwen BLOCK on image format validation: spec explicitly says "we
    trust the caller; malformed images fail downstream when deepface
    runs in Gate 3b". Documented in the file's module doc-comment.
  - qwen WARN on directory create-then-chmod race: brief window
    between create_dir_all and set_permissions. Mitigation would
    require libc-level umask manipulation; accepted as v1 scope.
  - qwen INFO on constant_time_eq duplication: comment explains the
    cross-import boundary; acceptable short-term per the reviewer.

Tests: 11 unit tests pass (added content_type_with_parameters_accepted).
Live verification post-restart:
  - Content-Type with `; charset=binary` accepted ✓
  - data_path returned as relative `WORKER-2/<ts>_<uuid>.jpg` ✓
  - Chain verified end-to-end (3 rows: validator + 2 biometric) ✓
  - Cross-runtime parity probe still 6/6 byte-identical ✓

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 05:05:12 -05:00
2026-04-22 02:41:15 -05:00
Description
Rust-first object storage system
6.3 GiB
Languages
TypeScript 38.4%
Rust 35.8%
HTML 13.9%
Python 7.8%
Shell 2.1%
Other 2%