diff --git a/evidence/minio-source-verification.json b/evidence/minio-source-verification.json new file mode 100644 index 00000000..f3d8eb3e --- /dev/null +++ b/evidence/minio-source-verification.json @@ -0,0 +1,12 @@ +{ + "source_origin": { + "VCS": "git", + "URL": "https://github.com/minio/minio", + "Hash": "9e49d5e7a648f00e26f2246f4dc28e6b07f8c84a" + }, + "version": "v0.0.0-20251015172955-9e49d5e7a648", + "module_checksum": "h1:6TdolSCLSs2nwm8i0PpWDqf9iX2Ty9WQK8wmr7dCnUM=", + "go_mod_checksum": "h1:yCWDkwWO9IWpGsT4mreDDN/B/QVmK2zC666uInRAcqE=", + "validation": "standard go mod download with default Go checksum database after ranged HTTPS download", + "compiler_build_status": "in progress; source validation only" +} diff --git a/infra/s3.Dockerfile b/infra/s3.Dockerfile index d62fa197..d971a03e 100644 --- a/infra/s3.Dockerfile +++ b/infra/s3.Dockerfile @@ -7,11 +7,17 @@ COPY infra/fetch-source.go /tmp/fetch-source.go RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \ --mount=type=cache,target=/root/.cache/go-build,sharing=locked \ go run /tmp/fetch-source.go && \ - go mod download -json github.com/minio/minio@v0.0.0-20251015172955-9e49d5e7a648 && \ + for attempt in 1 2 3 4; do \ + go mod download -json github.com/minio/minio@v0.0.0-20251015172955-9e49d5e7a648 && break; \ + test "$attempt" -lt 4 || exit 1; sleep 1; \ + done && \ cp -a /go/pkg/mod/github.com/minio/minio@v0.0.0-20251015172955-9e49d5e7a648/. /source/ RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \ --mount=type=cache,target=/root/.cache/go-build,sharing=locked \ - go build -trimpath -ldflags='-s -w -X github.com/minio/minio/cmd.Version=2025-10-15T17:29:55Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2025-10-15T17-29-55Z -X github.com/minio/minio/cmd.CommitID=9e49d5e7a648f00e26f2246f4dc28e6b07f8c84a' -o /out/minio . + for attempt in 1 2 3; do \ + timeout 900s go build -trimpath -ldflags='-s -w -X github.com/minio/minio/cmd.Version=2025-10-15T17:29:55Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2025-10-15T17-29-55Z -X github.com/minio/minio/cmd.CommitID=9e49d5e7a648f00e26f2246f4dc28e6b07f8c84a' -o /out/minio . && break; \ + test "$attempt" -lt 3 || exit 1; sleep 1; \ + done FROM toolchain AS mc-build WORKDIR /source diff --git a/scripts/verify_storage.py b/scripts/verify_storage.py index 7ed61de4..81c2e92d 100644 --- a/scripts/verify_storage.py +++ b/scripts/verify_storage.py @@ -289,10 +289,14 @@ print(json.dumps(checks)) (parsed.host, parsed.port), timeout=3 ) as raw: request = ( - f"POST /api/v1/chats/{chat['id']}/attachments?filename=partial.png HTTP/1.1\r\n" - f"Host: {parsed.host}\r\nAuthorization: Bearer {session['token']}\r\n" - "Content-Type: image/png\r\nContent-Length: 100000\r\n\r\n" - ).encode() + PNG[:20] + ( + f"POST /api/v1/chats/{chat['id']}/attachments?filename=partial.png HTTP/1.1\r\n" + f"Host: {parsed.host}\r\nAuthorization: Bearer {session['token']}\r\n" + "Content-Type: image/png\r\nContent-Length: 10000000\r\n\r\n" + ).encode() + + PNG + + b"x" * (2 * 1024 * 1024) + ) raw.sendall(request) time.sleep(1) assert int(sql("SELECT count(*) FROM attachments")) == before @@ -302,10 +306,10 @@ print(json.dumps(checks)) result["aborted_upload_has_no_intent_or_bytes"] = True # Failure before any S3 PUT. name = uuid4().hex + ".png" + objects_before = inside("print(len(list(s.objects())))") sql( "CREATE FUNCTION student_upload_fault() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN RAISE EXCEPTION 'synthetic'; END $$; CREATE TRIGGER student_upload_fault BEFORE INSERT ON attachments FOR EACH ROW EXECUTE FUNCTION student_upload_fault()" ) - objects_before = inside("print(len(list(s.objects())))") try: assert ( upload(client, session, chat, name=name).status_code == 500 diff --git a/student-tests/test_attachments.py b/student-tests/test_attachments.py index 2f96574d..eaad5bcf 100644 --- a/student-tests/test_attachments.py +++ b/student-tests/test_attachments.py @@ -179,3 +179,16 @@ def test_pixel_limit_before_decode(client, actors, chat): assert len(stream.getvalue()) < 10 * 1024 * 1024 r = upload(client, actors[0], chat, data=stream.getvalue()) assert r.status_code == 413 + + +def test_chunked_body_limit_without_content_length(client, actors, chat): + r = client.post( + f"/api/v1/chats/{chat['id']}/attachments", + headers={**headers(actors[0]), "Content-Type": "image/png"}, + params={"filename": "chunked.png"}, + content=iter([b"x" * (10 * 1024 * 1024 + 1)]), + ) + assert r.request.headers.get("content-length") is None + assert r.status_code == 413 + assert r.json()["error"]["code"] == "payload_too_large" + assert r.json()["error"]["request_id"] == r.headers["x-request-id"]