Restore contained attended browser launch on WSL without xdg-utils
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a06ecb-456a-71c2-b41e-0755d336e883
This commit is contained in:
parent
d05c3000c5
commit
63b5d6d426
3 changed files with 61 additions and 0 deletions
15
tests/test_operator_browser.py
Normal file
15
tests/test_operator_browser.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import runpy
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
from urllib.parse import urlencode
|
||||
allowed=runpy.run_path(str(Path(__file__).resolve().parents[1]/'scripts/operator-browser/xdg-open'))['allowed']
|
||||
class BrowserBoundary(unittest.TestCase):
|
||||
def test_approved_flow(self):
|
||||
self.assertTrue(allowed('https://kc.coulomb.social/authorize?'+urlencode({'redirect_uri':'http://localhost:8250/oidc/callback','state':'test'})))
|
||||
def test_other_destination_rejected(self):
|
||||
for host in ['evil.example','kc.coulomb.social.evil.example','user@kc.coulomb.social']:
|
||||
self.assertFalse(allowed('https://'+host+'/?'+urlencode({'redirect_uri':'http://localhost:8250/oidc/callback'})))
|
||||
def test_unapproved_callback_rejected(self):
|
||||
self.assertFalse(allowed('https://kc.coulomb.social/?'+urlencode({'redirect_uri':'https://evil.example'})))
|
||||
def test_duplicate_callback_rejected(self):
|
||||
self.assertFalse(allowed('https://kc.coulomb.social/?redirect_uri=http://localhost:8250/oidc/callback&redirect_uri=https://evil.example'))
|
||||
Loading…
Add table
Add a link
Reference in a new issue