Accept matching HTTPS origins through trusted Deck GUI proxy
This commit is contained in:
1 parent
0966abf1b5
commit
4072cfd46c
3 files changed
+24
-1
No files matched your search
@@ -568,7 +568,13 @@ class Handler(BaseHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
origin = self.headers.get('Origin')
|
||||
bearer = self.token_route() and self.api_token_authenticated()
|
||||
if not self.valid_host() or (origin and origin != 'http://' + self.headers.get('Host', '')) or (not bearer and self.headers.get('X-Athena-Deck') != '1'):
|
||||
# The authenticated native GUI proxy validates Host before forwarding.
|
||||
# TLS may terminate at an upstream reverse proxy; never trust arbitrary
|
||||
# X-Forwarded-Proto headers to decide which browser origins are allowed.
|
||||
origins = {'http://' + self.headers.get('Host', '')}
|
||||
if self.ingress() in ('lan', 'tunnel'):
|
||||
origins.add('https://' + self.headers.get('Host', ''))
|
||||
if not self.valid_host() or (origin and origin not in origins) or (not bearer and self.headers.get('X-Athena-Deck') != '1'):
|
||||
return self.respond({'error':'Same-origin control required'},403)
|
||||
if self.path == '/api/v1/auth/setup':
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user