Skip to content
Open
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
4 changes: 2 additions & 2 deletions hermes_cli/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11137,7 +11137,7 @@ def _mcp_install_action_name(name: str) -> str:
re-click or a second catalog install doesn't overwrite the first's tracked
process/log while its git clone is still running."""
slug = re.sub(r"[^a-z0-9]+", "-", name.lower()).strip("-")[:48] or "server"
digest = hashlib.sha1(name.encode()).hexdigest()[:8]
digest = hashlib.sha1(name.encode(), usedforsecurity=False).hexdigest()[:8]
action = f"mcp-install-{slug}-{digest}"
_ACTION_LOG_FILES.setdefault(action, f"action-{action}.log")
return action
Expand Down Expand Up @@ -12076,7 +12076,7 @@ def _hub_action_name(verb: str, key: str) -> str:
(readable) + hash (collision-proof) keys each action to its own row.
"""
slug = re.sub(r"[^a-z0-9]+", "-", key.lower()).strip("-")[:48] or "skill"
digest = hashlib.sha1(key.encode()).hexdigest()[:8]
digest = hashlib.sha1(key.encode(), usedforsecurity=False).hexdigest()[:8]
name = f"skills-{verb}-{slug}-{digest}"
_ACTION_LOG_FILES.setdefault(name, f"action-{name}.log")
return name
Expand Down
10 changes: 5 additions & 5 deletions tools/skills_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ def _parse_identifier(self, identifier: str) -> Optional[dict]:
}

def _parse_index(self, index_url: str) -> Optional[dict]:
cache_key = f"well_known_index_{hashlib.md5(index_url.encode()).hexdigest()}"
cache_key = f"well_known_index_{hashlib.md5(index_url.encode(), usedforsecurity=False).hexdigest()}"
cached = _read_index_cache(cache_key)
if isinstance(cached, dict) and isinstance(cached.get("skills"), list):
return cached
Expand Down Expand Up @@ -1532,7 +1532,7 @@ def search(self, query: str, limit: int = 10) -> List[SkillMeta]:
# entries; the sitemap walks the full ~20k+ catalog.
return self._sitemap_catalog(limit)

cache_key = f"skills_sh_search_{hashlib.md5(f'{query}|{limit}'.encode()).hexdigest()}"
cache_key = f"skills_sh_search_{hashlib.md5(f'{query}|{limit}'.encode(), usedforsecurity=False).hexdigest()}"
cached = _read_index_cache(cache_key)
if cached is not None:
return [SkillMeta(**item) for item in cached][:limit]
Expand Down Expand Up @@ -1759,7 +1759,7 @@ def _meta_from_search_item(self, item: dict) -> Optional[SkillMeta]:
)

def _fetch_detail_page(self, identifier: str) -> Optional[dict]:
cache_key = f"skills_sh_detail_{hashlib.md5(identifier.encode()).hexdigest()}"
cache_key = f"skills_sh_detail_{hashlib.md5(identifier.encode(), usedforsecurity=False).hexdigest()}"
cached = _read_index_cache(cache_key)
if isinstance(cached, dict):
return cached
Expand Down Expand Up @@ -2253,7 +2253,7 @@ def search(self, query: str, limit: int = 10) -> List[SkillMeta]:

# Non-empty query catalog miss, or catalog walker failure: fall back to
# the lightweight listing API for a best-effort response.
cache_key = f"clawhub_search_listing_v1_{hashlib.md5(query.encode()).hexdigest()}_{limit}"
cache_key = f"clawhub_search_listing_v1_{hashlib.md5(query.encode(), usedforsecurity=False).hexdigest()}_{limit}"
cached = _read_index_cache(cache_key)
if cached is not None:
return self._finalize_search_results(
Expand Down Expand Up @@ -2359,7 +2359,7 @@ def inspect(self, identifier: str) -> Optional[SkillMeta]:
)

def _search_catalog(self, query: str, limit: int = 10) -> List[SkillMeta]:
cache_key = f"clawhub_search_catalog_v1_{hashlib.md5(f'{query}|{limit}'.encode()).hexdigest()}"
cache_key = f"clawhub_search_catalog_v1_{hashlib.md5(f'{query}|{limit}'.encode(), usedforsecurity=False).hexdigest()}"
cached = _read_index_cache(cache_key)
if cached is not None:
return [SkillMeta(**s) for s in cached][:limit]
Expand Down
2 changes: 1 addition & 1 deletion tools/skills_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _compute_relative_dest(skill_dir: Path, bundled_dir: Path) -> Path:

def _dir_hash(directory: Path) -> str:
"""Compute a hash of all file contents in a directory for change detection."""
hasher = hashlib.md5()
hasher = hashlib.md5(usedforsecurity=False)
try:
for fpath in sorted(directory.rglob("*")):
if fpath.is_file():
Expand Down
Loading