mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-27 01:22:18 +00:00
fix(ui): validate pathname before assigning to window.location.href in handleError
Guard against non-root-relative paths to prevent DOM-based XSS via tainted window.location data flowing into the href sink. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dfe4bf6cef
commit
dcf3717b63
1 changed files with 4 additions and 1 deletions
|
|
@ -353,7 +353,10 @@ export const handleError = async (errorData: string | any) => {
|
|||
clearTokenCookies();
|
||||
const browserLocation = getWindowLocation();
|
||||
if (browserLocation) {
|
||||
window.location.href = browserLocation.pathname;
|
||||
const pathname = browserLocation.pathname;
|
||||
if (pathname.startsWith("/")) {
|
||||
window.location.href = pathname;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastErrorTime = currentTime;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue