{"record":{"id":"19a9dc98ada1a2df","repo":"Hmbown/CodeWhale","slug":"external-credential-consent-path-for-must-be-le","errorCode":null,"errorMessage":"external credential consent path for {} must be lexically normalized: {}","messagePattern":"external credential consent path for (.+?) must be lexically normalized: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/external_credentials.rs","lineNumber":403,"sourceCode":"                provider.as_str()\n            );\n        }\n        if self.source != source {\n            bail!(\n                \"external credential consent source mismatch for {} (expected {})\",\n                provider.as_str(),\n                source.as_str()\n            );\n        }\n        if !self.path.is_absolute() {\n            bail!(\n                \"external credential consent path for {} must be absolute\",\n                provider.as_str()\n            );\n        }\n        let normalized = resolve_external_credential_path(&self.path)?;\n        if normalized != self.path {\n            bail!(\n                \"external credential consent path for {} must be lexically normalized: {}\",\n                provider.as_str(),\n                quote_os_path(&self.path)\n            );\n        }\n        if self.path != resolved_path {\n            bail!(\n                \"external credential path changed for {}; consent covers {}, current path is {}\",\n                provider.as_str(),\n                quote_os_path(&self.path),\n                quote_os_path(resolved_path)\n            );\n        }\n        Ok(())\n    }\n\n    /// Validate and mint the read capability consumed by credential adapters.\n    /// No filesystem operation occurs while validating the policy.","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/config/src/external_credentials.rs#L385-L421","documentation":"Thrown by `ExternalCredentialConsentToml::validate_read_scope` when `resolve_external_credential_path` on the stored path differs from the stored path itself — i.e. the path contains `..`, redundant separators, or other components that lexical normalization would remove. Consent paths must be stored pre-normalized so string comparison against the resolved path is meaningful.","triggerScenarios":"A consent record's `path` contains non-normalized components such as `/home/u/../u/.secrets/key` or a trailing slash / double slash; `resolve_external_credential_path(&self.path)` returns a different string than `self.path`.","commonSituations":"User hand-edited the consent file pasting a path with `..` segments; a script constructed the path by string concatenation instead of canonicalizing first.","solutions":["Replace the consent record's `path` with its lexically normalized form (resolve `.`/`..` segments) — `resolve_external_credential_path` returns it.","Revoke and re-consent so the path is captured normalized.","Always run paths through the same resolver before persisting them."],"exampleFix":"// before (consent TOML)\npath = \"/home/alice/projects/../.codewhale/creds/google.json\"\n// after\npath = \"/home/alice/.codewhale/creds/google.json\"","handlingStrategy":"validation","validationCode":"fn is_normalized(p: &std::path::Path) -> bool {\n    // a path is lexically normalized iff resolving it yields the same string\n    resolve_external_credential_path(p).map(|n| n == *p).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match store.read_grant(provider, source, &path) {\n    Err(e) if e.to_string().contains(\"lexically normalized\") => {\n        let normalized = resolve_external_credential_path(&consent.path)?;\n        fix_consent_path(provider, normalized)?;\n    }\n    other => other,\n}","preventionTips":["Run every credential path through the resolver before storing it in consent records.","Avoid building paths by string concatenation with `..` segments.","Treat any non-normalized path as invalid at consent-creation time, not read time."],"tags":["config","credentials","consent","path"],"backgroundTag":"invalid-config-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}