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

"propagate_claims" with empty array value got 500 and empty resp body #121

Open
AlAnwari-ari opened this issue Aug 30, 2023 · 2 comments
Open

Comments

@AlAnwari-ari
Copy link

AlAnwari-ari commented Aug 30, 2023

I'm using "propagate_claims" and want to put the header value with its token data. But suddenly i got 500 response code and no body response when i got empty array. ex:
"auth/validator": { ... "propagate_claims": [["group", "X-GROUP"]] }
and group value is empty array group:[]
anything insight would be very appreciate it...
thank you

@alombarte
Copy link
Member

Thank you @AlAnwari-ari, we will look into this shortly and get back to you

@dhontecillas
Copy link
Contributor

@AlAnwari-ari : I've create a branch to try to reproduce the issue here : https://github.com/krakend/krakend-jose/pull/125/files

Just so I understand it correctly: you issue is that some claim in jwt has a value of an array, when that array has some value, your request succeeds, but when it is empty, you get an error ?

I would need more information about how to reproduce it, mostly because, looking at the code here: https://github.com/krakend/krakend-jose/blob/master/jose.go#L265 does not look like it could fail , in case of an empty array, it would return an empty string value.

However, if the issue is that "group" is not an empty array, but is just a key that is not there, the behaviour was for the header to not be there .

On the other side, if the "group" key is there, but with a null value, the Header will be set with an string value of "null" (the behaviour can be found in this example https://go.dev/play/p/JbVTfL3E3fu?v=goprev ) .

But, in any case, it should not break , or produce an error.

Take into account, that in the soon to be released new CE version, the behaviour will be different, and the header will be always there, set to empty string if no value is there.

In any case, I could not reproduce the error issue.. so I wonder if the error is the side effect of not having the expected headers somewhere down in the pipeline, or produced by the response of a backend that was expecting the header to be there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants