Skip to content

Commit 76b75f3

Browse files
Fix some issue with insecure browsers. (#13261)
If you are on a recent chromium or chrome based browser this doesn't affect you. This is to give time for the lazy firefox devs to implement PNA.
1 parent 0c63b4f commit 76b75f3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ def is_loopback(host):
146146
def create_origin_only_middleware():
147147
@web.middleware
148148
async def origin_only_middleware(request: web.Request, handler):
149+
if 'Sec-Fetch-Site' in request.headers:
150+
sec_fetch_site = request.headers['Sec-Fetch-Site']
151+
if sec_fetch_site == 'cross-site':
152+
return web.Response(status=403)
149153
#this code is used to prevent the case where a random website can queue comfy workflows by making a POST to 127.0.0.1 which browsers don't prevent for some dumb reason.
150154
#in that case the Host and Origin hostnames won't match
151155
#I know the proper fix would be to add a cookie but this should take care of the problem in the meantime

0 commit comments

Comments
 (0)