Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(skills): reject a docsPath segment that is not a plain path segment

M3gA-Mindeda7b396bf9f
diff --git a/crates/openhuman-core/src/skills/catalog/download.rs b/crates/openhuman-core/src/skills/catalog/download.rs
index aa97e38df2..015f76d90d 100644
--- a/crates/openhuman-core/src/skills/catalog/download.rs
+++ b/crates/openhuman-core/src/skills/catalog/download.rs
@@ -24,7 +24,7 @@ const SKILLS_SH_BASE_DIRS: [&str; 4] = ["", "skills/", ".agents/skills/", ".clau
const PROBE_TIMEOUT_SECS: u64 = 15;
/// A catalog value is spliced into a URL path, so it must be one plain segment.
-fn is_safe_segment(value: &str) -> bool {
+pub(super) fn is_safe_segment(value: &str) -> bool {
!value.is_empty()
&& value != "."
&& value != ".."
diff --git a/crates/openhuman-core/src/skills/catalog/ops.rs b/crates/openhuman-core/src/skills/catalog/ops.rs
index 71277cd141..1c8fd54de2 100644
--- a/crates/openhuman-core/src/skills/catalog/ops.rs
+++ b/crates/openhuman-core/src/skills/catalog/ops.rs
@@ -730,6 +730,18 @@ fn download_url_from_docs_path(docs_path: &str) -> Option<String> {
let skill = prefixed_slug
.strip_prefix(&format!("{category}-"))
.unwrap_or(prefixed_slug);
+ // `category` and `skill` come from the catalog and are spliced into a URL
+ // path. A reserved character (space, `#`, `?`, `%`) would change what the
+ // URL names, so an entry that is not a plain path segment gets no download
+ // URL and is reported as not installable rather than fetched from a
+ // different path.
+ if !download::is_safe_segment(category) || !download::is_safe_segment(skill) {
+ tracing::debug!(
+ docs_path = %docs_path,
+ "[skill_registry] docsPath has a non-plain path segment; no download URL"
+ );
+ return None;
+ }
Some(format!(
"https://raw.githubusercontent.com/NousResearch/hermes-agent/main/{root}/{category}/{skill}/SKILL.md"
))
diff --git a/crates/openhuman-core/src/skills/catalog/ops_tests.rs b/crates/openhuman-core/src/skills/catalog/ops_tests.rs
index 5f13ad47bb..211aacfd8a 100644
--- a/crates/openhuman-core/src/skills/catalog/ops_tests.rs
+++ b/crates/openhuman-core/src/skills/catalog/ops_tests.rs
@@ -101,6 +101,30 @@ fn parse_hermes_entry_leaves_entries_without_a_skill_md_undownloadable() {
}
}
+#[test]
+fn parse_hermes_entry_rejects_a_docs_path_segment_that_is_not_a_plain_path_segment() {
+ // `docsPath` is spliced into a raw.githubusercontent URL: a reserved
+ // character would change the path the URL names, so the entry gets no
+ // download URL instead. (#6285)
+ for docs_path in [
+ "bundled/apple/apple-my skill",
+ "bundled/apple/apple-my#skill",
+ "bundled/ap?ple/apple-notes",
+ "bundled/apple/..",
+ ] {
+ let entry = parse_hermes_entry(&json!({
+ "name": "odd-skill",
+ "description": "x",
+ "category": "apple",
+ "source": "built-in",
+ "docsPath": docs_path
+ }))
+ .expect("entry");
+ assert_eq!(entry.download_url, "", "docsPath {docs_path:?}");
+ assert!(!entry.has_direct_download());
+ }
+}
+
#[test]
fn parse_hermes_entry_installs_clawhub_skills_by_slug() {
// ClawHub entries carry only a slug; the file API serves its SKILL.md. (#6285)