-
Notifications
You must be signed in to change notification settings - Fork 39
Do not crash when entity-selection-profile attribute has invalid JSON #286
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1047,14 +1047,25 @@ def discojson_sp_attr(e): | |
| if b64_trustinfos is None: | ||
| return None | ||
|
|
||
| entityID = e.get('entityID', None) | ||
| if entityID is None: | ||
| return None | ||
|
|
||
| sp = {} | ||
| sp['entityID'] = e.get('entityID', None) | ||
| sp['entityID'] = entityID | ||
| sp['profiles'] = {} | ||
|
|
||
| for b64_trustinfo in b64_trustinfos: | ||
| str_trustinfo = b64decode(b64_trustinfo.encode('ascii')) | ||
| trustinfo = json.loads(str_trustinfo.decode('utf8')) | ||
| sp['profiles'].update(trustinfo['profiles']) | ||
| try: | ||
| str_trustinfo = b64decode(b64_trustinfo.encode('ascii')) | ||
| trustinfo = json.loads(str_trustinfo.decode('utf8')) | ||
| sp['profiles'].update(trustinfo['profiles']) | ||
|
||
|
|
||
| except Exception as e: | ||
| log.warning(f"Invalid entity-selection-profile attribute for {entityID}: {e}") | ||
|
|
||
| if not sp['profiles']: | ||
| return None | ||
|
|
||
| return sp | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would an entry have no entityID?
Isn't this check part of a validation step already, while ingesting input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you are right, I'll remove that