mirror of
https://github.com/block/buzz.git
synced 2026-10-28 21:11:48 +00:00
feat(buzz-agent): persist the OAuth token cache owner-only on Windows
On Windows the token cache was memory-only because std has no way to set an owner-only DACL, and the Win32 calls need `unsafe`, which buzz-agent forbids. Each process therefore ran its own sign-in, and Databricks stayed gated off on Windows in the desktop app. The new buzz-private-file crate holds that FFI behind a safe API, so buzz-agent keeps `forbid(unsafe_code)` on every platform: - `create_new` creates a file with the protected DACL `D:P(A;;FA;;;OW)` set atomically at creation, the Windows counterpart of `mode(0o600)`. - `open_owned` opens without following a final link, refuses anything but a regular file owned by the process's default owner, and then re-applies that DACL on the open handle, like the Unix `O_NOFOLLOW` + `fchmod` repair. auth.rs now persists and reads the cache on Windows through these, with the same temp-file + rename lifecycle as Unix. Tests that were Unix-only only because Windows had no disk cache now run on both, and Windows CI runs the helper crate (including its elevated planted-owner and symlink tests) plus the buzz-agent token-cache unit tests. Signed-off-by: Pinky <5f5ab050ec58ae208332edd544ebf705221e24c1b86d82a6ca07038a7a8f6ac9@buzz.block.builderlab.xyz>
This commit is contained in:
25
.github/workflows/_ci-rust.yml
vendored
25
.github/workflows/_ci-rust.yml
vendored
@@ -154,20 +154,23 @@ jobs:
|
||||
- name: Test (ACP launch-prefix platform contract)
|
||||
# Execute the non-Unix refusal branch; a cross-compile cannot test it.
|
||||
run: cargo test -p buzz-acp --target $env:TARGET --lib acp::launch::platform_tests
|
||||
- name: Test (owner-only private files)
|
||||
# The Win32 DACL code behind buzz-agent's token cache. The ignored
|
||||
# tests plant a foreign-owned file and a symlink, which needs the
|
||||
# runner's elevated shell.
|
||||
run: cargo test -p buzz-private-file --target $env:TARGET -- --include-ignored
|
||||
- name: Test (buzz-agent auth coordinator)
|
||||
# The auth coordinator single-flights on an OS advisory lock, which is
|
||||
# LockFileEx on Windows; this integration suite drives real second
|
||||
# processes on the same lock file, so it only exercises the Windows
|
||||
# lock runtime if it runs ON Windows. Every other job compiles it but
|
||||
# never executes it. Tests exercised on Windows: lock serialization
|
||||
# (two coordinators race for the same key), cooldown sidecar sharing
|
||||
# across processes, attempt-sidecar adoption (UserInitiated waiter
|
||||
# adopts a predecessor's denial), and the in-process single-flight for
|
||||
# same-key coalescing. Tests that are UNIX-ONLY and NOT executed here:
|
||||
# crash-release (flock drop on SIGKILL, guarded by #[cfg(unix)]) and
|
||||
# cross-process cache success/race (on-disk token handoff, also
|
||||
# #[cfg(unix)]).
|
||||
# LockFileEx on Windows, and hands tokens across processes through the
|
||||
# owner-only disk cache. This integration suite drives real second
|
||||
# processes on the same lock and cache files, so it only exercises the
|
||||
# Windows runtime if it runs ON Windows. Every other job compiles it but
|
||||
# never executes it.
|
||||
run: cargo test -p buzz-agent --target $env:TARGET --test databricks_auth_coordinator
|
||||
- name: Test (buzz-agent token cache)
|
||||
# Disk cache reuse, joiner recovery and concurrent savers through the
|
||||
# Windows owner-only cache path.
|
||||
run: cargo test -p buzz-agent --target $env:TARGET --lib -- auth::tests databricks::tests
|
||||
# Smoke-test the new host-prereq contract: Git for Windows (which provides
|
||||
# bash) is available on the runner, a shell command round-trips, and bash
|
||||
# does NOT resolve from System32 (so WSL's launcher is never picked up).
|
||||
|
||||
Reference in New Issue
Block a user