Commit 188a744
authored
Reject tokens naming a deactivated account in the FAB auth manager (#72199)
deserialize_user resolved the token subject by id alone, so a bearer issued
before an account was deactivated continued to resolve to that user. The
password path already refuses an inactive account in auth_user_db; the token
path did not. The account state is now re-checked when the user is loaded,
and a null 'active' column is treated as inactive to match auth_user_db.
The check runs when the user is loaded, so it is bounded by the existing
[fab] cache_ttl window (30s by default) rather than being immediate.
test_is_logged_in_with_inactive_user set is_active via return_value, but
is_active is a property, so the mock stayed truthy and the assertion held
regardless of the state under test. It now sets the attribute, and an
active-user counterpart was added alongside it.1 parent cdc5d9f commit 188a744
2 files changed
Lines changed: 53 additions & 3 deletions
File tree
- providers/fab
- src/airflow/providers/fab/auth_manager
- tests/unit/fab/auth_manager
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
298 | 306 | | |
299 | 307 | | |
300 | 308 | | |
| |||
Lines changed: 44 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
224 | 254 | | |
225 | 255 | | |
226 | 256 | | |
| |||
256 | 286 | | |
257 | 287 | | |
258 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
259 | 292 | | |
260 | | - | |
261 | | - | |
| 293 | + | |
| 294 | + | |
262 | 295 | | |
263 | 296 | | |
264 | 297 | | |
265 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
266 | 308 | | |
267 | 309 | | |
268 | 310 | | |
| |||
0 commit comments