tinyhumansai/openhuman · error

dest_path resolves outside the downloads root

Error message

dest_path resolves outside the downloads root

What it means

Belt-and-braces containment check: although the individual components passed, the final joined path failed to verify as living under <workspace>/<dest_subdir>, so the download is refused rather than written outside the jail.

Source

Thrown at src/openhuman/tools/impl/network/curl.rs:82

            match component {
                Component::Normal(_) => {}
                Component::CurDir => {}
                Component::ParentDir => {
                    anyhow::bail!("dest_path may not contain '..'");
                }
                Component::Prefix(_) | Component::RootDir => {
                    anyhow::bail!("dest_path must be relative");
                }
            }
        }

        let root = self.workspace_dir.join(&self.dest_subdir);
        let resolved = root.join(p);

        // Belt-and-braces: ensure the resolved path still lives under root.
        // Lexical check is sufficient because we already rejected `..`.
        if !resolved.starts_with(&root) {
            anyhow::bail!("dest_path resolves outside the downloads root");
        }

        Ok(resolved)
    }

    async fn validate_url(&self, raw_url: &str) -> anyhow::Result<String> {
        validate_url_with_dns_check(raw_url, &self.allowed_domains).await
    }

    fn default_filename_from_url(url: &str) -> String {
        let after_scheme = url.split_once("://").map(|(_, rest)| rest).unwrap_or(url);
        let path_part = after_scheme.split_once('/').map(|(_, p)| p).unwrap_or("");
        let last = path_part
            .split('?')
            .next()
            .unwrap_or("")
            .rsplit('/')
            .next()

View on GitHub (pinned to 7491200858)

Solutions

  1. Simplify dest_path to a normal relative filename and retry
  2. Report the input if a plain relative path still triggers this check, as it may indicate a path-normalization bug
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/network/curl.rs:82 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/06cfe583af3ddc18. Report an issue: GitHub.