Skip to content

Commit

Permalink
fix: Getting branding assets from Eclipse Che Dashboard should not re…
Browse files Browse the repository at this point in the history
…quire authentiction (#1708)

Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha authored Jun 15, 2023
1 parent 4b5a62a commit 94934bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/deploy/gateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestOauthProxyConfigUnauthorizedPaths(t *testing.T) {

configmap := getGatewayOauthProxyConfigSpec(ctx, "blabol")
config := configmap.Data["oauth-proxy.cfg"]
if !strings.Contains(config, "skip_auth_regex = \"^/$|/healthz$|^/dashboard/static/preload\"") {
if !strings.Contains(config, "skip_auth_regex = \"^/$|/healthz$|^/dashboard/static/preload|^/dashboard/assets/branding/loader.svg$\"") {
t.Errorf("oauth config shold not contain any skip auth when both registries are external")
}
})
Expand All @@ -183,7 +183,7 @@ func TestOauthProxyConfigUnauthorizedPaths(t *testing.T) {

configmap := getGatewayOauthProxyConfigSpec(ctx, "blabol")
config := configmap.Data["oauth-proxy.cfg"]
if !strings.Contains(config, "skip_auth_regex = \"^/devfile-registry|^/$|/healthz$|^/dashboard/static/preload\"") {
if !strings.Contains(config, "skip_auth_regex = \"^/devfile-registry|^/$|/healthz$|^/dashboard/static/preload|^/dashboard/assets/branding/loader.svg$\"") {
t.Error("oauth config should skip auth for devfile registry", config)
}
})
Expand All @@ -204,7 +204,7 @@ func TestOauthProxyConfigUnauthorizedPaths(t *testing.T) {

configmap := getGatewayOauthProxyConfigSpec(ctx, "blabol")
config := configmap.Data["oauth-proxy.cfg"]
if !strings.Contains(config, "skip_auth_regex = \"^/plugin-registry|^/$|/healthz$|^/dashboard/static/preload\"") {
if !strings.Contains(config, "skip_auth_regex = \"^/plugin-registry|^/$|/healthz$|^/dashboard/static/preload|^/dashboard/assets/branding/loader.svg$\"") {
t.Error("oauth config should skip auth for plugin registry", config)
}
})
Expand All @@ -225,7 +225,7 @@ func TestOauthProxyConfigUnauthorizedPaths(t *testing.T) {

configmap := getGatewayOauthProxyConfigSpec(ctx, "blabol")
config := configmap.Data["oauth-proxy.cfg"]
if !strings.Contains(config, "skip_auth_regex = \"^/plugin-registry|^/devfile-registry|^/$|/healthz$|^/dashboard/static/preload\"") {
if !strings.Contains(config, "skip_auth_regex = \"^/plugin-registry|^/devfile-registry|^/$|/healthz$|^/dashboard/static/preload|^/dashboard/assets/branding/loader.svg$\"") {
t.Error("oauth config should skip auth for plugin and devfile registry.", config)
}
})
Expand Down
1 change: 1 addition & 0 deletions pkg/deploy/gateway/oauth_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func skipAuthConfig(instance *chev2.CheCluster) string {
skipAuthPaths = append(skipAuthPaths, "^/$")
skipAuthPaths = append(skipAuthPaths, "/healthz$")
skipAuthPaths = append(skipAuthPaths, "^/dashboard/static/preload")
skipAuthPaths = append(skipAuthPaths, fmt.Sprintf("^%s$", defaults.GetConsoleLinkImage()))
if len(skipAuthPaths) > 0 {
propName := "skip_auth_routes"
if infrastructure.IsOpenShift() {
Expand Down

0 comments on commit 94934bf

Please sign in to comment.