fix(supabase): security pass on the files foundation — ceiling counts live bytes only, confirm checks the account, null sha256 refused, browser RPCs one role; worker: cleartext only on loopback or a service name, no env proxy, key ownership cross-check, no library text in logs

Security audit (PASS, 2 MEDIUM + LOW): the global ceiling summed every
non-deleted row, so rejected uploads ratcheted it toward storage_full with no
disk used → in-flight rows by declared size, clean rows by byte_size, nothing
else (pgTAP: rejected rows do not count, in-flight rows do); confirm refuses a
deactivated account like begin; complete_avatar_job refuses a null sha256;
begin / confirm / remove granted to authenticated only. Worker: SUPABASE_URL
over http:// accepted only for loopback or a single-label Docker service
name; ureq proxy(None); the job's keys must embed its owner and asset ids;
backend_failure / claim_failed / sweep_failure lines carry the closed kind and
the HTTP status, never the library's error text. e2e: uuid shape checked
before the psql query. Contract revision 2 (oracle fixes).
This commit is contained in:
bchanot committed 2026-10-13 19:49:58 +02:00
1 parent 62eb4e5d82
commit cd2dbb3b79
11 files changed
+124 -31

No files matched your search

+5 -4
View File
@@ -99,10 +99,11 @@ fn claim_pass(
match backend.claim_jobs(1) {
Ok(jobs) => jobs,
Err(error) => {
log::warn("claim_failed")
.code(error.kind())
.detail(&error.to_string())
.emit();
let line = log::warn("claim_failed").code(error.kind());
match error {
crate::backend::BackendError::Status(status) => line.http_status(status).emit(),
_ => line.emit(),
}
return Ok(0);
}
}