Skip to content

Commit

Permalink
Perform CORS validation when the request has a cookie (#8743)
Browse files Browse the repository at this point in the history
* Perform CORS validation when the request has a cookie

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
abidlabs and gradio-pr-bot committed Jul 11, 2024
1 parent a9307c6 commit ee497d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-wings-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": minor
---

feat:Perform CORS validation when the request has a cookie
3 changes: 1 addition & 2 deletions gradio/route_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,8 @@ async def _send(
message.setdefault("headers", [])
headers = MutableHeaders(scope=message)
headers.update(self.simple_headers)
has_cookie = "cookie" in request_headers
origin = request_headers["Origin"]
if has_cookie or self.is_valid_origin(request_headers):
if self.is_valid_origin(request_headers):
self.allow_explicit_origin(headers, origin)
await send(message)

Expand Down

0 comments on commit ee497d5

Please sign in to comment.