You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Secure by default: CSP "frame-ancestors" during prompt=none (iframe silent login)
#42587
Keycloak should automatically decide which origins to allow as frame-ancestors in Content-Security-Policy (CSP) header based on the client performing a prompt=none (silent) login in a hidden iframe (from a different origin).
Currently have to manually configure the realm's security headers:
manually allow all ancestors by removing frame-ancestors (bad) or,
manually keep realm-level header configuration up to speed with client origins (error-prone, origins can be plentiful, requires manage-realm permissions).
Motivation
Secure by default: no configuration required to ensure that security headers are as restricive as possible.
Findings like these come up all the time in pen tests.
Description
Keycloak knows which client is requesting the login via the client_id parameter, so Keycloak should be able to respond with an appropriate frame-ancestor value:
Client requests silent login in an iframe: GET https://keycloak/realms/foo/protocol/openid-connect/auth?client_id=my_client&prompt=none&...
Keycloak responds with frame-ancestor directive containing origins from client's "web origins" setting:
Respects "+" value that implies origins of redirect URIs
Respects "*" value that should simply remove frame-ancestors directive
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Description
Keycloak should automatically decide which origins to allow as
frame-ancestorsinContent-Security-Policy(CSP) header based on the client performing aprompt=none(silent) login in a hidden iframe (from a different origin).Currently have to manually configure the realm's security headers:
frame-ancestors(bad) or,manage-realmpermissions).Motivation
Secure by default: no configuration required to ensure that security headers are as restricive as possible.
Findings like these come up all the time in pen tests.
Description
Keycloak knows which client is requesting the login via the
client_idparameter, so Keycloak should be able to respond with an appropriateframe-ancestorvalue:GET https://keycloak/realms/foo/protocol/openid-connect/auth?client_id=my_client&prompt=none&...frame-ancestordirective containing origins from client's "web origins" setting:frame-ancestorsdirectiveBy the way, Keycloak automatically handles front-channel logout
frame-srcCSP directive by adding all origins of the current client's front-channel logout urls. So this is not a new concept.Let me hear your thoughts.
All reactions