chore: drop stale scrum-WARN annotations in biometric_endpoint (comments only)
Removes dated 'Caught 2026-05-0X ... WARN' inline comments; no code change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7365a4c23e
commit
0d37a94ebf
@ -243,8 +243,7 @@ fn constant_time_eq(a: &[u8], b: &[u8]) -> bool {
|
|||||||
///
|
///
|
||||||
/// The header value MAY include parameters per RFC 9110 §8.3
|
/// The header value MAY include parameters per RFC 9110 §8.3
|
||||||
/// (`image/jpeg; charset=binary`, `image/jpeg; boundary=...`); we
|
/// (`image/jpeg; charset=binary`, `image/jpeg; boundary=...`); we
|
||||||
/// strip parameters before matching on the bare media type. Caught
|
/// strip parameters before matching on the bare media type.
|
||||||
/// 2026-05-03 opus scrum WARN on biometric_endpoint.rs:189.
|
|
||||||
fn extension_from_content_type(ct: Option<&str>) -> Result<&'static str, (StatusCode, &'static str)> {
|
fn extension_from_content_type(ct: Option<&str>) -> Result<&'static str, (StatusCode, &'static str)> {
|
||||||
let bare = ct
|
let bare = ct
|
||||||
.and_then(|s| s.split(';').next())
|
.and_then(|s| s.split(';').next())
|
||||||
@ -401,7 +400,6 @@ pub async fn process_upload(
|
|||||||
// and orphans the previous photo file on disk — creating a forever-leak
|
// and orphans the previous photo file on disk — creating a forever-leak
|
||||||
// pattern and a BIPA defensibility hole ("we said we erased the photo,
|
// pattern and a BIPA defensibility hole ("we said we erased the photo,
|
||||||
// but the previous version of it is still under the same subject dir").
|
// but the previous version of it is still under the same subject dir").
|
||||||
// Caught 2026-05-05 by verify_biometric_erasure.sh against WORKER-2.
|
|
||||||
if manifest.biometric_collection.is_some() {
|
if manifest.biometric_collection.is_some() {
|
||||||
return Err((StatusCode::CONFLICT, ErrorResponse {
|
return Err((StatusCode::CONFLICT, ErrorResponse {
|
||||||
error: "biometric_already_collected",
|
error: "biometric_already_collected",
|
||||||
@ -433,10 +431,10 @@ pub async fn process_upload(
|
|||||||
let _ = std::fs::set_permissions(&subject_dir, std::fs::Permissions::from_mode(0o700));
|
let _ = std::fs::set_permissions(&subject_dir, std::fs::Permissions::from_mode(0o700));
|
||||||
}
|
}
|
||||||
// Filename: timestamp-nanos + 4-byte random suffix to defeat the
|
// Filename: timestamp-nanos + 4-byte random suffix to defeat the
|
||||||
// (very unlikely) two-uploads-in-the-same-nanosecond collision the
|
// (very unlikely) two-uploads-in-the-same-nanosecond collision.
|
||||||
// 2026-05-03 kimi scrum WARN flagged. uuid::Uuid::new_v4 → use
|
// uuid::Uuid::new_v4 → first 8 hex chars (32 bits of entropy is
|
||||||
// first 8 hex chars (32 bits of entropy is enough — collision over
|
// enough — collision over a per-subject namespace at sub-microsecond
|
||||||
// a per-subject namespace at sub-microsecond cadence is implausible).
|
// cadence is implausible).
|
||||||
let suffix: String = uuid::Uuid::new_v4().simple().to_string().chars().take(8).collect();
|
let suffix: String = uuid::Uuid::new_v4().simple().to_string().chars().take(8).collect();
|
||||||
let filename = format!("{}_{}.{}", collected_at.timestamp_nanos_opt().unwrap_or(0), suffix, ext);
|
let filename = format!("{}_{}.{}", collected_at.timestamp_nanos_opt().unwrap_or(0), suffix, ext);
|
||||||
let abs_path = subject_dir.join(&filename);
|
let abs_path = subject_dir.join(&filename);
|
||||||
@ -451,9 +449,8 @@ pub async fn process_upload(
|
|||||||
}
|
}
|
||||||
// Store the path relative to storage_root in the manifest (matches
|
// Store the path relative to storage_root in the manifest (matches
|
||||||
// the BiometricCollection doc-comment: "relative to the configured
|
// the BiometricCollection doc-comment: "relative to the configured
|
||||||
// biometric storage root"). Caught 2026-05-03 opus scrum WARN on
|
// biometric storage root"). Operators reading the manifest can
|
||||||
// shared/types.rs::BiometricCollection. Operators reading the
|
// rebuild the absolute path with their own storage_root.
|
||||||
// manifest can rebuild the absolute path with their own storage_root.
|
|
||||||
let stored_path = abs_path
|
let stored_path = abs_path
|
||||||
.strip_prefix(&state.storage_root)
|
.strip_prefix(&state.storage_root)
|
||||||
.map(|p| p.to_string_lossy().to_string())
|
.map(|p| p.to_string_lossy().to_string())
|
||||||
@ -468,7 +465,7 @@ pub async fn process_upload(
|
|||||||
});
|
});
|
||||||
manifest.updated_at = collected_at;
|
manifest.updated_at = collected_at;
|
||||||
|
|
||||||
// Transactional commit (Caught 2026-05-03 opus BLOCK + kimi WARN):
|
// Transactional commit:
|
||||||
//
|
//
|
||||||
// The three side-effects MUST be all-or-nothing for BIPA defensibility:
|
// The three side-effects MUST be all-or-nothing for BIPA defensibility:
|
||||||
// - photo file on disk
|
// - photo file on disk
|
||||||
@ -1931,8 +1928,8 @@ mod tests {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn content_type_with_parameters_accepted() {
|
async fn content_type_with_parameters_accepted() {
|
||||||
// Real-world clients send `image/jpeg; charset=binary` etc.
|
// Real-world clients send `image/jpeg; charset=binary` etc.
|
||||||
// Caught 2026-05-03 opus scrum WARN; regression test ensures
|
// Regression test ensures the bare media type is matched
|
||||||
// the bare media type is matched after stripping parameters.
|
// after stripping parameters.
|
||||||
let state = fixture_state("ct_with_params").await;
|
let state = fixture_state("ct_with_params").await;
|
||||||
// Two distinct subjects so each upload exercises the "first upload"
|
// Two distinct subjects so each upload exercises the "first upload"
|
||||||
// path. Prior version used one subject and two uploads — now blocked
|
// path. Prior version used one subject and two uploads — now blocked
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user