Skip to content

Commit 3c51ee7

Browse files
sasha-gitgcopybara-github
authored andcommitted
fix: fix SSRF vulnerability in load_web_page by disabling automatic redirects
Co-authored-by: Sasha Sobran <asobran@google.com> PiperOrigin-RevId: 853901476
1 parent f1ccc0c commit 3c51ee7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/google/adk/tools/load_web_page.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def load_web_page(url: str) -> str:
2828
"""
2929
from bs4 import BeautifulSoup
3030

31-
response = requests.get(url)
31+
# Set allow_redirects=False to prevent SSRF attacks via redirection.
32+
response = requests.get(url, allow_redirects=False)
3233

3334
if response.status_code == 200:
3435
soup = BeautifulSoup(response.content, 'lxml')

0 commit comments

Comments
 (0)