Skip to content

Commit 6f2f101

Browse files
committed
Remove request origin checks
1 parent ba05bb3 commit 6f2f101

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

openlibrary/plugins/upstream/account.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,10 +1178,6 @@ def POST(self):
11781178
i = web.input(test='false')
11791179
test = i.test == "true"
11801180

1181-
# Validate request origin
1182-
if not self._validate_headers():
1183-
raise web.HTTPError("403 Forbidden", {"Content-Type": "application/json"})
1184-
11851181
# Get S3 keys from request header
11861182
try:
11871183
s3_access, s3_secret = self._parse_auth_header()
@@ -1208,15 +1204,6 @@ def POST(self):
12081204
"200 OK", {"Content-Type": "application/json"}, data=json.dumps(result)
12091205
)
12101206

1211-
def _validate_headers(self):
1212-
origin = web.ctx.env.get('HTTP_ORIGIN') or web.ctx.env.get('HTTP_REFERER')
1213-
if not origin:
1214-
return False
1215-
1216-
parsed_origin = urlparse(origin)
1217-
host = parsed_origin.hostname
1218-
return host == "archive.org" or host.endswith(".archive.org")
1219-
12201207
def _parse_auth_header(self):
12211208
header_value = web.ctx.env.get("HTTP_AUTHORIZATION", "")
12221209
try:

0 commit comments

Comments
 (0)