fix(skills_hub): verify ClawHub archive and per-file SHA-256 on download - #13583
Closed
Subway2023 wants to merge 1 commit into
Closed
Subway2023 wants to merge 1 commit into
Subway2023 wants to merge 1 commit into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
ClawHubSourcedownloaded and installed skill archives without verifying them against any server-published hash. A network-level attacker (MITM) could silently replace a downloaded archive with malicious content, and the agent would install it without any indication of tampering.This PR adds integrity verification to two download paths:
_download_zip): fetchsha256hashfrom/skills/{slug}/versions/{version}before extracting, and compare it against the SHA-256 of the downloaded ZIP bytes. A mismatch aborts the install._extract_files): when fetching individual files viarawUrl, verify against the optionalsha256field in the file metadata. Files that fail the check are skipped with a warning.If the API does not return a hash (degraded mode), a warning is logged and the install proceeds.
Related Issue
GHSA-w4h6-jpv9-2gx5
Fixes #
Type of Change
Changes Made
tools/skills_hub.py: add_resolve_version_integrity()to fetch version metadata and extractsha256hashtools/skills_hub.py: updatefetch()to call_resolve_version_integrity()and abort on tamper detectiontools/skills_hub.py: update_download_zip()to acceptexpected_sha256and verify archive hash before extractiontools/skills_hub.py: update_extract_files()to verify per-filesha256from metadata when availabletests/tools/test_skills_hub_integrity.py: add tests covering hash match, tamper rejection, degraded-mode warning, and per-file integrityHow to Test
pytest tests/tools/test_skills_hub_integrity.py -v— all 10 integrity tests should passpytest tests/ -q— full suite should pass with no regressionsChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A