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
2 changes: 1 addition & 1 deletion agent/codex_responses_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def _derive_responses_function_call_id(
return f"fc_{sanitized[:48]}"

seed = source or str(response_item_id or "") or uuid.uuid4().hex
digest = hashlib.sha1(seed.encode("utf-8")).hexdigest()[:24]
digest = hashlib.sha1(seed.encode("utf-8"), usedforsecurity=False).hexdigest()[:24]
return f"fc_{digest}"


Expand Down
2 changes: 1 addition & 1 deletion agent/context_compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,7 @@ def _prune_old_tool_results(
continue
if len(content) < 200:
continue
h = hashlib.md5(content.encode("utf-8", errors="replace")).hexdigest()[:12]
h = hashlib.md5(content.encode("utf-8", errors="replace"), usedforsecurity=False).hexdigest()[:12]
if h in content_hashes:
# This is an older duplicate — replace with back-reference
result[i] = {**msg, "content": "[Duplicate tool output — same content as a more recent call]"}
Expand Down
3 changes: 2 additions & 1 deletion hermes_cli/session_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,8 @@ def recover_session_database(
output_path=output_path,
work_dir=work_dir,
)
assert output is not None
if output is None:
raise SessionRecoverySafetyError("output_path is required for recovery")
disk_space = _disk_space_preflight(source, work_root, output.parent)

temp_dir, snapshot_source, inspection = _snapshot_and_inspect(source, work_root)
Expand Down
2 changes: 1 addition & 1 deletion plugins/platforms/sms/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def _check_signature(
mac = hmac.new(
self._auth_token.encode("utf-8"),
data_to_sign.encode("utf-8"),
hashlib.sha1,
lambda *a, **kw: hashlib.sha1(*a, usedforsecurity=False, **kw),
)
computed = base64.b64encode(mac.digest()).decode("utf-8")
# Compare as bytes: compare_digest raises TypeError on a str with
Expand Down
2 changes: 1 addition & 1 deletion plugins/platforms/wecom/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ async def _upload_media_bytes(self, data: bytes, media_type: str, filename: str)
"filename": filename,
"total_size": total_size,
"total_chunks": total_chunks,
"md5": hashlib.md5(data).hexdigest(),
"md5": hashlib.md5(data, usedforsecurity=False).hexdigest(),
},
)
self._raise_for_wecom_error(init_response, "media upload init")
Expand Down
2 changes: 1 addition & 1 deletion plugins/platforms/wecom/wecom_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def decode(cls, decrypted: bytes) -> bytes:

def _sha1_signature(token: str, timestamp: str, nonce: str, encrypt: str) -> str:
parts = sorted([token, timestamp, nonce, encrypt])
return hashlib.sha1("".join(parts).encode("utf-8")).hexdigest()
return hashlib.sha1("".join(parts).encode("utf-8"), usedforsecurity=False).hexdigest()


class WXBizMsgCrypt:
Expand Down
10 changes: 5 additions & 5 deletions tools/skills_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,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 @@ -1657,7 +1657,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 @@ -1884,7 +1884,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 @@ -2382,7 +2382,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 @@ -2508,7 +2508,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 @@ -253,7 +253,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