fix(runtime): bound tenant resource amplification

This commit is contained in:
Junyan Qin
2026-07-29 18:27:44 +08:00
parent e8d90c4259
commit 610915b9c5
32 changed files with 857 additions and 185 deletions
@@ -134,6 +134,16 @@ class TestS3StorageProviderWithMoto:
loaded_data = await provider.load('test/file.txt')
assert loaded_data == test_data
@pytest.mark.asyncio
async def test_bounded_load_rejects_oversized_object(self, mock_app_with_s3_config, s3_mock):
s3storage = get_s3storage_module()
provider = s3storage.S3StorageProvider(mock_app_with_s3_config)
await provider.initialize()
await provider.save('test/oversized.bin', b'12345')
with pytest.raises(ValueError, match='4-byte read limit'):
await provider.load_bounded('test/oversized.bin', max_bytes=4)
@pytest.mark.asyncio
async def test_exists_returns_true_for_existing_object(self, mock_app_with_s3_config, s3_mock):
"""Test that exists returns True for existing object."""