gabriel / musehub public
BREAKING task/bundle-size-gates #1 / 1
AI Agent gabriel · 126 days ago · May 11, 2026 · Diff

security(phase-1): bundle push size gates

Three gates, zero trust:

1. presign rejects size_bytes > bundle_max_bytes → 413 Fires before the presigned URL is issued.

2. unpack-bundle rejects wire_bytes > bundle_max_bytes → 422 Defends against direct MinIO PUT bypassing presign.

3. unpack-bundle rejects commits_count / objects_count above caps → 422 Bounds client-supplied logging inputs; prevents absurd allocations in the background worker.

All caps live in Settings (config.py) — tunable per environment: bundle_max_bytes = 512 MB bundle_max_commits = 100k bundle_max_objects = 1M

TDD: test_bundle_size_gates.py — 6 tests green.

sha256:9076f2e667fe458121f908717e4d396f07e4b29a1fefb082ec0bda6cd45109b3 sha
+25 ~4 symbols
sha256:133bfe57e5842bbe6057a2e79bd59a92d8535e3ca70c08983d9f75d51dbc878d snapshot
+25
symbols added
~4
symbols modified
0
dead code introduced
Semantic Changes 29 symbols
~ tests/test_bundle_size_gates.py .py 24 symbols added
+ _AUTH_CTX variable variable _AUTH_CTX L33–38
+ client function async_function client L42–56
+ ASGITransport import import ASGITransport L25–25
+ AsyncClient import import AsyncClient L25–25
+ AsyncMock import import AsyncMock L20–20
+ AsyncSession import import AsyncSession L26–26
+ MSignContext import import MSignContext L28–28
+ annotations import import annotations L17–17
+ app import import app L30–30
+ get_db import import get_db L29–29
+ hashlib import import hashlib L19–19
+ msgpack import import msgpack L22–22
+ optional_signed_request import import optional_signed_request L28–28
+ patch import import patch L20–20
+ pytest import import pytest L23–23
+ pytest_asyncio import import pytest_asyncio L24–24
+ require_signed_request import import require_signed_request L28–28
+ repo function async_function repo L60–68
+ test_presign_accepts_bundle_at_limit function async_function test_presign_accepts_bundle_at_limit L104–129
+ test_presign_rejects_oversized_bundle function async_function test_presign_rejects_oversized_bundle L74–100
+ test_unpack_bundle_accepts_counts_at_limit function async_function test_unpack_bundle_accepts_counts_at_limit L239–280
+ test_unpack_bundle_rejects_absurd_commits_count function async_function test_unpack_bundle_rejects_absurd_commits_count L183–207
+ test_unpack_bundle_rejects_absurd_objects_count function async_function test_unpack_bundle_rejects_absurd_objects_count L211–235
+ test_unpack_bundle_rejects_oversized_wire_bytes function async_function test_unpack_bundle_rejects_oversized_wire_bytes L135–177
~ musehub/api/routes/wire.py .py 1 symbol added, 2 symbols modified
+ get_settings import import get_settings L31–31
~ musehub/config.py .py 1 symbol modified
← Older Oldest on task/bundle-size-gates
All commits
Newer → Latest on task/bundle-size-gates

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:9076f2e667fe458121f908717e4d396f07e4b29a1fefb082ec0bda6cd45109b3 --body "your comment"