fix(api): SSRF guard on ingest; whitelist PATCH /api/sources #46
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/ssrf-ingest-source-whitelist"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Non-auth hardening: fail-closed SSRF check on ingest triggers, and mass-assignment lock on feed source updates. Service stays private/unauthenticated.
Changes
POST /api/ingest/rss: rejectfeed_urlunlesscamera_scraper.is_public_url(HTTP 400). Link-local metadata (http://169.254.169.254/...) is not fetched.POST /api/ingest/gdelt: require the GDELT API host to be public; ifqueryis URL-shaped (http/https+ host), reject private/loopback/link-local targets with 400.PATCH /api/sources/{id}:FeedSourceUpdateallowlist (name,url,config,enabled) withextra="forbid"→ 422 on any other key. Unset fields are not written.Tests
tests/test_ingest_ssrf_and_sources.py— 4 passed (ASGI, ingest mocked so private URLs never fetch).pytest -q: 4 new tests green. Unrelated pre-existing failure:test_ingest_fire_row_idempotent(fires table, not touched).Out of scope
Authn/authz, masscan, TiTiler, DB indexes.
Reject private/loopback/link-local hosts on POST /api/ingest/rss and URL-shaped GDELT queries via camera_scraper.is_public_url (HTTP 400). PATCH /api/sources/{id} only accepts name, url, config, enabled (422 else).