You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The one-line sources.list parser quoted the whole line in its warnings, which could carry user:password@ credentials. Pass the quoted text through redact_url.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active critical and moderate findings remain: a race can delete an unrelated file, verification ignores cancellation and deadlines, and truncated file lists can incorrectly report successful verification.
This pull request adds a stdlib-only minideb mcp server for querying APT repositories, downloading verified packages, and inspecting local Debian artifacts.
Changes:
Adds MCP JSON-RPC stdio handling, startup validation, repository tools, download verification, local inspection, cancellation, limits, and safe filesystem writes.
Strengthens parsing, fetching, credential redaction, logging, and repository safety.
Adds extensive tests, documentation, fixtures, changelog updates, and an MCP client example.
This pull request requires changes.
File
Description
TODO.md
Records planned HTTP transport and MCP resource support.
tests/test_sources.py
Tests LF-only parsing and credential redaction.
tests/test_release.py
Updates fetcher test doubles for cancellation and deadline options.
tests/test_mcp_startup.py
Tests MCP startup validation and configuration.
tests/test_mcp_e2e.py
Exercises complete MCP workflows, downloads, cancellation, proxies, and filesystem safety.
tests/test_mcp_compat.py
Tests MCP protocol negotiation and SDK compatibility.
tests/test_mcp_cli.py
Tests subprocess behavior, signals, logging, limits, and stdout purity.
tests/test_logging.py
Tests traceback formatting and fetcher compatibility.
tests/test_index.py
Tests index size enforcement before downloads.
tests/test_fetch.py
Tests proxy credential redaction.
tests/test_fetch_download.py
Tests streaming downloads, limits, hashes, retries, and cancellation.
tests/test_examples.py
Runs and validates the MCP example.
tests/test_errors.py
Tests malformed indexes being recorded as nonfatal problems.
tests/test_dsc.py
Tests LF-only source package list parsing.
tests/test_docs_mcp.py
Verifies MCP documentation, options, tools, and examples.
tests/test_deb.py
Tests bounded member reads, archive limits, and md5sums parsing.
tests/test_control.py
Tests LF-only control parsing and CR handling.
tests/test_client.py
Tests malformed indexes, cache behavior, and cancellation-aware fetching.
tests/test_client_plans.py
Tests package planning, grouping, filtering, caching, and concurrency.
tests/test_cli.py
Updates fetcher test doubles and CLI probing behavior.
tests/test_checksums.py
Tests LF-only checksum parsing.
tests/test_changelog.py
Tests LF-only changelog parsing.
tests/mcp_client.py
Provides MCP protocol, subprocess, repository, and proxy test helpers.
tests/fixtures/repo.py
Adds multi-architecture and source-package repository fixtures.
tests/conftest.py
Adds MCP subprocess, repository, and download fixtures.
src/minideblib/sources.py
Adds LF-only source parsing and URL credential redaction.
src/minideblib/repo/release.py
Exposes reusable missing-resource detection.
src/minideblib/repo/index.py
Adds pre-download Release size enforcement.
src/minideblib/mcp/tools.py
Registers repository, download, and local inspection tools.
src/minideblib/mcp/tools_local.py
Implements bounded local .deb and .dsc inspection.
src/minideblib/mcp/toolkit.py
Provides MCP schemas, argument helpers, and response sizing.
src/minideblib/mcp/startup.py
Validates platform, identity, URLs, repositories, and server options.
src/minideblib/mcp/run.py
Runs the MCP stdio server with signal handling and log isolation.
src/minideblib/mcp/repos.py
Provides repository resolution, caching, paging, and result sanitization.
src/minideblib/mcp/__init__.py
Exposes the MCP protocol API.
src/minideblib/dsc.py
Applies LF-only parsing to source package lists.
src/minideblib/deb.py
Adds bounded member reads and archive entry limits.
src/minideblib/control.py
Changes control parsing to LF-only line handling.
src/minideblib/cli.py
Registers the mcp command and server options.
src/minideblib/checksums.py
Aligns checksum block parsing with LF-only termination.
src/minideblib/changelog.py
Applies LF-only changelog parsing.
README.md
Documents MCP usage, tools, security, limits, and architecture.
examples/README.md
Documents the MCP client example and test commands.
examples/12_mcp_client.py
Adds a stdlib MCP client example.
debian/minideb.1
Documents the MCP command, options, tools, and exit behavior.
CHANGES
Documents the MCP server and related library safety features.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Three critical active issues remain: cancelled jobs can cause unbounded queue growth, disabling verification also bypasses required .dsc hash checks, and unvalidated file names permit reads outside the intended directory.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A moderate active issue remains in safeio.py: post-publication cleanup or directory-sync failures can report a failed commit while leaving an untracked published file behind.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Post-link failures can leave an untracked published file
src/minideblib/mcp/safeio.py:570
The final name is already linked before committed is set and before the temporary link is removed and the directory is synced. If either os.unlink(self.temp_name) or os.fsync(dir_fd) fails, this method raises while leaving the published file in place; callers treat the commit as failed and source-package rollback does not add this file to published, so an all-or-none download can leave an untracked file behind. Handle post-link cleanup/sync failures as a published outcome or explicitly remove/record the final link before propagating the error.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because the hash cross-check can silently accept an incorrect .dsc digest when it uses an algorithm absent from the source index metadata.
`minideb mcp` runs the MCP server on stdin/stdout. Startup checks
(platform, not root) run before stdin is read; startup errors are one
`minideb: error:` line with exit status 2. The protocol streams move to
private descriptors (fd 1 becomes a copy of stderr, fd 0 reads
/dev/null), log records are escaped for control and invisible
characters, and SIGTERM/SIGINT end the session like EOF (in-flight calls
cancelled, exit status 0). --no-verify prints a warning, and
--max-response-bytes must be at least 4096.
Subprocess tests over real pipes against the multi-arch fixture repository
served over HTTP by a thread: the whole workflow (overview, search, package
info, binary, multi-arch and source downloads, inspect_deb/inspect_dsc of the
downloaded files), cancelling a slow download, two sessions in one
directory, a proxy from http_proxy/no_proxy in the child environment.
Security regressions end to end: prompt-injection and smuggled protocol text
as plain data, control/ANSI/bidi/NUL characters, megabyte fields truncated,
symlinks swapped in at the final name and the subdirectory during a
download (hooks and a flipping thread), stale temporary file decoys, the
response cap on the wire, hostile protocol input (deep nesting, huge
arrays, batches, ids), a seeded fuzz run, SIGTERM with an unread stdout
flood and root refusal for each of the real, effective and saved uid.
Compatibility: version negotiation over every supported version and an
optional session with the official SDK client (skipped when it is not
installed). The subprocess helpers (Spawner, Child, RepoServer,
ProxyServer) move to tests/mcp_client.py and the spawn fixture to
conftest.py.
A lone CR was a line break for minideblib but not for apt, so a value
could carry extra fields or whole paragraphs that only minideblib saw.
Control data, checksum blocks, .dsc Package-List, deb md5sums, one-line
sources.list files and changelogs now end lines at LF only (one CR before
it is dropped); str.splitlines() also split at U+2028, form feeds and
other separators. RepoClient records a malformed index as a problem
instead of failing the whole query.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.