mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-07-21 01:11:18 +00:00
refactor: rework scheme validation in oauth controller and frontend (#1026)
This commit is contained in:
@@ -331,8 +331,7 @@ func (controller *OAuthController) isRedirectSafe(redirectURI string) bool {
|
||||
|
||||
controller.log.App.Debug().Err(err).Msg("Failed to validate redirect URI")
|
||||
|
||||
if errors.Is(err, validators.ErrInvalidURL) ||
|
||||
errors.Is(err, validators.ErrPortMismatch) {
|
||||
if !errors.Is(err, validators.ErrHostnameMismatch) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -81,14 +81,6 @@ func TestOAuthController_isRedirectSafe(t *testing.T) {
|
||||
redirectURI: "https://sub.example.com",
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
description: "Different scheme returns false",
|
||||
appURL: "https://tinyauth.example.com",
|
||||
cookieDomain: "example.com",
|
||||
subdomainsEnabled: true,
|
||||
redirectURI: "http://tinyauth.example.com",
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
description: "Different port returns false",
|
||||
appURL: "https://tinyauth.example.com",
|
||||
|
||||
@@ -50,9 +50,7 @@ func (service *AccessControlsService) lookupStaticACLs(domain string) *model.App
|
||||
service.log.App.Debug().Str("name", app).Msg("Found matching container by domain")
|
||||
return &config
|
||||
}
|
||||
if !errors.Is(err, validators.ErrHostnameMismatch) &&
|
||||
!errors.Is(err, validators.ErrPortMismatch) &&
|
||||
!errors.Is(err, validators.ErrSchemeMismatch) {
|
||||
if !errors.Is(err, validators.ErrHostnameMismatch) {
|
||||
service.log.App.Debug().Str("name", app).Err(err).Msg("Domain validation failed")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user