diff --git a/edge/server-config-yml.go b/edge/server-config-yml.go index f89f60ef..54ad6273 100644 --- a/edge/server-config-yml.go +++ b/edge/server-config-yml.go @@ -423,9 +423,10 @@ func ymlToKeyStore(y *yml) (KeyStore, error) { return nil, errors.New("edge: invalid vault keystore: invalid kubernetes config: no JWT specified") } - // We check whether the JWT looks like a JWT (
..). If not, we assume it's - // a path to a file containing the JWT and try to read the JWT from that file. - if s := strings.Split(y.KeyStore.Vault.Kubernetes.JWT.Value, "."); len(s) != 3 && strings.Contains(y.KeyStore.Vault.Kubernetes.JWT.Value, "/") { + // If the passed JWT value contains a path separator we assume it's a file. + // We always check for '/' and the OS-specific one make cover cases where + // a path is specified using '/' but the underlying OS is e.g. windows. + if jwt := y.KeyStore.Vault.Kubernetes.JWT.Value; strings.ContainsRune(jwt, '/') || strings.ContainsRune(jwt, os.PathSeparator) { b, err := os.ReadFile(y.KeyStore.Vault.Kubernetes.JWT.Value) if err != nil { return nil, fmt.Errorf("edge: failed to read vault kubernetes JWT from '%s': %v", y.KeyStore.Vault.Kubernetes.JWT.Value, err)