mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
address greptile review feedback (greploop iteration 3)
- Add open redirect protection: validate returnUrl, reject absolute URLs - Exclude _next from find traversal in Dockerfile (prune build artifacts) Made-with: Cursor
This commit is contained in:
parent
41421e62fd
commit
92187089a3
2 changed files with 6 additions and 1 deletions
|
|
@ -53,7 +53,7 @@ RUN mkdir -p /var/lib/litellm/ui && \
|
|||
mkdir -p /var/lib/litellm/assets && \
|
||||
cp /app/litellm/proxy/logo.jpg /var/lib/litellm/assets/logo.jpg && \
|
||||
( cd /var/lib/litellm/ui && \
|
||||
find . -name "*.html" ! -name "index.html" | while IFS= read -r html_file; do \
|
||||
find . -path './_next' -prune -o -name "*.html" ! -name "index.html" -print | while IFS= read -r html_file; do \
|
||||
folder_name="${html_file%.html}" && \
|
||||
mkdir -p "$folder_name" && \
|
||||
mv "$html_file" "$folder_name/index.html"; \
|
||||
|
|
|
|||
|
|
@ -507,6 +507,11 @@ def _build_mcp_oauth_callback_html(code: Optional[str], state: Optional[str]) ->
|
|||
window.localStorage.getItem(RETURN_URL_KEY);
|
||||
}} catch (e) {{}}
|
||||
|
||||
// Validate returnUrl: reject absolute URLs (open redirect protection)
|
||||
if (returnUrl && (returnUrl.startsWith('//') || /^[a-zA-Z][a-zA-Z0-9+\-.]*:/.test(returnUrl))) {{
|
||||
returnUrl = null;
|
||||
}}
|
||||
|
||||
if (!returnUrl) {{
|
||||
var path = window.location.pathname || "";
|
||||
var uiIndex = path.indexOf("/ui");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue