test_safe_join_rejects_symlink_escape fails on Windows without elevation or Developer Mode
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 88/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- testing-qa
Línea de trabajo
Abre tests/shared/test_path_security.py e inspecciona test_safe_join_rejects_symlink_escape alrededor de la línea 145. Ejecuta uv run pytest tests/shared/test_path_security.py en una máquina Windows sin privilegios para crear symlinks y verifica después que la prueba solo se omita cuando se rechaza la creación del symlink y que la suite no tenga fallos cuando los symlinks estén disponibles.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Initial Checks
- I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1)
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Release line
2.x (current stable)
Description
Running the test suite on Windows as a normal, non-elevated user fails in
tests/shared/test_path_security.py:
tests\shared\test_path_security.py:145: in test_safe_join_rejects_symlink_escape
(sandbox / "escape").symlink_to(outside)
E OSError: [WinError 1314] A required privilege is not held by the client
The test creates a symlink unconditionally. Windows only permits symlink creation for an
elevated process, or for a normal user with Developer Mode enabled — neither is the
default state of a Windows machine.
Why CI doesn't catch it: the Windows job in .github/workflows/shared.yml is green, and
this test only passes when symlink_to() succeeds, so those runners evidently do have the
privilege. The failure appears only on an ordinary developer machine, so the suite is
permanently green in CI and permanently red locally.
Why it matters: it denies a Windows contributor a clean baseline. A first uv run pytest
returns a failure unrelated to their change, and the natural assumption — that their own
setup is broken — costs time. Everything else passes: 5791 passed, 1 failed, 16 skipped.
It also weakens the suite's signal, since someone who learns to expect one red test may
not notice a second.
Suggested fix — skip when the platform refuses, leaving every assertion intact so the
test still exercises safe_join wherever symlinks work, including all current CI:
try:
(sandbox / "escape").symlink_to(outside)
except OSError as exc:
pytest.skip(f"symlink creation is not permitted here: {exc}")
This is the only test in the suite that creates a symlink. I have this prepared and
verified locally (suite goes to 0 failures; the test skips for the right reason rather
than passing vacuously). Happy to open a PR — following CONTRIBUTING, I'll wait for the
issue to be assigned first.
Example Code
git clone https://github.com/modelcontextprotocol/python-sdk
cd python-sdk
uv sync
uv run pytest tests/shared/test_path_security.py
Python & MCP Python SDK
Python 3.14.7 | Windows-11-10.0.26200-SP0
mcp 2.0.1.dev23+56af447
mcp-types 2.0.1.dev23+56af447
pytest 8.4.2
- Lenguaje dominante
- Python
- Estrellas
- 24.3k
- Forks
- 4k
- Merge medio
- 1 d 19 min
- PR fusionados (30 d)
- 29
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/python-sdk
-
Streamable HTTP client logs a WARNING for valid 202 Accepted on session termination (DELETE) Abiertov1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
modelcontextprotocol/python-sdk#3546 · 5 comentarios ·
-
v1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
modelcontextprotocol/python-sdk#3545 · 1 comentario ·
-
v1 v2
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
modelcontextprotocol/python-sdk#3508 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
modelcontextprotocol/python-sdk#3504 ·
-
v1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
modelcontextprotocol/python-sdk#3492 · 1 comentario ·
Todos los issues de modelcontextprotocol/python-sdk
Issues similares
-
fix: inaccuracy ⚠️
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
uabrc/uabrc.github.io#1255 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
ethereum-optimism/factory#64 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
duckdb/duckdb-python#627 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Add link for tutorial Abiertodocumentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
Qiskit/qiskit-addon-sqd#376 ·