Skill root directory validation accepts any path via lexical suffix match instead of canonical containment

Aperta
#1,325 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust, tauri
Ambito
security

Direzione di ricerca

Start in validate_skill_root() in src-tauri/src/skill_runtime.rs, then read validate_output_directory and validate_runtime_directory in the same file, since the issue says they use the same ends_with check. The reporter gives no reproduction steps, so you would need to build one first. Done means the three validators only accept paths whose canonical form sits inside the app data skills directory, and a test covers a path outside it that ends in skills/<skill_id>. Because this is a security fix, get maintainer review before merging.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

Affected versions: confirmed on master HEAD, commit as of 2026-10-31.

validate_skill_root() in src-tauri/src/skill_runtime.rs has a fallback check that accepts any skill_root whose path merely ends with the string skills/<skill_id>, with no check that the path is actually contained within the application's own data directory. Since skill_id names the skill package being executed and is attacker-controlled, an attacker can choose it to make this suffix match trivially satisfiable for a directory anywhere on the filesystem that they control.

Details

fn validate_skill_root(app_handle: &AppHandle, skill_root: &Path, skill_id: &str) -> Result<(), String> {
    let app_data = app_handle.path().app_data_dir()...;
    let known_roots = [
        app_data.join("skills").join(skill_id),
        app_data.join("article").join("skills").join(skill_id),
    ];
    if known_roots.iter().any(|root| std::fs::canonicalize(root).map(|root| root == skill_root).unwrap_or(false)) {
        return Ok(());
    }
    // vulnerable fallback: lexical suffix only, no canonical containment check
    if skill_root.ends_with(Path::new("skills").join(skill_id)) {
        return Ok(());
    }
    Err("Skill root does not match the requested Skill ID".to_string())
}

The same ends_with-as-authorization pattern recurs in validate_output_directory and validate_runtime_directory in the same file.

Steps To Reproduce

(available upon request)

Impact

Combined with the script/interpreter execution the skill-runtime performs, this lets a malicious skill package execute from (and potentially write outputs/runtime files to) a location of the attacker's choosing rather than the sandboxed app-data skills directory the rest of the validation logic assumes. Worth auditing the other two functions using the same pattern as well.

Lingua principale
TypeScript
Stelle
12.9k
Fork
975
Merge medio
1g 2h
PR unite (30g)
7

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codexu/note-gen

Tutte le issue di codexu/note-gen

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.