Skip to content

Add FAB option to log users out after a maximum session lifetime - #72825

Merged
vincbeck merged 1 commit into
apache:mainfrom
aws-mwaa:vincbeck/fab-session-max-lifetime
Sep 15, 2026
Merged

vincbeck merged 1 commit into
apache:mainfrom
aws-mwaa:vincbeck/fab-session-max-lifetime

Conversation

@vincbeck

@vincbeck vincbeck commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Deployments with compliance requirements need users to re-authenticate on a fixed schedule. The existing [fab] session_lifetime_minutes cannot express that: it is an inactivity deadline, and an Airflow UI tab left open keeps the session active on its own because the UI polls the API in the background and silently re-authenticates whenever its token expires, so the deadline never arrives.

Reported in #48787.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@o-nikolas o-nikolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable overall to me, agent found a few things, I pulled out the too I think are most salient.

Comment thread providers/fab/src/airflow/providers/fab/www/extensions/init_session.py Outdated
Comment thread providers/fab/provider.yaml Outdated
@vincbeck
vincbeck force-pushed the vincbeck/fab-session-max-lifetime branch from 631d202 to e6cff47 Compare September 11, 2026 15:19
ShousenZHANG added a commit to ShousenZHANG/airflow that referenced this pull request Sep 11, 2026
Five of the seven `providers/fab/.../www/extensions/` modules were listed in
`OVERLOOKED_TESTS` with no tests at all, and `create_app()` calls all five while
building the Flask app, so a regression in any of them either stops the app from
starting or silently changes what it serves.

What the tests pin, per module:

- `init_wsgi_middlewares`: the five `[fab] proxy_fix_x_*` options are set to five
  distinct values, so a mix-up between the five near-identical `ProxyFix` keyword
  arguments fails; and `wsgi_app` is left untouched when the option is off.
- `init_security`: the comma split and per-entry strip, the import order, the
  default backend, and `ImportError` becoming `AirflowException`. An empty
  `auth_backends` raises `ValueError` instead, which `except ImportError` does not
  catch - recorded as current behaviour.
- `init_jinja_globals`: the three `default_timezone` branches including the
  non-callable guard, hostname redaction when `[fab] expose_hostname` is off, the
  four navbar colours, and the two opposite globals driven by `enable_plugins`.
- `init_manifest_files`: the `dist/` prefixing, the fallback to the raw filename
  when the manifest is missing or the key is unknown, and the debug-mode re-read.
- `init_views`: `view` not being forwarded twice for named views,
  `add_view_no_menu` for unnamed ones, the named-view-without-a-view log, blueprint
  registration, and the 500/404 handler pair.

Verified by mutation rather than by assertion count: 22 one-line breakages of the
five modules were each applied in turn, and all 22 make the new tests fail.

Drops the five matching paths from `OVERLOOKED_TESTS`, leaving `init_appbuilder`
(615 lines, its own PR) and `init_session` (already covered by apache#72825).

Generated-by: Claude Code
@vincbeck
vincbeck force-pushed the vincbeck/fab-session-max-lifetime branch from e6cff47 to e77ecb3 Compare September 15, 2026 12:48
@vincbeck
vincbeck requested a review from o-nikolas September 15, 2026 12:49
@vincbeck
vincbeck force-pushed the vincbeck/fab-session-max-lifetime branch from e77ecb3 to f321f1d Compare September 15, 2026 15:22
Deployments with compliance requirements need users to re-authenticate on a
fixed schedule. The existing [fab] session_lifetime_minutes cannot express
that: it is an inactivity deadline, and an Airflow UI tab left open keeps the
session active on its own because the UI polls the API in the background and
silently re-authenticates whenever its token expires, so the deadline never
arrives.

Reported in apache#48787.
@vincbeck
vincbeck force-pushed the vincbeck/fab-session-max-lifetime branch from f321f1d to 8ebba11 Compare September 15, 2026 15:23
@vincbeck
vincbeck merged commit 3546d02 into apache:main Sep 15, 2026
80 checks passed
@vincbeck
vincbeck deleted the vincbeck/fab-session-max-lifetime branch September 15, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants