{"record":{"id":"084b59fe60bbda8b","repo":"vectordotdev/vector","slug":"expected-a-deprecation-slug-e-g-azure-monitor-logs-sink-not","errorCode":null,"errorMessage":"expected a deprecation slug (e.g. \"azure-monitor-logs-sink\"), not a path: {}","messagePattern":"expected a deprecation slug \\(e\\.g\\. \"azure-monitor-logs-sink\"\\), not a path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/deprecation/enact.rs","lineNumber":29,"sourceCode":"pub struct Cli {\n    /// Filename (slug) in deprecation.d/ to enact, e.g. \"azure-monitor-logs-sink\"\n    slug: String,\n\n    /// The Vector version in which this feature was removed, e.g. \"0.58.0\".\n    /// Defaults to the next minor after the latest git tag.\n    #[arg(long)]\n    version: Option<Version>,\n}\n\nimpl Cli {\n    pub fn exec(self) -> Result<()> {\n        let repo_root = paths::find_repo_root()?;\n        let dir = repo_root.join(deprecation::DEPRECATION_DIR);\n\n        // Accept \"slug\" or \"slug.md\"; reject path-like inputs to keep the\n        // identifier unambiguous (and the file lookup safe).\n        if self.slug.contains('/') || self.slug.contains('\\\\') {\n            bail!(\n                \"expected a deprecation slug (e.g. \\\"azure-monitor-logs-sink\\\"), not a path: {}\",\n                self.slug\n            );\n        }\n        let stem = self.slug.strip_suffix(\".md\").unwrap_or(&self.slug);\n        let filename = format!(\"{stem}.md\");\n\n        let path = dir.join(&filename);\n        if !path.exists() {\n            bail!(\"No deprecation fragment found at {}\", path.display());\n        }\n\n        // Parse the fragment to get entry data.\n        let entries = deprecation::read_deprecation_fragments(&dir)?;\n        let entry = entries\n            .into_iter()\n            .find(|e| e.filename == filename)\n            .ok_or_else(|| anyhow::anyhow!(\"Could not parse {filename}\"))?;","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/deprecation/enact.rs#L11-L47","documentation":"Thrown by `cargo vdev deprecation enact` (exec) when the slug argument contains a path separator ('/' or '\\\\'). The command expects a bare deprecation slug (optionally with .md suffix) so the identifier stays unambiguous and the file lookup remains safe (path-traversal guard).","triggerScenarios":"Running `cargo vdev deprecation enact path/to/fragment` or `enact ..\\\\fragment` — any slug where self.slug.contains('/') or contains('\\\\').","commonSituations":"Users paste a full file path or relative path copied from an editor or shell completion instead of just the fragment slug like azure-monitor-logs-sink.","solutions":["Pass only the slug: `cargo vdev deprecation enact azure-monitor-logs-sink`.","Strip directories and the .md extension from the path before invoking.","Run from the repo root and let the command resolve the fragment directory itself.","Use shell tab-completion on fragment names, not file paths."],"exampleFix":"// before\ncargo vdev deprecation enact changelog.d/azure-monitor-logs-sink.md\n// after\ncargo vdev deprecation enact azure-monitor-logs-sink","handlingStrategy":"validation","validationCode":"let slug = \"changelog.d/azure-monitor-logs-sink.md\";\nlet slug = std::path::Path::new(slug).file_stem().unwrap().to_str().unwrap();\nassert!(!slug.contains('/') && !slug.contains('\\\\'), \"pass a bare slug, not a path\");","typeGuard":"fn is_bare_slug(s: &str) -> bool { !s.is_empty() && !s.contains('/') && !s.contains('\\\\') }","tryCatchPattern":"match result { Err(e) if e.to_string().contains(\"not a path\") => { eprintln!(\"Use just the slug, e.g. azure-monitor-logs-sink\"); } Err(e) => return Err(e), Ok(v) => v }","preventionTips":["Copy slugs, not file paths, from listings","Never wrap slugs in shell paths or quotes with directories","Remember .md suffix is optional; directories never are"],"tags":["cli","deprecation","path-injection"],"backgroundTag":"invalid-argument-format","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}