maint: Dependency upgrades and High backlog items (v2.11.0)

- All dependencies to current releases (97 known vulnerabilities -> 0),
  Python 3.14, uv pinned, requirements-test.txt, lxml/dateutil pinned
- CSRF tokens on admin forms, logout and IndieAuth consent
- IndieAuth client and crosspost link-card fetches via safe_get
- FLASK_DEBUG/FLASK_ENV default off/production; image sets them
- Foreign keys enforced on pooled connections; migration 018 removes orphans
- Rate limits shared across processes (rate_limits, migration 019)
- datetime.utcnow() and sqlite3 default adapters replaced
- compose.yaml fixed; duplicate dev_auth.py and test.ini removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-03 13:09:52 -07:00
1 parent 9f17e145ff
commit 75946be7b2
67 files changed
+885 -498

No files matched your search

+14 -9
View File
@@ -99,7 +99,8 @@ class FakeWeb:
self.fetched = []
def __call__(self, request):
url = str(request.url)
# Pinned requests go to the checked IP; the Host header names the site
url = f"{request.url.scheme}://{request.headers['host']}{request.url.raw_path.decode()}"
self.fetched.append(url)
status, headers, body = self.pages.get(url, (404, {}, b"nope"))
return httpx.Response(status, headers=headers, content=body)
@@ -112,11 +113,20 @@ def web():
def routed(pds, web):
return httpx.MockTransport(
lambda r: pds(r) if r.url.host in ("bsky.example", "pds.example") else web(r))
lambda r: pds(r) if r.headers.get("host", r.url.host) in ("bsky.example", "pds.example") else web(r))
def resolve(host, *args, **kwargs):
"""Every test host is public, except internal.example"""
ip = "10.0.0.5" if host == "internal.example" else "93.184.216.34"
return [(2, 1, 6, "", (ip, 0))]
@pytest.fixture
def app(tmp_path, pds, web):
def app(tmp_path, pds, web, monkeypatch):
# Pages and images for link cards go through the shared SSRF-safe fetcher (v2.11.0)
monkeypatch.setattr("starpunk.webmention_ssrf.TRANSPORT", routed(pds, web))
monkeypatch.setattr("starpunk.webmention_ssrf.socket.getaddrinfo", resolve)
data = tmp_path / "data"
app = create_app({
"TESTING": True,
@@ -328,12 +338,7 @@ class TestLinkCards:
def test_redirect_to_private_address_is_not_followed(self, app, pds, web, monkeypatch):
web.pages[ARTICLE] = (302, {"location": "http://internal.example/admin"}, b"")
monkeypatch.setattr("starpunk.micropub._public_address", lambda host: host != "internal.example")
app.config["TESTING"] = False
try:
publish(app, content=f"See {ARTICLE}")
finally:
app.config["TESTING"] = True
publish(app, content=f"See {ARTICLE}") # internal.example resolves to 10.0.0.5
assert "http://internal.example/admin" not in web.fetched
assert only_record(pds)["embed"]["external"]["title"] == ARTICLE