mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-08 08:11:38 +00:00
fix: harden skill trust source matching (#31229)
Co-authored-by: gaia <gaia@gaia.local>
This commit is contained in:
parent
2d422720b5
commit
93660643a6
4 changed files with 78 additions and 8 deletions
|
|
@ -917,12 +917,14 @@ def _resolve_trust_level(source: str) -> str:
|
|||
# Agent-created skills get their own permissive trust level
|
||||
if normalized_source == "agent-created":
|
||||
return "agent-created"
|
||||
# Official optional skills shipped with the repo
|
||||
if normalized_source.startswith("official/") or normalized_source == "official":
|
||||
# Official optional skills must be identified by source provenance, not by
|
||||
# user-controlled GitHub identifiers such as "official/<repo>".
|
||||
if normalized_source == "official":
|
||||
return "builtin"
|
||||
# Check if source matches any trusted repo
|
||||
# Check if source matches any trusted repo exactly, or a skill path inside
|
||||
# that repo. Do not trust sibling repositories that merely share a prefix.
|
||||
for trusted in TRUSTED_REPOS:
|
||||
if normalized_source.startswith(trusted) or normalized_source == trusted:
|
||||
if normalized_source == trusted or normalized_source.startswith(f"{trusted}/"):
|
||||
return "trusted"
|
||||
return "community"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue