fix(mcp): reject mutable catalog refs at runtime - #38018
Conversation
|
Thanks for the focused hardening change. The premise is confirmed on current main: The PR's parse-time full-SHA validation prevents the mutable-ref path before installation, updates the only git-install manifest, and retains the clone-then-checkout mechanism appropriate for commit objects. The proposed n8n SHA is currently available as the upstream Automated hermes-sweeper review. |
The shipped catalog is now protected by the exact-pin contract added in 9df5f87. Enforce the same full-commit-SHA policy while parsing install manifests so packaged catalog data fails closed before clone or bootstrap if it is malformed or stale.
2554b69 to
41634e3
Compare
|
Rebased and narrowed this PR after #64463 landed. Commit |
Summary
The shipped-catalog exposure reported in #38017 was independently fixed by #64463 /
9df5f879b: n8n now pins the same full commit SHA proposed here, and a catalog-wide CI contract rejects mutable Git refs in every shipped manifest.This PR is narrowed to the remaining runtime defense-in-depth boundary. It enforces the documented full-SHA policy while parsing install manifests, so malformed or stale packaged catalog data is rejected before clone or bootstrap.
install.refto be a string containing exactly 40 hexadecimal characters.main.Linked context
Follow-up defense in depth for #38017. The original shipped-catalog condition is fixed by #64463.
Current behavior proof
mainat477c08b44766ace8b890faa72bf82ecbcf2b3ba8.maindocuments that Git catalog installs require full commit SHAs and tests every shipped manifest against that invariant._parse_manifest()still accepts any non-emptyinstall.ref, including branches and tags._do_git_install()still contains the mutablegit clone --branchpath and will bootstrap it.Files changed
hermes_cli/mcp_catalog.pytests/hermes_cli/test_mcp_catalog.pyTests and validation
scripts/run_tests.sh tests/hermes_cli/test_mcp_catalog.py -q.venv/bin/ruff check hermes_cli/mcp_catalog.py tests/hermes_cli/test_mcp_catalog.pygit diff --checkSource state
477c08b44766ace8b890faa72bf82ecbcf2b3ba841634e3a44d743fb5ba6b28272826a623c459a05mainas its sole parent.Risk
This intentionally makes the documented full-SHA catalog policy fail closed at runtime. Package-manager-provided catalog data that still contains a branch, tag, abbreviated SHA, padded value, or non-string ref will be diagnosed as invalid instead of being cloned and bootstrapped.