Skip to content

Commit 15ef5df

Browse files
jonkoopsjviding
authored andcommitted
Prevent open redirect when checking SSO
Co-authored-by: Jasu Viding <[email protected]>
1 parent e4bd6b7 commit 15ef5df

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

middleware/check-sso.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ module.exports = function (keycloak) {
6161
delete urlParts.query.auth_callback
6262
delete urlParts.query.state
6363

64-
const cleanUrl = URL.format(urlParts)
64+
// Collapse leading slashes to a single slash to prevent open redirects
65+
const cleanUrl = URL.format(urlParts).replace(/^\/+/, '/')
6566

6667
// Check SSO process is completed
6768
request.session.auth_is_check_sso_complete = true

0 commit comments

Comments
 (0)