From e362e6fe2f571cd0587482454b16783a67b2e7b9 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 8 Feb 2026 07:22:08 -0600 Subject: [PATCH] Fix multiple_dots test for Windows path resolution On Windows, ....//secrets.yaml escapes the base directory (403), while on Unix it stays inside (404). Use sys.platform to set the expected status code per platform. --- tests/dashboard/test_web_server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/dashboard/test_web_server.py b/tests/dashboard/test_web_server.py index 4b06bfd7c6..d216652162 100644 --- a/tests/dashboard/test_web_server.py +++ b/tests/dashboard/test_web_server.py @@ -8,6 +8,7 @@ import gzip import json import os from pathlib import Path +import sys from unittest.mock import AsyncMock, MagicMock, Mock, patch import pytest @@ -535,7 +536,11 @@ async def test_download_binary_handler_subdirectory_file_url_encoded( pytest.param("zephyr/../../../secrets.yaml", 403, id="traversal_with_prefix"), pytest.param("/etc/passwd", 403, id="absolute_path"), pytest.param("//etc/passwd", 403, id="double_slash_absolute"), - pytest.param("....//secrets.yaml", 404, id="multiple_dots"), + pytest.param( + "....//secrets.yaml", + 403 if sys.platform == "win32" else 404, + id="multiple_dots", + ), ], ) async def test_download_binary_handler_path_traversal_protection(