Skip to content

Conversation

@dheerajturaga
Copy link
Member

@dheerajturaga dheerajturaga commented Apr 14, 2025

Resolves #49229

Login with FabAuthManager fails when api.base_url is unset. This should fix it

Aligning implementation with #49118 which should resolve the infinite redirect

Resolves apache#49229
Login with FabAuthManager fails when api.base_url is unset. Aligning with implementation with apache#49118
@dheerajturaga dheerajturaga requested a review from vincbeck as a code owner April 14, 2025 23:53
@dheerajturaga dheerajturaga changed the title Handle scenario where api.base_url is unset Handle scenario where api.base_url is unset for FabAuthManager login Apr 14, 2025
if g.user is not None and g.user.is_authenticated:
token = get_auth_manager().generate_jwt(g.user)
response = make_response(redirect(f"{conf.get('api', 'base_url')}", code=302))
response = make_response(redirect(str(request.base_url), code=302))

Check warning

Code scanning / CodeQL

URL redirection from remote source Medium

Untrusted URL redirection depends on a
user-provided value
.
Copy link
Member

Choose a reason for hiding this comment

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

conf.get('api', 'base_url', fallback='/') here

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to Pierre's comment


return response
return redirect(conf.get("api", "base_url", fallback="/"), code=302)
return redirect(str(request.base_url), code=302)

Check warning

Code scanning / CodeQL

URL redirection from remote source Medium

Untrusted URL redirection depends on a
user-provided value
.
Copy link
Member

Choose a reason for hiding this comment

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

And you can remove this I believe

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

I tried that and it didn't work for me.

We can just do conf.get('api', 'base_url', fallback='/') that should be enough, where the fallback is missing. Just tested locally and seems to work

@pierrejeambrun
Copy link
Member

Since this is a little bit pressing, considering AF3 timelines I took the liberty to open a PR to fix that with the suggestions #49292

@dheerajturaga
Copy link
Member Author

I tried that and it didn't work for me.

We can just do conf.get('api', 'base_url', fallback='/') that should be enough, where the fallback is missing. Just tested locally and seems to work

I may not have the right setup but I did test this before request.base_url and it didn't work. I just modified the file in the container and restarted it. But if you confirm it works its fine with me

@pierrejeambrun
Copy link
Member

Yes I was able to test with a fresh env, and also confirm that this is also what we are doing in the SimpleAuthManager

@kaxil kaxil closed this in #49292 Apr 15, 2025
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.

Api server login broken when using FabAuthManager on 3.0.0rc2

3 participants