fix(cli): make Desktop attachment checks portable
Avoid a false-positive session-prefix match in the architecture guard without changing endpoint validation. Pass a null pointer as an integer to the native Windows pipe fixture, and name oversized-input cases explicitly so pytest does not exceed the Windows environment-variable limit. Keep the real owner-authenticated roundtrip and oversized-payload assertions. Local CLI, architecture and gateway checks pass; native Windows verification is rerun in CI.
This commit is contained in:
1 parent
d641026fc8
commit
ddf095938e
3 files changed
+11
-7
No files matched your search
@@ -133,7 +133,7 @@ def test_native_windows_pipe_roundtrip():
|
||||
rf"\\.\pipe\{address}",
|
||||
winapi.PIPE_ACCESS_DUPLEX | winapi.FILE_FLAG_OVERLAPPED,
|
||||
0, # PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT
|
||||
1, 8192, 8192, 1000, None,
|
||||
1, 8192, 8192, 1000, 0,
|
||||
)
|
||||
connected = winapi.ConnectNamedPipe(handle, overlapped=True)
|
||||
received = []
|
||||
|
||||
@@ -68,7 +68,8 @@ def test_windows_uses_pipe_not_argv_or_browser_override(launcher, capsys, url):
|
||||
@pytest.mark.parametrize("url", [
|
||||
"javascript:alert(1)", "file:///tmp/secret", "http:///", "http://[invalid/",
|
||||
"http://localhost/\nsecret", "http://localhost/\rsecret", "http://localhost/\x00",
|
||||
"http://localhost/\ud800", "http://localhost/" + "x" * browser._MAX_URL_BYTES,
|
||||
"http://localhost/\ud800",
|
||||
pytest.param("http://localhost/" + "x" * browser._MAX_URL_BYTES, id="oversized-url"),
|
||||
])
|
||||
def test_invalid_input_does_not_spawn_a_helper(launcher, url, capsys):
|
||||
_, spawn = launcher
|
||||
@@ -205,7 +206,10 @@ def test_helper_owns_file_until_expiry_and_cleans_every_exit(helper_file, monkey
|
||||
assert ("retained" in events) == (failure in {None, "interrupted"})
|
||||
|
||||
|
||||
@pytest.mark.parametrize("data", [b"", b"http://localhost/", b"x" * 65537 + b"\n"])
|
||||
@pytest.mark.parametrize("data", [
|
||||
b"", b"http://localhost/",
|
||||
pytest.param(b"x" * 65537 + b"\n", id="oversized-message"),
|
||||
])
|
||||
def test_helper_rejects_incomplete_or_oversized_pipe_message(helper_file, data):
|
||||
assert browser._serve(io.BytesIO(data), io.BytesIO()) == 1
|
||||
assert helper_file == []
|
||||
|
||||
Reference in new issue
Block a user