Skip to content

chore: coverage floor + ruff lint + pip-audit CVE gates; cover sigstore trust-root; bump vulnerable deps#80

Merged
ernestprovo23 merged 1 commit into
mainfrom
chore/coverage-and-gates
Jul 14, 2026
Merged

chore: coverage floor + ruff lint + pip-audit CVE gates; cover sigstore trust-root; bump vulnerable deps#80
ernestprovo23 merged 1 commit into
mainfrom
chore/coverage-and-gates

Conversation

@ernestprovo23

Copy link
Copy Markdown
Member

Summary

Raises coverage on the sigstore trust-root and adds the three missing CI enforcement gates (coverage floor, lint, CVE), plus a security dependency bump.

Coverage

Target Before After
src/mcp_warden/signing.py (trust root) 61% 99%
src/mcp_warden/guard_list_gate.py 0% (visibility artifact) 89%
Whole project 75% 86.36%
  • New tests/test_signing_unit.py (25 tests) drives the internal sign/verify code paths in signing.py by mocking the pinned sigstore boundary symbols (_ClientTrustConfig, _SigningContext, _Verifier, _policy, _IdentityToken, _detect_credential, _Bundle). No real network, OIDC, TUF, or Fulcio/Rekor traffic. Covers the sign path (ambient + explicit token), the verify path (identity/issuer plumbing), and every fail-closed branch (unavailable, bad/empty token, signing failure, verification error, malformed bundle, version-window warning).
  • Coverage enforced in CI: pytest --cov=mcp_warden --cov-report=term-missing --cov-fail-under=80. Floor pinned at a round 80 — below the ~86% actual so it can only rise, never silently regress.
  • Subprocess coverage captured: guard_list_gate.py only ever runs inside the guard child spawned by tests/fixtures/fault_guard_launcher.py, so the in-process run reported it at 0%. Fixed with [tool.coverage.run] parallel = true + COVERAGE_PROCESS_START=pyproject.toml (fires the coverage .pth hook in the subprocess); pytest-cov combines the parallel data files. Real coverage now captured (0% → 89%).

Lint gate (ruff)

  • Added [tool.ruff] (select E,W,F,I,B; line-length = 100; ignore E501 and the typer/FastAPI B008 default-call idiom), modeled on conclave's config.
  • New Lint (ruff) CI job runs ruff check ..
  • Fixed all surfaced violations (unused imports, import order, B904 raise-from, E702, F841).
  • guard.py:GUARD_STRICT_EXIT and res_net.py:SSRF_NETWORKS are preserved with # noqa: F401 — both are live re-exports (consumed by tests/test_guard_strict.py and res_rules.py respectively), not dead code.

CVE gate (pip-audit)

  • Added a fail-closed pip-audit --skip-editable step to the deps-locked workflow that audits the resolved, hash-locked dependency closure and fails on any advisory. Mirrors conclave's fail-closed job.

Dependency bump (security)

  • pydantic-settings 2.14.1 → 2.14.2 — clears GHSA-4xgf-cpjx-pc3j.
  • mcp 1.27.2 → 1.28.1, cryptography → 49.0.0, anyio 4.13.0 → 4.14.2, plus current minors; pytest-cov added to the dev extra. requirements-dev.lock regenerated (hash-locked) and verified idempotent against the deps-locked in-sync check.

Local verification

  • 586 passed, 2 skipped with --cov-fail-under=80 satisfied (total 86.36%).
  • ruff check . clean.
  • pip-audit clean (no known vulnerabilities).

Note on the "dead import"

The task flagged res_net.py:14 SSRF_NETWORKS as an unused import to delete. It is not dead — res_rules.py re-exports it from res_net (under its own # noqa: F401), and removing it broke the import chain repo-wide. Kept it as a documented re-export with # noqa: F401 instead, matching the existing pattern.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QofWZ4MivqEKPevjSYuwdk

…p deps

Raise trust-root coverage and add the missing CI enforcement gates.

Coverage
- New tests/test_signing_unit.py (25 tests) drives signing.py's internal
  sign/verify paths directly, mocking the sigstore boundary (no network/OIDC).
  signing.py line coverage 61% -> 99%; whole-project 75% -> ~86%.
- Enforce coverage in CI: pytest --cov=mcp_warden --cov-fail-under=80.
- Capture subprocess coverage of guard_list_gate.py (0% -> ~89%) via
  [tool.coverage.run] parallel=true + COVERAGE_PROCESS_START, so the guard
  child spawned by the strict-abort tests is measured (no longer a 0% artifact).

Lint
- Add [tool.ruff] (E,W,F,I,B; line-length=100; ignore E501,B008) and a ruff
  lint job in the CI workflow. Fixed all surfaced violations (unused imports,
  import order, B904 raise-from, E702, F841). guard.py's GUARD_STRICT_EXIT and
  res_net.py's SSRF_NETWORKS re-exports are preserved via # noqa: F401 (both are
  consumed by tests / res_rules re-export; NOT dead).

CVE
- Add a fail-closed pip-audit gate to deps-locked that audits the resolved
  dependency closure.

Deps
- Bump the hash-locked dev/CI closure: pydantic-settings 2.14.1 -> 2.14.2
  (clears GHSA-4xgf-cpjx-pc3j), mcp 1.27.2 -> 1.28.1, cryptography -> 49.0.0,
  anyio 4.13.0 -> 4.14.2, others. Add pytest-cov to the dev extra.
@ernestprovo23
ernestprovo23 merged commit 7dade6a into main Jul 14, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant