Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

git server: git_log accepts a non-positive max_count and a negative value silently returns the entire history

Abierto
#5,214 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
git, python
Área
backend, testing

Línea de trabajo

Start with the git_log argument model and tool schema in src/git, then read the protocol tests in src/git/tests/test_protocol.py. Reproduce the -1 and 0 cases with the in-memory test client, and check that 1 returns one commit. Done when non-positive values produce tool errors and the schema advertises a minimum of 1; the issue reports a prototype and verification, so check whether that work has moved elsewhere before starting.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug server-git v2

{
"title": "git server: git_log accepts a non-positive max_count and a negative value silently returns the entire history",
"body": "### Which server?\n\ngit (mcp-server-git)\n\n### Server version\n\n2026.10.19 (from a clone of this repository at v2/main, commit f18beb74)\n\n### How did you run the server?\n\nFrom a clone of this repository\n\n### Transport\n\nstdio\n\n### Protocol era\n\nLegacy (2025-11-25 or earlier)\n\n### MCP client and version\n\nThe in-memory test client from the mcp SDK used by this repository's own src/git/tests/test_protocol.py (no external client)\n\n### Operating system and runtime\n\nWindows 11, Python 3.13\n\n### Server configuration\n\nBuilt-in test harness from src/git/tests/test_protocol.py, pointing at a temporary git repository.\n\n### Steps to reproduce\n\n1. Start the server against a temporary repository that has 6 commits.\n2. Call the git_log tool with {\"repo_path\": \"<tmp>\", \"max_count\": -1}.\n3. Call it again with {\"repo_path\": \"<tmp>\", \"max_count\": 0}.\n\n### Expected behavior\n\nmax_count is documented as "Maximum number of commits to show", so a value that cannot be a maximum — 0 or negative — should be rejected by the tool's input validation, or at least clamped to something meaningful. Git itself treats any negative -n as "no limit".\n\n### Actual behavior\n\n- max_count: -1 returns all 6 commits with isError: false — the whole history, while reporting success. The parameter is silently ignored, and the effect is the opposite of what the name says.\n- max_count: 0 returns an empty list, also with isError: false.\n- The advertised input schema is {\"default\": 10, \"type\": \"integer\"} with no minimum, so a client cannot know the bound either.\n\nThe value reaches git log -n <value> through GitPython, which is why Git's own interpretation of a negative limit applies.\n\n### Logs or error output\n\n\nmax_count=-1 -> isError=False, commits returned=6 (all of them)\nmax_count=0 -> isError=False, commits returned=0\n\n\n### Already prototyped a fix?\n\nYes — the change is small and I verified it locally, but per CONTRIBUTING.md I am reporting it instead of opening a pull request.\n\nPrompt used (this is the prompt that produced the local change):\n\n> In the src/git Python server of this repository, git_log's max_count parameter has no lower bound. Add Pydantic validation so max_count must be at least 1, with a message that explains the bound, and add the bound to the tool's advertised JSON schema. Add protocol tests that call git_log with -1, 0 and 1 over the in-memory client session and assert that the non-positive values come back as tool errors while 1 returns exactly one commit.\n\nBehavior before and after: before, -1 returned every commit and 0 returned nothing, both as successful results; after, both are rejected by input validation (isError: true, 1 validation error for logArguments) and the schema carries \"minimum\": 1. A valid max_count is unaffected.\n\nHow it was verified: uv run --frozen pytest -q in src/git (189 passed, 3 pre-existing Windows symlink-privilege failures that also fail at the base commit), ruff check, ruff format --check and pyright clean, and the per-file coverage gate (npm run coverage:py -- git) at 100% lines and branches. Red/green was captured by stashing only the source change: 6 failed before, 9 passed after.\n"
}

Lenguaje dominante
TypeScript
Estrellas
91.6k
Forks
11.9k
Merge medio
4 h 38 min
PR fusionados (30 d)
241

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de modelcontextprotocol/servers

Todos los issues de modelcontextprotocol/servers

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.