fix: reject malformed activity feed payloads (#107)
CI / lint (pull_request) Successful in 9s
CI / build-frontend (pull_request) Successful in 5s

This commit is contained in:
timmy committed 2026-08-06 13:17:35 +00:00
1 parent d86e86e1fb
commit c21d968cc2
2 files changed
+23

No files matched your search

+19
View File
@@ -164,6 +164,25 @@ async def test_activity_events_normalizes_null_feed_payload(monkeypatch):
assert await gitea_proxy.activity_events() == []
@pytest.mark.anyio
async def test_event_stream_rejects_malformed_activity_feed_payload(monkeypatch):
async def fake_current_user():
return {"login": "timmy"}
async def fake_fetch(path):
return {"message": "unexpected upstream shape"}
monkeypatch.setattr(gitea_proxy, "current_user", fake_current_user)
monkeypatch.setattr(gitea_proxy, "fetch", fake_fetch)
response = await main.event_stream()
assert getattr(response, "status_code", None) == 503
assert json.loads(response.body) == {
"error": "Gitea event stream is temporarily unavailable"
}
@pytest.mark.anyio
async def test_activity_events_normalizes_malformed_nested_metadata(monkeypatch):
async def fake_current_user():