fix(sso): block protocol-relative URL redirect bypass by requiring non-empty netloc
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
This commit is contained in:
@@ -76,7 +76,8 @@ def sso_login(request: Request, db: Session = Depends(get_db)):
|
||||
except RuntimeError as exc:
|
||||
raise HTTPException(status_code=503, detail=str(exc))
|
||||
redirect_url = result["redirect_url"]
|
||||
if urlparse(redirect_url).scheme not in ("http", "https"):
|
||||
_parsed = urlparse(redirect_url.strip())
|
||||
if _parsed.scheme not in ("http", "https") or not _parsed.netloc:
|
||||
raise HTTPException(status_code=400, detail="Invalid IdP redirect URL")
|
||||
return RedirectResponse(url=redirect_url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user