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

Add an option to use query string for validation #256

Merged

Conversation

eltoder
Copy link
Contributor

@eltoder eltoder commented Mar 27, 2021

When validating request or response signature in process_slo() we
currently rebuild query string from 'get_data' elements. This requires
URL encoding components of the string. Unfortunately, some IdPs (Azure
AD, ADFS) use lower-case encoding. To handle this, one needs to pass
lowercase_urlencoding=True. This complicates code that needs to support
different IdPs.

Instead, if 'query_string' is passed, take parts from it directly. This
avoids the need to URL encode them. This is similar to the
retrieveParametersFromServer argument in the PHP version.

@eltoder eltoder force-pushed the feature/validate-signature-query-string branch from 4e6a8e8 to d32d525 Compare March 28, 2021 17:18
@eltoder eltoder changed the title Add an option to use query string as is for validation Add an option to use query string for validation Mar 28, 2021
@pitbulk
Copy link
Contributor

pitbulk commented Apr 30, 2021

Can we add a new flag 'validate_signature_from_qs' by default to False to keep backward compatibility and in case of enabling it
run your new code?

@eltoder eltoder force-pushed the feature/validate-signature-query-string branch from d32d525 to 19e9d32 Compare May 2, 2021 15:39
@eltoder
Copy link
Contributor Author

eltoder commented May 2, 2021

@pitbulk Added the flag, though note that you can get the old behavior simply by not passing query_string. AFAICT there's no reason to pass query_string for SLO requests otherwise.

@pitbulk
Copy link
Contributor

pitbulk commented May 10, 2021

Can you document this new behavior on the Readme?
https://github.com/onelogin/python3-saml#the-request

When validating request or response signature in process_slo() we
currently rebuild query string from 'get_data' elements. This requires
URL encoding components of the string. Unfortunately, some IdPs (Azure
AD, ADFS) use lower-case encoding. To handle this, one needs to pass
lowercase_urlencoding=True. This complicates code that needs to support
different IdPs.

Instead, if 'query_string' is passed, take parts from it directly. This
avoids the need to URL encode them. This is similar to the
`retrieveParametersFromServer` argument in the PHP version.

This feature is disabled by default. Pass validate_signature_from_qs=True
to enable it.
@eltoder eltoder force-pushed the feature/validate-signature-query-string branch from 19e9d32 to 293bcde Compare May 10, 2021 22:53
@eltoder
Copy link
Contributor Author

eltoder commented May 10, 2021

@pitbulk done

@pitbulk pitbulk merged commit 201ea4b into SAML-Toolkits:master May 14, 2021
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

Successfully merging this pull request may close these issues.

2 participants