Skip to content

Commit

Permalink
fix: flask changed from APP_ALLOWED_HOSTS to TRUSTED_HOSTS
Browse files Browse the repository at this point in the history
  • Loading branch information
wgresshoff authored Feb 24, 2025
1 parent 9ce258b commit 12b3147
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion invenio_rest/csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def csrf_validate():
return _abort400(REASON_INSECURE_REFERER)

is_hostname_allowed = referer.hostname in current_app.config.get(
"APP_ALLOWED_HOSTS"
"TRUSTED_HOSTS"
)
if not is_hostname_allowed:
reason = REASON_BAD_REFERER % referer.geturl()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def test_csrf_bad_referer(csrf_app, csrf):

cookie = client.get_cookie(CSRF_COOKIE_NAME)

csrf_app.config["APP_ALLOWED_HOSTS"] = ["allowed-referer"]
csrf_app.config["TRUSTED_HOSTS"] = ["allowed-referer"]
not_allowed_referer = "https://not-allowed-referer"
res = client.post(
"/csrf-protected",
Expand Down

0 comments on commit 12b3147

Please sign in to comment.