Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI/OIDC auth bug for cloud ui HCP namespace flag #16886

Merged

Conversation

hellobontempo
Copy link
Contributor

@hellobontempo hellobontempo commented Aug 25, 2022

Fixes the afterModel() hook so that it can handle both when a namespace comes in as a param from the cluster: namespaceQueryParam = 'admin' and when it's attached to the state from the route params: state="st_z6y8L12PndJ33FmW1Ls2,ns=admin"

The namespace passed via state will take precedence

@hellobontempo hellobontempo modified the milestones: 1.11.3, 1.10.6 Aug 25, 2022
@hellobontempo hellobontempo added ui bug Used to indicate a potential bug backport/1.10.x labels Aug 25, 2022
Copy link
Collaborator

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

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

Great work, thank you! Just a couple small notes

@mladlow
Copy link
Collaborator

mladlow commented Aug 26, 2022

Hey folks, if this PR doesn't merge today, could someone please re-milestone it for 1.10.7, as it will miss the freeze?

@hellobontempo hellobontempo marked this pull request as ready for review August 26, 2022 16:56
assert.propContains(
this.windowStub.lastCall.args[0],
{
code: undefined,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think leaving these as undefined might lead to some weird behavior on the postMessage receiver side, could we default to empty string if these don't exist? A bit more verbose but something like:

     let queryParams = { source, path: path || '', code: code || '', state: state || '' }; 

Maybe as a follow-on, because I think that's not likely a scenario we'll get into in real life

// only replace namespace param from cluster if state has a namespace
if (state?.includes(',ns=')) {
[state, namespace] = state.split(',ns=');
}
path = window.decodeURIComponent(path);
const source = 'oidc-callback'; // required by event listener in auth-jwt component
let queryParams = { source, namespace, path, code, state };
Copy link
Collaborator

@hashishaw hashishaw Aug 26, 2022

Choose a reason for hiding this comment

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

One more cleanup task (follow-on) is, if namespace doesn't exist don't include it. So remove from queryParams here and then below do
if (namespace) queryParams.namespace = namespace

Copy link
Collaborator

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

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

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gitlab OIDC callback error on Web UI - cannot read properties of null (reading 'includes')
3 participants