Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 10 additions & 31 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,14 @@
# `severity: CRITICAL` (ci.yml), so fixable HIGH/MEDIUM OS CVEs are never
# surfaced by that gate at all. Re-review each entry when the pinned base-image
# digest in the Dockerfile changes: the base is pinned by digest, so the tag
# string (python:3.14-slim-trixie) does NOT move when the scanned bytes — and
# the perl version in them — do. Nothing in CI or tests enforces this review.
# string (python:3.15-slim-trixie) does NOT move when the scanned bytes do.
# Nothing in CI or tests enforces this review.
#
# Last reviewed 2026-09-06, on the base-image bump to
# python:3.14-slim-trixie@sha256:cad9a2c8 (Debian 13.6, perl-base 5.40.1-6).
# Trivy reported exactly three CRITICALs, all perl-base and all already listed:
# CVE-2026-13221, CVE-2026-42496, CVE-2026-8376. CVE-2026-57433 did NOT surface
# as CRITICAL in that run, but it is NOT stale and was deliberately kept: the
# Debian tracker still reports trixie "vulnerable" at 5.40.1-6, fixed only in
# forky/sid (5.42.3-1). Trivy's severity rating moves with its database; the
# vulnerability does not. Deleting the entry would just hand CI a future red.
# Earlier reviews: CVE-2026-42496 / CVE-2026-8376 — 2026-07-02 (perl version
# not recorded); CVE-2026-13221 / CVE-2026-57433 — 2026-07-25.

# perl-base (from python:3.14-slim-trixie). perl is never invoked at runtime:
# ssh-mcp never shells out locally (no subprocess/os.system in src/ssh_mcp/) and
# jump hosts go through asyncssh's in-process tunnel, not an `ssh` ProxyCommand.
# Debian has not published a fix for any of these.
CVE-2026-42496 # perl-archive-tar path traversal — Debian status: fix_deferred
CVE-2026-8376 # perl regex-compile heap buffer overflow — Debian status: affected

# Added 2026-07-25. Both surfaced as CRITICAL on the first Trivy run after the
# `Lint` job was un-blocked (previously `docker` never reached the scan step —
# which any job in `needs: [test, lint, audit]`, `audit` included, can still
# cause; the scan itself is now two steps, published digest vs PR-local image).
# Verified against the Debian security tracker: trixie is "vulnerable" at
# perl 5.40.1-6 with NO fixed version published for trixie.
CVE-2026-13221 # perl regex trie >65535 branches -> silently wrong matches; trixie: vulnerable, no fix
# NOTE for re-review: CVE-2026-57433 IS fixed in Debian sid (5.42.2-3) and
# forky (5.40.1-8) — just not in trixie. The moment the base image moves off
# trixie this entry becomes FIXABLE and must be deleted, not carried forward.
CVE-2026-57433 # Storable SX_HOOK signed-int overflow -> deserialization panic; trixie: vulnerable, no fix
# Last reviewed 2026-12-01, on the base-image move to
# python:3.15-slim-trixie@sha256:65a65fc7 (Debian 13.7, perl-base
# 5.40.1-6+deb13u1). The file is intentionally empty of entries: all four
# previously ignored perl-base CVEs (CVE-2026-42496, CVE-2026-8376,
# CVE-2026-13221, CVE-2026-57433) are marked resolved for trixie by the Debian
# security tracker at 5.40.1-6+deb13u1, the version this base ships, and a Trivy
# scan of the published 3.15 image with no ignore file reports zero CRITICALs.
# Fixable entries are deleted, not carried forward.
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Command sources: `.github/workflows/ci.yml` (the gates), `.github/workflows/rele
- **Type:** app — published as a PyPI wheel (`uvx blc-ssh-mcp`) *and* a container image (`ghcr.io/blackaxgit/ssh-mcp`). **The PyPI distribution is `blc-ssh-mcp`, not `ssh-mcp`** — that name belongs to an unrelated project this repo has never owned; see the comment above `name` in `pyproject.toml`. The import package is still `ssh_mcp` and the image is still `.../ssh-mcp`.
- **Stacks:** Python 3.11-3.15, `uv` + hatchling, asyncssh, MCP SDK, Starlette/uvicorn (HTTP transport only)
- **Deploy targets:** N/A — this is a tool operators run themselves, not a hosted service
- **Version:** `src/ssh_mcp/__init__.py` is the single source (hatchling reads it). Currently `0.9.2`. `0.7.0` shipped 2026-09-06 (the MCP SDK v2 migration) and is the first release published under a reviewer-gated `pypi` environment; `0.6.0`, `0.6.1` and `0.6.2` all shipped 2026-07-26. `CHANGELOG.md` `[Unreleased]` is where post-0.9.2 work accrues.
- **Version:** `src/ssh_mcp/__init__.py` is the single source (hatchling reads it). Currently `0.9.3`. `0.7.0` shipped 2026-09-06 (the MCP SDK v2 migration) and is the first release published under a reviewer-gated `pypi` environment; `0.6.0`, `0.6.1` and `0.6.2` all shipped 2026-07-26. `CHANGELOG.md` `[Unreleased]` is where post-0.9.3 work accrues.

**What this tool does matters for how you treat it.** Every tool call runs a shell command or transfers a file on a remote host. A bug here is not a crashed request; it is an unintended command on someone's infrastructure, or a write to the operator's own machine.

## Commands

```bash
uv sync --locked --extra dev # setup. --locked is required; see Gotchas
uv run pytest # full suite (861 tests, seconds)
uv run pytest # full suite (863 tests, seconds)
uv run pytest tests/test_ssh.py::TestRedactSecrets -v # one class
uv run pytest 'tests/test_ssh.py::TestRedactSecrets::<test_name>' -v # one test
uv run pytest -k "confinement" -v # by keyword
Expand Down Expand Up @@ -130,7 +130,7 @@ The full state matrix is documented on `ExecResult` in `models.py`. Do not "norm

