Skip to content

fix crash when user ID attribute is missing from reply - #484

Open
guillomovitch wants to merge 1 commit into
IdentityPython:masterfrom
Renater:hotfix/fix-missing-id-attrs
Open

fix crash when user ID attribute is missing from reply#484
guillomovitch wants to merge 1 commit into
IdentityPython:masterfrom
Renater:hotfix/fix-missing-id-attrs

Conversation

@guillomovitch

@guillomovitchguillomovitch commented Jan 21, 2025

Copy link
Copy Markdown

If one of the attributes mentionned in user_id_from_attrs is missing from the IdP answer, SATOSA will crash with the following exception (missing attribute is called sub in this specific case):

[2025-01-10 10:16:08,259] [ERROR] [satosa.proxy_server.__call__] Unknown error
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/satosa/base.py", line 268, in run
resp = self._run_bound_endpoint(context, spec)
File "/usr/local/lib/python3.9/site-packages/satosa/base.py", line 193, in _run_bound_endpoint
return spec(context)
File "/usr/local/lib/python3.9/site-packages/satosa/backends/saml2.py", line 482, in authn_response
return self.auth_callback_func(context, self._translate_response(authn_response, context.state))
File "/usr/local/lib/python3.9/site-packages/satosa/base.py", line 154, in _auth_resp_callback_func
subject_id = ""
File "/usr/local/lib/python3.9/site-packages/satosa/base.py", line 155, in <listcomp>
for attr in self.config["INTERNAL_ATTRIBUTES"]["user_id_from_attrs"]:
KeyError: 'sub'

This PR fixes this issue by ensuring missing attributes are skipped.

@guillomovitch
guillomovitchforce-pushed the hotfix/fix-missing-id-attrs branch 2 times, most recently from 5a599c2 to f5cf5ecCompareJanuary 22, 2025 10:38
@guillomovitch

Copy link
Copy Markdown
Author

Hello. May I have any kind of feedback about this PR, wich seems to be relatively trivial ?

@guillomovitch
guillomovitchforce-pushed the hotfix/fix-missing-id-attrs branch from f5cf5ec to 2cced4bCompareAugust 14, 2025 13:38
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@guillomovitch