Skip to content

feat: add APIs to list and download public remote skills#10448

Merged
xl-openai merged 1 commit intomainfrom
xl/skill-share
Feb 3, 2026
Merged

feat: add APIs to list and download public remote skills#10448
xl-openai merged 1 commit intomainfrom
xl/skill-share

Conversation

@xl-openai
Copy link
Collaborator

Add API to list / download from remote public skills

pub async fn list_remote_skills(config: &Config) -> Result<Vec<RemoteSkillSummary>> {
let base_url = config.chatgpt_base_url.trim_end_matches('/');
let base_url = base_url.strip_suffix("/backend-api").unwrap_or(base_url);
let url = format!("{base_url}/public-api/hazelnuts/");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Public API has a slightly different format and it doesn't require Auth.

.await
.context("Failed to create downloaded skills directory")?;

let allowed_files = hazelnut.files.keys().cloned().collect::<HashSet<String>>();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remote skill will be a zip and need to unzip while downloading.

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d09d5c438

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 141 to 155
hazelnut.name.clone()
};
let output_dir = downloaded_skills_dir(config).join(dir_name);
tokio::fs::create_dir_all(&output_dir)
.await
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Sanitize remote skill names before joining output path

The download directory is derived directly from hazelnut.name (falling back to id) and then joined onto codex_home/skills/downloaded without validation. If the public API returns a name containing path separators or .., the resulting output_dir can escape the intended base directory, and subsequent create_dir_all plus file extraction will write outside the skills cache. This is a real risk when downloading from a public catalog; consider normalizing dir_name to a safe single path component (e.g., reject components other than Normal, or use a slug) before joining.

Useful? React with 👍 / 👎.

@xl-openai xl-openai force-pushed the xl/skill-share branch 3 times, most recently from 0dc3501 to 9f27df1 Compare February 3, 2026 06:09
Comment on lines +77 to +79
let base_url = config.chatgpt_base_url.trim_end_matches('/');
let base_url = base_url.strip_suffix("/backend-api").unwrap_or(base_url);
let url = format!("{base_url}/public-api/hazelnuts/");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have a helper function for constructing public-api/hazelnuts url? Then we can utilize it in all the places

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it is only used for skills-remote. we could do so if we need to use it in more places.

@xl-openai xl-openai merged commit f38d181 into main Feb 3, 2026
32 checks passed
@xl-openai xl-openai deleted the xl/skill-share branch February 3, 2026 22:09
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants