dash-auth-async 1.3.2__tar.gz → 1.3.4__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.
- {dash_auth_async-1.3.2/dash_auth_async.egg-info → dash_auth_async-1.3.4}/PKG-INFO +57 -1
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/README.md +56 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/oidc_auth.py +9 -9
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/version.py +1 -1
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4/dash_auth_async.egg-info}/PKG-INFO +57 -1
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/pyproject.toml +20 -5
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/LICENSE +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/MANIFEST.in +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/__init__.py +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/_optional.py +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/auth.py +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/backends.py +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/basic_auth.py +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/group_protection.py +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/public_routes.py +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/quart_client.py +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async/websocket_auth.py +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async.egg-info/SOURCES.txt +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async.egg-info/dependency_links.txt +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async.egg-info/requires.txt +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async.egg-info/top_level.txt +0 -0
- {dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dash-auth-async
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.4
|
|
4
4
|
Summary: Dash Authorization Package.
|
|
5
5
|
Author-email: Jonas Schrage <119843859+joschrag@users.noreply.github.com>
|
|
6
6
|
License: MIT
|
|
@@ -261,6 +261,62 @@ auth.register_provider(
|
|
|
261
261
|
|
|
262
262
|
Once this is done, connecting to your app will automatically redirect to the IDP login page.
|
|
263
263
|
|
|
264
|
+
#### Running behind a reverse proxy
|
|
265
|
+
|
|
266
|
+
> **Behavior change.** Earlier versions rewrote the OIDC callback host from the
|
|
267
|
+
> client-supplied `X-Forwarded-Host` header. That header trust was **removed** — an
|
|
268
|
+
> attacker could set it to steer the `redirect_uri` handed to your IDP (auth-code leak /
|
|
269
|
+
> open redirect). The `redirect_uri` is now built **only** from the host and scheme of
|
|
270
|
+
> the incoming request.
|
|
271
|
+
|
|
272
|
+
The consequence: behind a proxy that terminates TLS or rewrites the host, the
|
|
273
|
+
`redirect_uri` comes out as `http://localhost:8050/...` and your IDP rejects it. To get
|
|
274
|
+
the real public host and scheme back, **restore it at the transport layer** — where the
|
|
275
|
+
trust can be bounded to your actual proxy, instead of trusting any client.
|
|
276
|
+
|
|
277
|
+
Two separate things to restore: **scheme** (http→https) and **host**. Most app servers
|
|
278
|
+
forward the scheme but **not** the host — `--forwarded-allow-ips` / `--proxy-headers`
|
|
279
|
+
only governs `X-Forwarded-Proto`/`-For`, never the host. So:
|
|
280
|
+
|
|
281
|
+
* **Scheme:** set `force_https_callback=True` on `OIDCAuth` (or pass the name of an env
|
|
282
|
+
var that, when present, enables it). This covers the http→https half on every backend.
|
|
283
|
+
* **Host:** add proxy middleware that honours `X-Forwarded-Host`, sized to your real
|
|
284
|
+
proxy-chain length:
|
|
285
|
+
|
|
286
|
+
| Backend | Server(s) | How to restore the host |
|
|
287
|
+
|---|---|---|
|
|
288
|
+
| **Flask** | gunicorn, waitress, mod_wsgi, … | `werkzeug` `ProxyFix` on the WSGI app (server-independent — gunicorn alone won't do the host) |
|
|
289
|
+
| **Quart** | hypercorn | `ProxyFixMiddleware(mode="modern", trusted_hops=N)` — restores host and scheme |
|
|
290
|
+
| **Quart / FastAPI** | uvicorn | uvicorn `--proxy-headers` does scheme only; add an `X-Forwarded-Host` ASGI middleware or have the proxy rewrite the `Host` header |
|
|
291
|
+
|
|
292
|
+
**Flask** (WSGI — gunicorn, waitress, …):
|
|
293
|
+
|
|
294
|
+
```python
|
|
295
|
+
from werkzeug.middleware.proxy_fix import ProxyFix
|
|
296
|
+
|
|
297
|
+
# Counts MUST equal your real proxy-chain length — setting them higher than the
|
|
298
|
+
# actual chain (or enabling this with no proxy) re-opens the spoofing hole.
|
|
299
|
+
app.server.wsgi_app = ProxyFix(app.server.wsgi_app, x_for=1, x_proto=1, x_host=1)
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Quart** (served by hypercorn) — wrap the ASGI app:
|
|
303
|
+
|
|
304
|
+
```python
|
|
305
|
+
from hypercorn.middleware import ProxyFixMiddleware
|
|
306
|
+
|
|
307
|
+
# trusted_hops MUST equal your real proxy-chain length (see warning below).
|
|
308
|
+
app.server.asgi_app = ProxyFixMiddleware(app.server.asgi_app, mode="modern", trusted_hops=1)
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**FastAPI / Quart on uvicorn:** uvicorn restores the scheme (`--proxy-headers
|
|
312
|
+
--forwarded-allow-ips=...`) but **not** the host. Either have your proxy overwrite the
|
|
313
|
+
`Host` header with the public host, or add a small trusted ASGI middleware that copies
|
|
314
|
+
`X-Forwarded-Host` onto the `host` header — same `trusted_hops` discipline as above.
|
|
315
|
+
|
|
316
|
+
> ⚠️ Only restore proxy-header trust when a real proxy sets those headers, and set the
|
|
317
|
+
> hop counts to the actual chain length. A trusted-host middleware in front of *no*
|
|
318
|
+
> proxy lets a client spoof the host again — which is exactly the trust that was removed.
|
|
319
|
+
|
|
264
320
|
#### Multiple OIDC Providers
|
|
265
321
|
|
|
266
322
|
For multiple OIDC providers, you can use `register_provider` to add new ones after the OIDCAuth has been instantiated.
|
|
@@ -216,6 +216,62 @@ auth.register_provider(
|
|
|
216
216
|
|
|
217
217
|
Once this is done, connecting to your app will automatically redirect to the IDP login page.
|
|
218
218
|
|
|
219
|
+
#### Running behind a reverse proxy
|
|
220
|
+
|
|
221
|
+
> **Behavior change.** Earlier versions rewrote the OIDC callback host from the
|
|
222
|
+
> client-supplied `X-Forwarded-Host` header. That header trust was **removed** — an
|
|
223
|
+
> attacker could set it to steer the `redirect_uri` handed to your IDP (auth-code leak /
|
|
224
|
+
> open redirect). The `redirect_uri` is now built **only** from the host and scheme of
|
|
225
|
+
> the incoming request.
|
|
226
|
+
|
|
227
|
+
The consequence: behind a proxy that terminates TLS or rewrites the host, the
|
|
228
|
+
`redirect_uri` comes out as `http://localhost:8050/...` and your IDP rejects it. To get
|
|
229
|
+
the real public host and scheme back, **restore it at the transport layer** — where the
|
|
230
|
+
trust can be bounded to your actual proxy, instead of trusting any client.
|
|
231
|
+
|
|
232
|
+
Two separate things to restore: **scheme** (http→https) and **host**. Most app servers
|
|
233
|
+
forward the scheme but **not** the host — `--forwarded-allow-ips` / `--proxy-headers`
|
|
234
|
+
only governs `X-Forwarded-Proto`/`-For`, never the host. So:
|
|
235
|
+
|
|
236
|
+
* **Scheme:** set `force_https_callback=True` on `OIDCAuth` (or pass the name of an env
|
|
237
|
+
var that, when present, enables it). This covers the http→https half on every backend.
|
|
238
|
+
* **Host:** add proxy middleware that honours `X-Forwarded-Host`, sized to your real
|
|
239
|
+
proxy-chain length:
|
|
240
|
+
|
|
241
|
+
| Backend | Server(s) | How to restore the host |
|
|
242
|
+
|---|---|---|
|
|
243
|
+
| **Flask** | gunicorn, waitress, mod_wsgi, … | `werkzeug` `ProxyFix` on the WSGI app (server-independent — gunicorn alone won't do the host) |
|
|
244
|
+
| **Quart** | hypercorn | `ProxyFixMiddleware(mode="modern", trusted_hops=N)` — restores host and scheme |
|
|
245
|
+
| **Quart / FastAPI** | uvicorn | uvicorn `--proxy-headers` does scheme only; add an `X-Forwarded-Host` ASGI middleware or have the proxy rewrite the `Host` header |
|
|
246
|
+
|
|
247
|
+
**Flask** (WSGI — gunicorn, waitress, …):
|
|
248
|
+
|
|
249
|
+
```python
|
|
250
|
+
from werkzeug.middleware.proxy_fix import ProxyFix
|
|
251
|
+
|
|
252
|
+
# Counts MUST equal your real proxy-chain length — setting them higher than the
|
|
253
|
+
# actual chain (or enabling this with no proxy) re-opens the spoofing hole.
|
|
254
|
+
app.server.wsgi_app = ProxyFix(app.server.wsgi_app, x_for=1, x_proto=1, x_host=1)
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Quart** (served by hypercorn) — wrap the ASGI app:
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
from hypercorn.middleware import ProxyFixMiddleware
|
|
261
|
+
|
|
262
|
+
# trusted_hops MUST equal your real proxy-chain length (see warning below).
|
|
263
|
+
app.server.asgi_app = ProxyFixMiddleware(app.server.asgi_app, mode="modern", trusted_hops=1)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**FastAPI / Quart on uvicorn:** uvicorn restores the scheme (`--proxy-headers
|
|
267
|
+
--forwarded-allow-ips=...`) but **not** the host. Either have your proxy overwrite the
|
|
268
|
+
`Host` header with the public host, or add a small trusted ASGI middleware that copies
|
|
269
|
+
`X-Forwarded-Host` onto the `host` header — same `trusted_hops` discipline as above.
|
|
270
|
+
|
|
271
|
+
> ⚠️ Only restore proxy-header trust when a real proxy sets those headers, and set the
|
|
272
|
+
> hop counts to the actual chain length. A trusted-host middleware in front of *no*
|
|
273
|
+
> proxy lets a client spoof the host again — which is exactly the trust that was removed.
|
|
274
|
+
|
|
219
275
|
#### Multiple OIDC Providers
|
|
220
276
|
|
|
221
277
|
For multiple OIDC providers, you can use `register_provider` to add new ones after the OIDCAuth has been instantiated.
|
|
@@ -249,21 +249,21 @@ class OIDCAuth(Auth):
|
|
|
249
249
|
def _create_redirect_uri(self, idp: str):
|
|
250
250
|
"""Create the redirect uri based on callback endpoint and idp.
|
|
251
251
|
|
|
252
|
+
Host and scheme come from the request scope only. Behind a proxy,
|
|
253
|
+
configure the WSGI/ASGI server to populate them from forwarded headers
|
|
254
|
+
(werkzeug ``ProxyFix`` / hypercorn ``--forwarded-allow-ips``) — the
|
|
255
|
+
library must never trust a client-supplied ``X-Forwarded-Host`` to
|
|
256
|
+
build the IdP ``redirect_uri`` (auth-code leak / open redirect).
|
|
257
|
+
``force_https_callback`` covers the scheme half of dash-auth#154.
|
|
258
|
+
|
|
252
259
|
Returns:
|
|
253
260
|
The fully-qualified OIDC callback redirect URI.
|
|
254
261
|
"""
|
|
255
262
|
if self.force_https_callback:
|
|
256
|
-
|
|
263
|
+
return self.backend.url_for(
|
|
257
264
|
"oidc_callback", idp=idp, _external=True, _scheme="https"
|
|
258
265
|
)
|
|
259
|
-
|
|
260
|
-
redirect_uri = self.backend.url_for(
|
|
261
|
-
"oidc_callback", idp=idp, _external=True
|
|
262
|
-
)
|
|
263
|
-
host = self.request.headers.get("X-Forwarded-Host")
|
|
264
|
-
if host:
|
|
265
|
-
redirect_uri = redirect_uri.replace(self.backend.current_host(), host, 1)
|
|
266
|
-
return redirect_uri
|
|
266
|
+
return self.backend.url_for("oidc_callback", idp=idp, _external=True)
|
|
267
267
|
|
|
268
268
|
def login_request(self, idp: str | None = None):
|
|
269
269
|
"""Start the login process.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dash-auth-async
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.4
|
|
4
4
|
Summary: Dash Authorization Package.
|
|
5
5
|
Author-email: Jonas Schrage <119843859+joschrag@users.noreply.github.com>
|
|
6
6
|
License: MIT
|
|
@@ -261,6 +261,62 @@ auth.register_provider(
|
|
|
261
261
|
|
|
262
262
|
Once this is done, connecting to your app will automatically redirect to the IDP login page.
|
|
263
263
|
|
|
264
|
+
#### Running behind a reverse proxy
|
|
265
|
+
|
|
266
|
+
> **Behavior change.** Earlier versions rewrote the OIDC callback host from the
|
|
267
|
+
> client-supplied `X-Forwarded-Host` header. That header trust was **removed** — an
|
|
268
|
+
> attacker could set it to steer the `redirect_uri` handed to your IDP (auth-code leak /
|
|
269
|
+
> open redirect). The `redirect_uri` is now built **only** from the host and scheme of
|
|
270
|
+
> the incoming request.
|
|
271
|
+
|
|
272
|
+
The consequence: behind a proxy that terminates TLS or rewrites the host, the
|
|
273
|
+
`redirect_uri` comes out as `http://localhost:8050/...` and your IDP rejects it. To get
|
|
274
|
+
the real public host and scheme back, **restore it at the transport layer** — where the
|
|
275
|
+
trust can be bounded to your actual proxy, instead of trusting any client.
|
|
276
|
+
|
|
277
|
+
Two separate things to restore: **scheme** (http→https) and **host**. Most app servers
|
|
278
|
+
forward the scheme but **not** the host — `--forwarded-allow-ips` / `--proxy-headers`
|
|
279
|
+
only governs `X-Forwarded-Proto`/`-For`, never the host. So:
|
|
280
|
+
|
|
281
|
+
* **Scheme:** set `force_https_callback=True` on `OIDCAuth` (or pass the name of an env
|
|
282
|
+
var that, when present, enables it). This covers the http→https half on every backend.
|
|
283
|
+
* **Host:** add proxy middleware that honours `X-Forwarded-Host`, sized to your real
|
|
284
|
+
proxy-chain length:
|
|
285
|
+
|
|
286
|
+
| Backend | Server(s) | How to restore the host |
|
|
287
|
+
|---|---|---|
|
|
288
|
+
| **Flask** | gunicorn, waitress, mod_wsgi, … | `werkzeug` `ProxyFix` on the WSGI app (server-independent — gunicorn alone won't do the host) |
|
|
289
|
+
| **Quart** | hypercorn | `ProxyFixMiddleware(mode="modern", trusted_hops=N)` — restores host and scheme |
|
|
290
|
+
| **Quart / FastAPI** | uvicorn | uvicorn `--proxy-headers` does scheme only; add an `X-Forwarded-Host` ASGI middleware or have the proxy rewrite the `Host` header |
|
|
291
|
+
|
|
292
|
+
**Flask** (WSGI — gunicorn, waitress, …):
|
|
293
|
+
|
|
294
|
+
```python
|
|
295
|
+
from werkzeug.middleware.proxy_fix import ProxyFix
|
|
296
|
+
|
|
297
|
+
# Counts MUST equal your real proxy-chain length — setting them higher than the
|
|
298
|
+
# actual chain (or enabling this with no proxy) re-opens the spoofing hole.
|
|
299
|
+
app.server.wsgi_app = ProxyFix(app.server.wsgi_app, x_for=1, x_proto=1, x_host=1)
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Quart** (served by hypercorn) — wrap the ASGI app:
|
|
303
|
+
|
|
304
|
+
```python
|
|
305
|
+
from hypercorn.middleware import ProxyFixMiddleware
|
|
306
|
+
|
|
307
|
+
# trusted_hops MUST equal your real proxy-chain length (see warning below).
|
|
308
|
+
app.server.asgi_app = ProxyFixMiddleware(app.server.asgi_app, mode="modern", trusted_hops=1)
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**FastAPI / Quart on uvicorn:** uvicorn restores the scheme (`--proxy-headers
|
|
312
|
+
--forwarded-allow-ips=...`) but **not** the host. Either have your proxy overwrite the
|
|
313
|
+
`Host` header with the public host, or add a small trusted ASGI middleware that copies
|
|
314
|
+
`X-Forwarded-Host` onto the `host` header — same `trusted_hops` discipline as above.
|
|
315
|
+
|
|
316
|
+
> ⚠️ Only restore proxy-header trust when a real proxy sets those headers, and set the
|
|
317
|
+
> hop counts to the actual chain length. A trusted-host middleware in front of *no*
|
|
318
|
+
> proxy lets a client spoof the host again — which is exactly the trust that was removed.
|
|
319
|
+
|
|
264
320
|
#### Multiple OIDC Providers
|
|
265
321
|
|
|
266
322
|
For multiple OIDC providers, you can use `register_provider` to add new ones after the OIDCAuth has been instantiated.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dash-auth-async"
|
|
7
|
-
version = "1.3.
|
|
7
|
+
version = "1.3.4"
|
|
8
8
|
description = "Dash Authorization Package."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -77,10 +77,25 @@ dev = [
|
|
|
77
77
|
|
|
78
78
|
[tool.uv]
|
|
79
79
|
constraint-dependencies = [
|
|
80
|
-
|
|
81
|
-
#
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
# GHSA-g6cj-pr64-35w5: PKCS#7 EnvelopedData decryption Bleichenbacher
|
|
81
|
+
# oracle below 50.0.0. Pulled in transitively via authlib.
|
|
82
|
+
"cryptography>=50.0.0",
|
|
83
|
+
# GHSA-h35f-9h28-mq5c: MANIFEST.in exclusion bypass via NFC/NFD
|
|
84
|
+
# collision below 83.0.0. Pulled in transitively via dash/build backend.
|
|
85
|
+
"setuptools>=83.0.0",
|
|
86
|
+
# GHSA-ffq3-xpv3-j92q and others: quadratic-time parsing / XSS / path
|
|
87
|
+
# traversal below 3.3.0. Pulled in transitively via nbconvert.
|
|
88
|
+
"mistune>=3.3.0",
|
|
89
|
+
# GHSA-vj7q-gjh5-988w: WebSocket transport missing Host/Origin
|
|
90
|
+
# validation below 1.28.1. Pulled in transitively via dash.
|
|
91
|
+
"mcp>=1.28.1",
|
|
92
|
+
# GHSA-6hr6-w5qg-qmwg: duplicate Host header request-smuggling risk
|
|
93
|
+
# at and below 4.4.0. Pulled in transitively via hypercorn.
|
|
94
|
+
"h2>=4.4.1",
|
|
95
|
+
# GHSA-mpf4-983q-p7j4 and others: unbounded urlencoded/multipart
|
|
96
|
+
# parsing DoS at and below 6.5.7. Pulled in transitively via
|
|
97
|
+
# jupyter-client.
|
|
98
|
+
"tornado>=6.5.8",
|
|
84
99
|
]
|
|
85
100
|
override-dependencies = [
|
|
86
101
|
"urllib3>=2.7.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dash_auth_async-1.3.2 → dash_auth_async-1.3.4}/dash_auth_async.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|