{"record":{"id":"f222196f51535f91","repo":"sigoden/dufs","slug":"invalid-auth-value-paths","errorCode":null,"errorMessage":"Invalid auth value `@{paths}","messagePattern":"Invalid auth value `@(.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/auth.rs","lineNumber":80,"sourceCode":"                split_account_paths(rule).ok_or_else(|| anyhow!(\"Invalid auth `{rule}`\"))?;\n            if account.is_empty() {\n                if annoy_paths.is_some() {\n                    bail!(\"Invalid auth, no duplicate anonymous rules\");\n                }\n                annoy_paths = Some(paths)\n            } else if let Some((user, pass)) = account.split_once(':') {\n                if user.is_empty() || pass.is_empty() {\n                    bail!(\"Invalid auth `{rule}`\");\n                }\n                account_paths_pairs.push((user, pass, paths));\n            }\n        }\n        let mut anonymous = None;\n        if let Some(paths) = annoy_paths {\n            let mut access_paths = AccessPaths::default();\n            access_paths\n                .merge(paths)\n                .ok_or_else(|| anyhow!(\"Invalid auth value `@{paths}\"))?;\n            anonymous = Some(access_paths);\n        }\n        let mut users = IndexMap::new();\n        for (user, pass, paths) in account_paths_pairs.into_iter() {\n            let mut access_paths = AccessPaths::default();\n            access_paths\n                .merge(paths)\n                .ok_or_else(|| anyhow!(\"Invalid auth value `{user}:{pass}@{paths}\"))?;\n            if let Some(anon_ap) = &anonymous {\n                let orig_user = access_paths.clone();\n                access_paths.absorb_anon(\n                    anon_ap,\n                    &orig_user,\n                    AccessPerm::IndexOnly,\n                    AccessPerm::IndexOnly,\n                );\n            }\n            if pass.starts_with(\"$6$\") {","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/sigoden/dufs/blob/fe7fd564f80dfbac361c8e0589c3845638149d38/src/auth.rs#L62-L98","documentation":"`Auth::new` builds anonymous-access permissions by merging the value after `@` in an `--auth` entry into `AccessPaths`. `AccessPaths::merge` returns None when the path string cannot be parsed into valid access rules, so the server refuses to start rather than running with wrong permissions. The offending raw string is embedded in the message for diagnosis.","triggerScenarios":"Passing an auth value like `user:pass@*` or `@<bad-rule>` where the part after `@` is not a valid path/rule spec (e.g. `@@`, empty path section, malformed rule syntax unrecognized by AccessPaths::merge).","commonSituations":"Typos in the `--auth` CLI flag; quoting/shell-expansion mangling the value; using rule syntax from a different tool version; Windows path separators or drive letters confusing the parser.","solutions":["Check the string after `@` in the auth value; make sure it is one or more valid access paths/rules (e.g. `/:rw`, `public@/:ro`).","Quote the whole `--auth` value so the shell does not split or expand it.","Consult `AccessPaths::merge` in src/auth.rs for the accepted syntax and match it exactly.","Remove the `@`-suffix entry or use a bare path if anonymous access is not needed."],"exampleFix":"// before\n--auth @**  (invalid rule text after @)\n// after\n--auth @/:rw","handlingStrategy":"validation","validationCode":"fn is_valid_paths(paths: &str) -> bool { // mirror AccessPaths::merge acceptance\n    !paths.is_empty() && paths.chars().all(|c| c.is_ascii() && c != ' ')\n}\nif !is_valid_paths(anon_spec) { eprintln!(\"bad auth value @{}\", anon_spec); std::process::exit(2); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote all --auth values in shell scripts","Test auth flags with a dry run before deploying","Keep path rules to documented syntax like /:rw or /:ro","Avoid shell globs inside auth strings"],"tags":["rust","authentication","config-validation","cli"],"backgroundTag":"invalid-config-value","analyzedSha":"fe7fd564f80dfbac361c8e0589c3845638149d38","analyzedAt":"2026-09-09T13:01:22.843Z","contentChangedAt":"2026-09-09T13:01:22.843Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}