fix(supabase): ceiling measured on bytes present in the bucket plus pending claims without bytes; confirm fails closed on an unsized object; cleartext host must start with a letter

Third audit (BLOCK 1): counting terminal rows while queued let begin spam
pin the ceiling with declared sizes. The ceiling now sums storage.objects
sizes of the bucket (whatever the row's state) plus the declared size of
pending_upload rows whose quarantine object has not landed: a claim dies
with its row, a present object counts whatever its row says, no full scan of
the assets history. confirm_asset_upload treats an object without a size as
upload_missing. pgTAP (plan 138): rejected rows without bytes weigh nothing,
pending claims fill, superseded claims vanish, present bytes fill, unsized
object refused. Worker: a single-label cleartext host must start with an
ASCII letter (0X… hex forms refused, test added); STORAGE.md names the
native-run search-domain residual.
This commit is contained in:
bchanot committed 2026-10-13 20:07:22 +02:00
1 parent 369478576e
commit 273914d825
5 files changed
+48 -35

No files matched your search

+4 -4
View File
@@ -147,10 +147,9 @@ fn cleartext_allowed(host_port: &str) -> bool {
if let Ok(address) = host.parse::<std::net::Ipv4Addr>() {
return address.is_loopback();
}
!host.is_empty()
&& !host.contains('.')
&& host.chars().any(|c| c.is_ascii_alphabetic())
&& !host.starts_with("0x")
// A service name starts with a letter: no inet_aton or WHATWG numeric form does
// (`167772165`, `0x0a000005`, `0X0A000005` all resolve to an address).
!host.contains('.') && host.chars().next().is_some_and(|c| c.is_ascii_alphabetic())
}
fn seconds(
@@ -237,6 +236,7 @@ mod tests {
"http://127.evil.example",
"http://167772165:8000",
"http://0x0a000005",
"http://0X0A000005:8000",
"http://127.0.0.1.example",
"ftp://x",
"http://",