{"record":{"id":"195894256091760c","repo":"goharbor/harbor","slug":"cannot-redirect-to-other-site","errorCode":null,"errorMessage":"cannot redirect to other site","messagePattern":"cannot redirect to other site","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"src/core/controllers/oidc.go","lineNumber":84,"sourceCode":"\n// RedirectLogin redirect user's browser to OIDC provider's login page\nfunc (oc *OIDCController) RedirectLogin() {\n\tstate := utils.GenerateRandomString()\n\tpkceCode, err := pkce.Generate()\n\tif err != nil {\n\t\tlog.Errorf(\"failed to generate PKCE code, error: %v\", err)\n\t\toc.SendInternalServerError(err)\n\t\treturn\n\t}\n\turl, err := oidc.AuthCodeURL(oc.Context(), state, pkceCode)\n\tif err != nil {\n\t\toc.SendInternalServerError(err)\n\t\treturn\n\t}\n\tredirectURL := oc.Ctx.Request.URL.Query().Get(\"redirect_url\")\n\tif !utils.IsLocalPath(redirectURL) {\n\t\tlog.Errorf(\"invalid redirect url: %v\", redirectURL)\n\t\toc.SendBadRequestError(fmt.Errorf(\"cannot redirect to other site\"))\n\t\treturn\n\t}\n\tif err := oc.SetSession(redirectURLKey, redirectURL); err != nil {\n\t\tlog.Errorf(\"failed to set session for key: %s, error: %v\", redirectURLKey, err)\n\t\toc.SendInternalServerError(err)\n\t\treturn\n\t}\n\tif err := oc.SetSession(pkceCodeKey, string(pkceCode)); err != nil {\n\t\tlog.Errorf(\"failed to set session for key: %s, error: %v\", pkceCodeKey, err)\n\t\toc.SendInternalServerError(err)\n\t\treturn\n\t}\n\tif err := oc.SetSession(stateKey, state); err != nil {\n\t\tlog.Errorf(\"failed to set session for key: %s, error: %v\", stateKey, err)\n\t\toc.SendInternalServerError(err)\n\t\treturn\n\t}\n\tlog.Debugf(\"State dumped to session: %s\", state)","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/core/controllers/oidc.go#L66-L102","documentation":"Error \"cannot redirect to other site\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/core/controllers/oidc.go:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}