-
Notifications
You must be signed in to change notification settings - Fork 259
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
Empty lists not indexable #411
Comments
Thanks for the report @andrewkrug! It may be acceptable to return @rohe might know what best course to take here, he added this in 1b7ad6c (which was 6 years ago - wow!). Please do open your pull request against this repository. We'll get it merged ASAP. |
Re: It may be acceptable to return None, I am not sure. Could you provide your motivation for not raising an exception? Also, a test would be very much appreciated as well. Effectively this a really generic method on the message object that takes any number of items and converts them to a dictionary. The switch I've referenced on line 322 performs that isinstance comparison to determine if the to_dict() method needs to recurse further into the profile and continue turning things into dictionaries. In this case the statement I've provided in the below block This allows RPs consuming ID Token and Userinfo data to receive empty lists back and have them parsed properly into sessions. The default behavior here for comparisons sake is still left intact as inside of this loop I'm happy to provide a test to cover this case OR alternatively I can extend your oic claims in the current body of tests to cover a case where one or more of the attributes is [] instead of "" or None. Thanks
|
Thanks for explaining! Please add a test to cover this case and we're good! 🍻 |
Do you know when we might see the next release of pyoidc with this in it? Also @zamzterz will there be plans to bump flask-pyoidc to latest in support of having this bug fix in all the places? |
I can make a minor release by monday if no one has objections. If you want to include the version bump, submit a PR (someone, anyone :)) and Ill review. |
@lwm less important for us at the moment as it would seem that the module we most care about only works with oic 0.9.1 ( flask_pyoidc ). I'm hoping that @zamzterz can commit to aligning that with the latest code. I appreciate your willingness to do a dot release. Any chance we could get this into an 0.9.1.1 regression or something? |
@andrewkrug Should definitely be possible to upgrade the dependency in Flask-pyoidc when a new release is done. I expect that it shouldn't require any large changes, but I'd appreciate help with testing if you're available. |
@zamzterz it would be great if you could give what's in the tip of master branch a try. When I attempted to upgrade I got mismatched issuer errors. |
The following line https://github.com/OpenIDC/pyoidc/blob/master/src/oic/oauth2/message.py#L322 will raise an indexing exception if a userinfo endpoint returns an attribute who's key, value is an empty list.
Example:
nicknames: []
I initially found this error in flask_pyoidc:
Trace:
Here is a version of the profile that threw the exception:
Here is an attempt I've made to do two things:
https://github.com/mozilla-iam/pyoidc/pull/1/files
Please let me know if you're interested in this PR and I'll open a pull to resolve this problem.
The text was updated successfully, but these errors were encountered: