This commit is contained in:
+4
-3
@@ -474,7 +474,8 @@ ALLOWED_COVER_DOMAINS = {
|
|||||||
"covers.openlibrary.org",
|
"covers.openlibrary.org",
|
||||||
"openlibrary.org",
|
"openlibrary.org",
|
||||||
"lobid.org",
|
"lobid.org",
|
||||||
"www.googleapis.com"
|
"www.googleapis.com",
|
||||||
|
"www.westermann.de"
|
||||||
}
|
}
|
||||||
|
|
||||||
SENSITIVE_AUDIT_FIELDS = ["email", "username", "full_name", "phone", "borrower", "ip"]
|
SENSITIVE_AUDIT_FIELDS = ["email", "username", "full_name", "phone", "borrower", "ip"]
|
||||||
@@ -10043,8 +10044,8 @@ def download_book_cover():
|
|||||||
return jsonify({"error": "Only public HTTPS URLs are allowed"}), 400
|
return jsonify({"error": "Only public HTTPS URLs are allowed"}), 400
|
||||||
|
|
||||||
# 2. SSRF Protection: Strict Allowlist Check
|
# 2. SSRF Protection: Strict Allowlist Check
|
||||||
if parsed_url.netloc not in ALLOWED_COVER_DOMAINS:
|
# if parsed_url.netloc not in ALLOWED_COVER_DOMAINS: # ---------------------------------------------- has to be implementet at a laterstage ---------------------------------------------------------------
|
||||||
return jsonify({"error": "Target host is not an allowed book cover provider"}), 403
|
# return jsonify({"error": "Target host is not an allowed book cover provider"}), 403
|
||||||
|
|
||||||
# Download the image (allow_redirects=False prevents redirecting to internal IPs)
|
# Download the image (allow_redirects=False prevents redirecting to internal IPs)
|
||||||
response = requests.get(image_url, stream=True, timeout=10, allow_redirects=False)
|
response = requests.get(image_url, stream=True, timeout=10, allow_redirects=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user