{"record":{"id":"7002b492bd214b80","repo":"jdx/mise","slug":"url-must-not-start-with","errorCode":null,"errorMessage":"`url` must not start with `-`","messagePattern":"`url` must not start with `-`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/repos.rs","lineNumber":130,"sourceCode":"            // Join only the Normal segments so `./foobar` resolves to\n            // `<root>/foobar` rather than `<root>/./foobar` — a `.` component\n            // survives `Path::join` and leaks into every displayed path.\n            let mut resolved = root.to_path_buf();\n            for component in path.components() {\n                if let Component::Normal(segment) = component {\n                    resolved.push(segment);\n                }\n            }\n            resolved\n        };\n        let Some(url) = config.url.map(|s| s.trim().to_string()) else {\n            bail!(\"must set `url`\");\n        };\n        if url.is_empty() {\n            bail!(\"must set a non-empty `url`\");\n        }\n        if url.starts_with('-') {\n            bail!(\"`url` must not start with `-`\");\n        }\n        let git_ref = config.git_ref.map(|s| s.trim().to_string());\n        let git_ref = match git_ref {\n            Some(git_ref) if git_ref.is_empty() => bail!(\"`ref` must not be empty\"),\n            Some(git_ref) if git_ref.starts_with('-') => bail!(\"`ref` must not start with `-`\"),\n            other => other,\n        };\n        Ok(Self {\n            path_raw,\n            path,\n            url,\n            git_ref,\n        })\n    }\n}\n\nimpl std::fmt::Display for RepoRequest {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/repos.rs#L112-L148","documentation":"The trimmed `url` must not begin with `-`, because it is later passed to git as an argument and a leading dash would be parsed as an option/flag rather than a URL. This is an argument-injection guard.","triggerScenarios":"Calling from_toml with `url = \"--upload-pack=...\"` or any value starting with a hyphen.","commonSituations":"Adversarial or accidentally misplaced values (e.g. a flag pasted into the url slot); generated configs where fields got shifted.","solutions":["Move any git flags out of `url`; the url must be a repo URL or path.","If you need extra git options, check whether the repos module exposes a dedicated flags field.","Quote/inspect the config source to ensure field ordering was not scrambled."],"exampleFix":"// before\n[[repos]]\npath = \"repo\"\nurl = \"--depth=1 https://github.com/org/repo.git\"\n\n// after\n[[repos]]\npath = \"repo\"\nurl = \"https://github.com/org/repo.git\"","handlingStrategy":"validation","validationCode":"fn is_safe_url(url: &str) -> bool {\n    let u = url.trim();\n    !u.is_empty() && !u.starts_with('-')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat url fields as data, never as git flags","Keep git CLI options in dedicated config fields only","Audit generated configs for shifted field values"],"tags":["config","security","argument-injection"],"backgroundTag":"invalid-url","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}