{"record":{"id":"1275103b518597d2","repo":"block/buzz","slug":"token-disk-cache-disabled-on-non-unix-no-owner-on","errorCode":null,"errorMessage":"token disk cache disabled on non-Unix (no owner-only DACL)","messagePattern":"token disk cache disabled on non-Unix \\(no owner-only DACL\\)","errorType":"exception","errorClass":"io::Error (Unsupported)","httpStatus":null,"severity":"error","filePath":"crates/buzz-agent/src/auth.rs","lineNumber":1833,"sourceCode":"    let mut body = Vec::new();\n    file.read_to_end(&mut body)?;\n    Ok(body)\n}\n\n/// Non-Unix: token persistence and reading are both disabled until a\n/// Windows-specific owner-only DACL is implemented. Any legacy token file\n/// left by an older build (written with default ACLs) is deleted\n/// opportunistically so the exposed artifact cannot be served by new builds.\n/// Returns an error so [`read_cache`] yields `None`, giving a consistent\n/// memory-only cache on non-Unix.\n#[cfg(not(unix))]\nfn read_private_cache(path: &Path) -> io::Result<Vec<u8>> {\n    // Best-effort removal of any legacy file. Errors are ignored — either the\n    // file does not exist (normal case) or it cannot be removed (no worse\n    // than before — the DACL story is still broken, but that is the pre-fix\n    // state we are trying to retire).\n    let _ = fs::remove_file(path);\n    Err(io::Error::new(\n        io::ErrorKind::Unsupported,\n        \"token disk cache disabled on non-Unix (no owner-only DACL)\",\n    ))\n}\n\n/// Removes a temp file on drop unless it was already renamed away. Keeps a\n/// failed/partial write from leaving a stray token file behind.\nstruct TmpFileGuard<'a>(&'a Path);\n\nimpl Drop for TmpFileGuard<'_> {\n    fn drop(&mut self) {\n        let _ = fs::remove_file(self.0);\n    }\n}\n\n/// A per-write-unique temp suffix so concurrent savers — sibling threads or\n/// separate processes sharing `$HOME` — never collide on one temp path.\n/// Falls back to a timestamp if the RNG is unavailable rather than panicking","sourceCodeStart":1815,"sourceCodeEnd":1851,"githubUrl":"https://github.com/block/buzz/blob/dad5a33865fc81a2e55b3b60746632f615ec1e3a/crates/buzz-agent/src/auth.rs#L1815-L1851","documentation":"Raised in read_private_cache on non-Unix platforms (cfg(not(unix))): token persistence and reading are deliberately disabled until a Windows owner-only DACL implementation exists, because files written with default ACLs would expose the auth token to other local users. The function also opportunistically deletes any legacy token file left by older builds and returns this error, which makes read_cache yield None so the agent falls back to a memory-only token cache. This is an intentional policy guard, not an unexpected failure.","triggerScenarios":"Thrown at crates/buzz-agent/src/auth.rs:1833 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Accept memory-only token caching on non-Unix platforms — re-authentication will occur per process lifetime","Implement a Windows owner-only DACL writer to enable secure on-disk token caching","Ensure no token file is relied upon on Windows; the function deletes legacy files by design"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"dad5a33865fc81a2e55b3b60746632f615ec1e3a","analyzedAt":"2026-09-05T18:13:50.666Z","contentChangedAt":"2026-09-05T18:13:50.666Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}