nscendoni commented on code in PR #38:
URL: 
https://github.com/apache/sling-org-apache-sling-auth-oauth-client/pull/38#discussion_r2567686262


##########
src/main/java/org/apache/sling/auth/oauth_client/impl/RedirectHelper.java:
##########
@@ -144,4 +145,16 @@ private static boolean isDescendantOrEqual(String path, 
String descendant) {
             return descendant.startsWith(pattern);
         }
     }
+
+    public static void validateRedirect(String redirect) throws 
OAuthEntryPointException {
+        // Validate that it is not a cross-site redirect
+        if (redirect == null || redirect.isEmpty()) {
+            return;
+        }
+        if (!redirect.startsWith("/")) {
+            String message = "Invalid redirect URL: " + redirect;
+            // Relative redirect within the same domain is allowed
+            throw new OAuthEntryPointException(message, new 
IllegalArgumentException(message));

Review Comment:
   I did a small refactoring on exception handling in OidcAuthenticationHandler.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to