Repository navigation
[v3-3-test] Honor FORWARDED_ALLOW_IPS when the API server runs under gunicorn (#71429) - #71708
Conversation
…gunicorn (#71429) * Honor FORWARDED_ALLOW_IPS when the API server runs under gunicorn Running behind a TLS-terminating proxy is documented as `--proxy-headers` plus `FORWARDED_ALLOW_IPS` to say which proxies may be trusted, and that is what the uvicorn server type does. The gunicorn server type forced the trust list to every address instead, so an operator who narrowed it to their proxy silently got a server that accepted X-Forwarded-* from anyone able to reach it directly -- including the X-Forwarded-Proto that decides whether session cookies are issued with the Secure attribute. Both server types now follow the documented contract. related: #47878 * Delete airflow-core/newsfragments/71429.significant.rst * Warn about the wide gunicorn proxy-header default instead of tightening it Deployments whose proxy is not on the API server's host, and which never set FORWARDED_ALLOW_IPS, are relying on gunicorn being handed a trust list of every address. Reading the variable where it is set already gives operators back the control they thought they had; taking the wide default away from everyone else belongs in a major version. The reverse-proxy guide named uvicorn throughout, from when it was the only option. * Re-run CI after a transient go-mod-tidy download failure (cherry picked from commit d4581ae) Co-authored-by: rjgoyln <[email protected]>
110e1cd to
8b4a10f
Compare
potiuk
left a comment
There was a problem hiding this comment.
Rebased onto the current v3-3-test tip; replays cleanly and the gunicorn app tests pass locally against this branch.
Scope note for a maintenance branch: this is a security fix rather than a feature — UvicornWorker leaves uvicorn's proxy_headers at its default of True, so turning proxy headers off still trusted X-Forwarded-* from every client until now. Worth flagging that the change also introduces a RemovedInAirflow4Warning that fires whenever FORWARDED_ALLOW_IPS is unset, so deployments that never set it will start seeing a new deprecation warning on this branch.
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
|
Hi maintainer, this PR was merged without a milestone set.
|
…gunicorn (#71429) (#71708) * Honor FORWARDED_ALLOW_IPS when the API server runs under gunicorn Running behind a TLS-terminating proxy is documented as `--proxy-headers` plus `FORWARDED_ALLOW_IPS` to say which proxies may be trusted, and that is what the uvicorn server type does. The gunicorn server type forced the trust list to every address instead, so an operator who narrowed it to their proxy silently got a server that accepted X-Forwarded-* from anyone able to reach it directly -- including the X-Forwarded-Proto that decides whether session cookies are issued with the Secure attribute. Both server types now follow the documented contract. related: #47878 * Delete airflow-core/newsfragments/71429.significant.rst * Warn about the wide gunicorn proxy-header default instead of tightening it Deployments whose proxy is not on the API server's host, and which never set FORWARDED_ALLOW_IPS, are relying on gunicorn being handed a trust list of every address. Reading the variable where it is set already gives operators back the control they thought they had; taking the wide default away from everyone else belongs in a major version. The reverse-proxy guide named uvicorn throughout, from when it was the only option. * Re-run CI after a transient go-mod-tidy download failure (cherry picked from commit d4581ae) Co-authored-by: rjgoyln <[email protected]>
Running behind a TLS-terminating proxy is documented as
--proxy-headersplus
FORWARDED_ALLOW_IPSto say which proxies may be trusted, and that iswhat the uvicorn server type does. The gunicorn server type forced the
trust list to every address instead, so an operator who narrowed it to
their proxy silently got a server that accepted X-Forwarded-* from anyone
able to reach it directly -- including the X-Forwarded-Proto that decides
whether session cookies are issued with the Secure attribute.
Both server types now follow the documented contract.
related: #47878
Delete airflow-core/newsfragments/71429.significant.rst
Warn about the wide gunicorn proxy-header default instead of tightening it
Deployments whose proxy is not on the API server's host, and which never set
FORWARDED_ALLOW_IPS, are relying on gunicorn being handed a trust list of
every address. Reading the variable where it is set already gives operators
back the control they thought they had; taking the wide default away from
everyone else belongs in a major version.
The reverse-proxy guide named uvicorn throughout, from when it was the only
option.
(cherry picked from commit d4581ae)
Co-authored-by: rjgoyln [email protected]