Skip to content

Commit

Permalink
security: Add Vary header to 404 responses (PROJQUAY-7304) (quay#2938)
Browse files Browse the repository at this point in the history
Add `Vary: Origin` header to the 404 responses to instruct browsers (and other utilities) to cache various requests properly (based on their origin) in order to avoid cache poisoning. See the [W3C security details](https://www.w3.org/TR/2020/SPSD-cors-20200602/#resource-security) for more information.
  • Loading branch information
ibazulic authored Jun 11, 2024
1 parent ac5d3cb commit ac12b52
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions util/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def _abort(status_code, data_object, description, headers):
headers["Access-Control-Allow-Methods"] = options_resp.headers["allow"]
headers["Access-Control-Max-Age"] = str(21600)
headers["Access-Control-Allow-Headers"] = ["Authorization", "Content-Type"]
headers["Vary"] = "Origin"

resp = make_response(json.dumps(data_object), status_code, headers)

Expand Down

0 comments on commit ac12b52

Please sign in to comment.