vpndetection-fastapi 2.1.16__tar.gz → 2.1.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/CHANGELOG.md +6 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/PKG-INFO +2 -2
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/pyproject.toml +1 -1
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/src/vpndetection_fastapi/__init__.py +1 -1
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/tests/test_middleware.py +31 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/.github/workflows/ci.yml +0 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/.github/workflows/release.yml +0 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/.gitignore +0 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/LICENSE +0 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/README.md +0 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/SECURITY.md +0 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/src/vpndetection_fastapi/py.typed +0 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/testdata/bogons.json +0 -0
- {vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/testdata/testdata.json +0 -0
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
What each release changed for you, newest first. Each line is a commit's summary, linked to its full description and diff. Releases before 2.0.5 are described by their release commits.
|
|
4
4
|
|
|
5
|
+
## 2.1.17 - 2026-11-11
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
- Require vpndetection 5.13.1: a client concurrency is checked where it is set ([`9fe9b92`](https://github.com/vpndetection-io/sdk-python-fastapi/commit/9fe9b924446f4c8fdd4358a0f78b754d00b56ef0))
|
|
10
|
+
|
|
5
11
|
## 2.1.16 - 2026-11-07
|
|
6
12
|
|
|
7
13
|
### Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: vpndetection-fastapi
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.17
|
|
4
4
|
Summary: Official FastAPI and Starlette middleware for the VPNDetection API. Detect VPNs, proxies, Tor, hosting and CDN visitors on every request.
|
|
5
5
|
Project-URL: Homepage, https://vpndetection.io
|
|
6
6
|
Project-URL: Source, https://github.com/vpndetection-io/sdk-python-fastapi
|
|
@@ -20,7 +20,7 @@ Classifier: Topic :: Security
|
|
|
20
20
|
Classifier: Typing :: Typed
|
|
21
21
|
Requires-Python: >=3.11
|
|
22
22
|
Requires-Dist: starlette>=0.37
|
|
23
|
-
Requires-Dist: vpndetection<6,>=5.13.
|
|
23
|
+
Requires-Dist: vpndetection<6,>=5.13.1
|
|
24
24
|
Provides-Extra: dev
|
|
25
25
|
Requires-Dist: fastapi>=0.115; extra == 'dev'
|
|
26
26
|
Requires-Dist: mypy>=1.11; extra == 'dev'
|
|
@@ -375,3 +375,34 @@ def test_the_middleware_starts_the_way_the_readme_builds_it(
|
|
|
375
375
|
assert body["attached"] is True
|
|
376
376
|
assert body["is_bogon"] is True
|
|
377
377
|
assert body["error"] is None
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
# The README's middleware again, served a PUBLIC peer with a forged X-Forwarded-For: the key must
|
|
381
|
+
# reach the API, and the socket address must be the one looked up. The test above is answered
|
|
382
|
+
# with no request, so it passed with the key dropped. httpx's own transport answers for the
|
|
383
|
+
# API's host alone, so nothing leaves the machine.
|
|
384
|
+
def test_the_readme_middleware_sends_its_key_for_a_public_peer(
|
|
385
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
386
|
+
) -> None:
|
|
387
|
+
sent: list[tuple[str, str | None]] = []
|
|
388
|
+
|
|
389
|
+
async def handle(
|
|
390
|
+
_transport: httpx.AsyncHTTPTransport, request: httpx.Request
|
|
391
|
+
) -> httpx.Response:
|
|
392
|
+
if request.url.host != "api.vpndetection.io":
|
|
393
|
+
raise httpx.ConnectError("only the API's host answers here", request=request)
|
|
394
|
+
sent.append((request.url.path, request.headers.get("Authorization")))
|
|
395
|
+
return httpx.Response(200, json={"ip": PUBLIC_IP, "is_vpn": True})
|
|
396
|
+
|
|
397
|
+
monkeypatch.setattr(httpx.AsyncHTTPTransport, "handle_async_request", handle)
|
|
398
|
+
monkeypatch.setenv("VPNDETECTION_API_KEY", "a-key")
|
|
399
|
+
app = app_with(api_key=os.environ["VPNDETECTION_API_KEY"])
|
|
400
|
+
with TestClient(app, client=(PUBLIC_IP, 12345)) as client:
|
|
401
|
+
response = client.get("/", headers={"X-Forwarded-For": "1.1.1.1"})
|
|
402
|
+
status, body = response.status_code, response.json()
|
|
403
|
+
|
|
404
|
+
assert status == 200
|
|
405
|
+
assert body["ip"] == PUBLIC_IP, "the socket peer is looked up; the header is a forgery"
|
|
406
|
+
assert body["error"] is None and body["is_vpn"] is True
|
|
407
|
+
assert len(sent) == 1 and sent[0][0].endswith(PUBLIC_IP)
|
|
408
|
+
assert sent[0][1] == "Bearer a-key"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vpndetection_fastapi-2.1.16 → vpndetection_fastapi-2.1.17}/src/vpndetection_fastapi/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|