Skip to content

This PR introduces new audit checks for SAML configurations.#192

Open
FeSuert wants to merge 12 commits intoiteratec:mainfrom
FeSuert:main
Open

This PR introduces new audit checks for SAML configurations.#192
FeSuert wants to merge 12 commits intoiteratec:mainfrom
FeSuert:main

Conversation

@FeSuert
Copy link

@FeSuert FeSuert commented Jan 5, 2026

No description provided.

Copy link
Collaborator

@malexmave malexmave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long to review this. Here's some feedback on the pull request.

Overall: Very solid work. There are a few issues with the code style that we would like to see changed to make it consistent with the rest of the codebase and maintainable long term, see the inline comments below.

Also: after making the changes, please run the ruff formatter as described in the docs. Otherwise, the lint pipeline will fail (as it did for the current commit).

Comment on lines +71 to +79
## SamlIdpValidateSignatureCheck

This auditor warns about SAML Identity Providers configured with `Validate Signature` set to `false`.
When disabled, Keycloak accepts SAML responses without verifying the digital signature of the upstream Identity Provider.

This is a critical security risk.
Without signature verification, an attacker can forge a completely fabricated SAML response or inject a malicious assertion into a valid response (known as XML Signature Wrapping or XSW).
This effectively allows an attacker to log in as any user, including administrators, without a valid password.
We strongly recommend ensuring that `Validate Signature` is enabled for all SAML providers.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it:

  • SAML allows signing either the entire message or individual assertions (or nothing at all).
  • As long as critical assertions are signed, not signing the entire payload is not a critical problem.

Is that correct? If so, we may have to rethink how we structure these checks, as "no signatures at all" would be critical, while "only signature A" or "only signature B" would be less bad (but still a finding). Or am I misunderstanding something?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see that further down below, this question is partially answered. But still - do you think that it would be worth differentiating between "no signatures" and "some signatures" in more ways than we are currently doing with this implementation?

Comment on lines +19 to +23
for uri in uris:
# Check for trailing wildcard
if uri and uri.strip().endswith("*"):
return True
return False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For OIDC clients, the logic of how redirect URIs are assembled is non-trivial. We replicated it in the function get_resolved_redirect_uris. Unless you have reason to believe that SAML clients use a different logic, I would recommend using that function instead of the naive get_redirect_uris.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: replicate the auditor for wildcard without preceding slash for SAML clients as well.

if self.is_vulnerable(client):
# Re-fetch URIs for the report detail
uris = client.get_redirect_uris()
bad_uris = [u for u in uris if u.endswith("*")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Or consider changing the signature of the method to return a list of affected redirect URIs and check if the length of the list is larger than zero to see if the client is vulnerable.

@malexmave malexmave linked an issue Jan 19, 2026 that may be closed by this pull request
@FeSuert FeSuert requested a review from malexmave February 2, 2026 11:38
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
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.

Help Wanted: SAML Checks

3 participants