**The image is multi-arch (`linux/amd64,linux/arm64`) as of 0.8.1, and that makes the Trivy gate arity load-bearing.** A multi-arch push produces an *index*, and Trivy resolves an index to the runner's own platform, so **one** scan step gates amd64 and publishes arm64 uninspected — with a green gate. There is therefore one scan step per platform, selected via `TRIVY_PLATFORM` (trivy-action v0.36.0 exposes no `platform` input but passes environment through). For the same reason the digest-verification step **derives** its expected manifest set from the scanned reference instead of comparing against `steps.build.outputs.digest`, which is now an index digest whose children are what `imagetools create` copies into the tag — hardcoding it would fail every publish run, the same shape as the 2026-07-26 incident one level down. `test_published_image_is_multi_arch_and_every_platform_is_scanned` asserts platforms-built equals platforms-scanned.

**The PR path builds amd64 only, so arm64 build breakage surfaces on `main`, not on the PR.** `load: true` cannot load a multi-platform result, so the PR build stays single-platform for fast feedback and Trivy has a local image to scan. The consequence is asymmetric and deliberate: a Dockerfile change that breaks the arm64 leg passes review and turns `main` red. That is loud and publishes nothing — the digest push happens in the same failed step — but it does mean an arch-sensitive change should be built locally first (`docker buildx build --platform linux/arm64 .`), which is how 0.8.1's arm64 leg was verified before merge. Both pinned bases were checked to be multi-arch indexes at the same time (`python:3.14-slim-trixie` and `ghcr.io/astral-sh/uv:0.13.1`); pinning a *single-platform* digest there is the failure this would otherwise find late.
**The PR path builds amd64 only, so arm64 build breakage surfaces on `main`, not on the PR.** `load: true` cannot load a multi-platform result, so the PR build stays single-platform for fast feedback and Trivy has a local image to scan. The consequence is asymmetric and deliberate: a Dockerfile change that breaks the arm64 leg passes review and turns `main` red. That is loud and publishes nothing — the digest push happens in the same failed step — but it does mean an arch-sensitive change should be built locally first (`docker buildx build --platform linux/arm64 .`), which is how 0.8.1's arm64 leg was verified before merge. Both pinned bases were checked to be multi-arch indexes at the same time (`python:3.15-slim-trixie` and `ghcr.io/astral-sh/uv:0.13.1`); pinning a *single-platform* digest there is the failure this would otherwise find late.

All third-party actions are pinned to a full commit SHA with a `# vX` comment, and `astral-sh/setup-uv` additionally pins a `version:` so `uv` itself cannot float. Keep both — an unpinned tool is how this repo previously had CI go red on commits that had passed days earlier. Never replace a SHA with a tag reference. None of this is prose-only convention: `tests/test_ci_lint_determinism.py` asserts it, so a workflow edit that drops a pin fails the suite.

Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.3] - 2026-12-01

> **Why 0.9.3 and not 0.10.0:** nothing here makes a configuration that started on 0.9.2 refuse to start. The runtime dependency changes are lockfile-only patches (`opentelemetry-api`, `pydantic`); the only new declared floor is a uv constraint, and the container image's interpreter move adds no configuration surface.

### Security

