CodeWhale icon indicating copy to clipboard operation
CodeWhale copied to clipboard

agy_credentials tests fail on every macOS run: the secure-open walk refuses symlinks at every path component, and /var is one

Open Lstarsky0 opened this issue 3 months ago • 1 comments

The four agy_credentials tests fail on every macOS run — CI and local, same error every time. Not a flake: the cause is that open_secure_regular_file refuses a symlink at any path component, and macOS temp directories live under one.

called `Result::unwrap()` on an `Err` value: securely opening external credential file
  "/var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/.tmpo51cH0/state.vscdb"

That is CI's macOS leg on job 94822801166 — 10454 passed, these 4 failed. My machine produces the same four with the same message and the same /var/folders/... path shape.

Cause

external_credentials.rs:100 documents the boundary as:

Open the exact granted file through the secure boundary (regular file only, no symlink/reparse leaf)

but the walk in open_secure_regular_file applies O_NOFOLLOW to every component, not just the leaf:

let flags = if leaf {
    libc::O_RDONLY | libc::O_CLOEXEC | libc::O_NOFOLLOW | libc::O_NONBLOCK
} else {
    libc::O_RDONLY | libc::O_CLOEXEC | libc::O_NOFOLLOW | libc::O_DIRECTORY
};

On macOS /var is a symlink:

$ ls -ld /var
lrwxr-xr-x  1 root  wheel  11 /var -> private/var

and TempDir hands back /var/folders/…, so the very first component fails:

$ openat("/", "var", O_RDONLY|O_DIRECTORY|O_NOFOLLOW)
ENOTDIR (Not a directory)

Linux and Windows temp paths have no symlinked component, which is exactly the platform split in the results.

So either the doc comment is describing the intent and the code is stricter than meant, or the code is right and the comment needs to say "no symlink anywhere in the path". Worth deciding before patching, since it changes what the fix is — canonicalizing the fixture path in the tests, or relaxing the walk above the credential root while still refusing the leaf.

Blast radius

Real installs are probably fine: the path comes from ~/Library/Application Support/Antigravity (config/src/external_credentials.rs:217), and a default macOS home has no symlinked component. But the same walk rejects any home reached through one — a home relocated to an external volume, or /tmp (also -> private/tmp) if anything ever grants a path there.

Not the #5355 basket

Flagging this because the attribution came up on #5384: agy_credentials is not in #5355's issue body, and #5355 is described as parallel-load and config-fixture flakes. These four fail alone, fail every time, and arrived with 531b64ed9 in v0.9.8. Treating them as known flakes would park a deterministic macOS-only failure in a basket scheduled for later.

Happy to send whichever fix you prefer once the doc-vs-code question is settled.

Lstarsky0 avatar Aug 15 '26 05:08 Lstarsky0

Thanks @Lstarsky0 for the report.

This issue is staying open for maintainer triage. CodeWhale gets better because people bring us real edge cases from real machines, providers, regions, and workflows.

If you can add a reproduction, logs, version output, screenshots, or the provider/model involved, that makes it much easier for us to verify and harvest the fix. Maintainers may comment /lgtmi to mark recurring issue reporters as approved so this intake note is skipped next time.

github-actions[bot] avatar Aug 15 '26 05:08 github-actions[bot]