SachinyadavAug20 commented on code in PR #77209:
URL: https://github.com/apache/airflow/pull/77209#discussion_r4609194781
##########
providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py:
##########
@@ -205,6 +207,27 @@ def _start_login(request: Request, mode: str) ->
RedirectResponse:
}
)
_write_pending_logins(request, response, pending)
+ if mode == LOGIN_MODE_REDIRECT:
+ cookie_path = get_cookie_path()
+ secure = _is_secure_request(request)
+ next_url = request.query_params.get("next")
+ if next_url and is_safe_url(next_url, request=request):
+ response.set_cookie(
+ COOKIE_NAME_LOGIN_NEXT_URL,
Review Comment:
Thanks @vincbeck and @o-nikolas! Updated the PR to store `next` directly
inside the pending entry in `_awsam_login_state` and dropped the extra cookie
entirely:
- **Per-tab isolation**: Each tab retains its own `next` alongside `nonce`,
so concurrent tabs won't overwrite each other.
- **Size cap**: Added `MAX_NEXT_URL_LENGTH = 500` to prevent entries from
pushing the cookie past the 4 KB limit. Longer URLs safely fall back to
`base_url`.
- **IdP-initiated fallback**: Unsolicited logins (`matched is None`)
naturally fall back to `base_url`.
- All 97 unit tests passing with new tests covering per-tab isolation, size
limits, and callback redirects.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]