**opentelemetry-api is locked at 1.45.2, and a `[tool.uv]` constraint keeps it at 1.45.2 or later, clearing CVE-2026-126360 (GHSA-mf5v-w3w3-f6cg, Dependabot alert #53) (#91).** 1.45.1 parsed the W3C `traceparent` header in quadratic time. Unlike the recent dev-only advisories this one is reachable: mcp's server middleware extracts trace context from client-supplied request `_meta`, with or without an OpenTelemetry SDK installed, so a crafted request could burn CPU on the server. The container image and `uv sync --locked` install 1.45.2; a fresh `pip install blc-ssh-mcp` resolves it too, but the floor is uv-only because the dependency is transitive via mcp.

**`.trivyignore` no longer suppresses any CVE.** Its four perl-base entries (CVE-2026-42496, CVE-2026-8376, CVE-2026-13221, CVE-2026-57433) are fixed in trixie's perl 5.40.1-6+deb13u1, which the new base image ships, so the CRITICAL Trivy gate now scans the image with nothing ignored.

### Changed

**The container image runs Python 3.15 (#90).** The base moves from `python:3.14-slim-trixie` to `python:3.15-slim-trixie` (CPython 3.15.2), superseding 0.9.1's note that the image stays on 3.14. CI has tested 3.15 since 0.9.1, and every compiled runtime dependency ships cp315 or abi3 manylinux wheels for both amd64 and arm64, so nothing is built from source.

**Locked dependency upgrades (#91).** Runtime: `opentelemetry-api` 1.45.1 → 1.45.2 (see Security), `pydantic` 2.14.1 → 2.14.4 (`pydantic-core` 2.50.1 → 2.50.5). Dev-only: `ruff` 0.17.2 → 0.17.6 (exact pin in the `dev` extra), `hypothesis` 6.170.11 → 6.170.22, `mypy` 2.4.0 → 2.4.1, `pytest` 9.1.1 → 9.2.0, `pytest-asyncio` 1.4.1 → 1.5.0, `packaging` 26.3 → 26.4, `pip` 26.2.2 → 26.3, `pyyaml` 6.0.3 → 6.0.4, `opentelemetry-sdk` 1.45.1 → 1.45.2, `opentelemetry-semantic-conventions` 0.66b1 → 0.66b2.

**CI pins (#87).** `astral-sh/setup-uv` 10.3.2 → 10.3.3 and `docker/login-action` 4.7.0 → 4.8.0, each still pinned to a commit SHA. The `uv` version the workflows install stays 0.13.1.

## [0.9.2] - 2026-10-29

> **Why 0.9.2 and not 0.10.0:** nothing here makes a configuration that started on 0.9.1 refuse to start. The only runtime dependency change is a lockfile-only `pydantic` patch; no declared floor in `pyproject.toml`'s `dependencies` moved.
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Multi-stage build for Python MCP server with uv package manager
# Base: python:3.14-slim-trixie (Debian 13, 2026 standard)
# 3.14 is a deliberate image target; the package itself supports >=3.11 and CI
# Base: python:3.15-slim-trixie (Debian 13, 2026 standard)
# 3.15 is a deliberate image target; the package itself supports >=3.11 and CI
# runs the 3.11-3.15 matrix (pyproject.toml, .github/workflows/ci.yml).
# Stage 1: Builder - compile dependencies with uv

# python:3.14-slim-trixie
# python:3.15-slim-trixie
FROM python:3.15-slim-trixie@sha256:65a65fc7b30b06cb6df4930fd4650697cb23f4c2698ab81fc87e4b031bc36928 AS builder

# Copy uv from official distribution image (not using as base to keep image small)
Expand Down Expand Up @@ -45,7 +45,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \

# Stage 2: Runtime - minimal production image

# python:3.14-slim-trixie
# python:3.15-slim-trixie
FROM python:3.15-slim-trixie@sha256:65a65fc7b30b06cb6df4930fd4650697cb23f4c2698ab81fc87e4b031bc36928

# Create non-root user for security (uid 1000 standard)
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ constraint-dependencies = [
# pip-audit -> cachecontrol -> msgpack, decoding only pip-audit's own cache.
# The floor keeps a future `uv lock` from regressing.
"msgpack>=1.2.3",
# CVE-2026-126360 / GHSA-mf5v-w3w3-f6cg (medium) — quadratic-time W3C
# `traceparent` parsing, a CPU denial of service; fixed in 1.45.2. Transitive
# via mcp (which requires opentelemetry-api>=1.28.0) and REACHABLE: mcp's
# server middleware extracts trace context from client-supplied request
# `_meta` even with no OpenTelemetry SDK installed. The floor keeps a future
# `uv lock` from regressing.
"opentelemetry-api>=1.45.2",
]

[tool.ruff.lint]
Expand Down
2 changes: 1 addition & 1 deletion src/ssh_mcp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""SSH MCP Server - Manage infrastructure via MCP clients like Claude Code."""

__version__ = "0.9.2"
__version__ = "0.9.3"
7 changes: 7 additions & 0 deletions tests/test_dependency_floors.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@
"dependencies and from the --no-dev container image. Not reachable: "
"only pip-audit's own cache entries are decoded.",
),
"opentelemetry-api": (
"1.45.2",
"CVE-2026-126360 / GHSA-mf5v-w3w3-f6cg: quadratic-time W3C traceparent "
"parsing, a CPU denial of service; fixed in 1.45.2. Transitive via mcp "
"and reachable: mcp's server middleware extracts trace context from "
"client-supplied request _meta even with no OpenTelemetry SDK installed.",
),
}

# Packages that ssh-mcp imports directly and must therefore constrain in the
Expand Down
1 change: 1 addition & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.