trackslash
VAULT-138 P2 For an agent

Fix the entitlements checks, which read the first entitlements a cache ever recorded

0
All issues

Description

Found 2026-10-12, validating #744 (VAULT-134). Nothing in that PR touches entitlements.

The bug

checkSignedEntitlements in local-check.config.ts runs codesign --display --xml --entitlements <cacheDir>/<name>-entitlements.plist <bundle>, then reads the file back with plutil.

codesign appends to an existing file rather than replacing it, and plutil reads only the first plist in the file. The cache directory is kept across runs of the same branch. So from its second run, a worktree's check reads the entitlements from that worktree's first run, not the build it has just made.

I confirmed this by hand: writing a clean extension's entitlements onto a copy of the cached file grew it from 1951 to 2760 bytes, and plutil still showed the old entries.

This affects every checkSignedEntitlements call: the Mac app, AutoFill and widget extensions, and probably the iOS simulator checks if they use the same helper.

Effects

  • False failures. In #744's run at 19:57, the AutoFill extension in Vault.app/Contents/PlugIns/ really did carry Xcode's testing exceptions. That run reused DerivedData from an earlier run, and the plain build skipped re-copying the extension after the test build. The exceptions were:
    • com.apple.security.temporary-exception.files.absolute-path.read-only
    • com.apple.security.temporary-exception.mach-lookup.global-name
  • Every later run then failed on the cached copy, even after a clean build whose extension had no exceptions. Deleting <cacheDir>/*-entitlements.plist got past it.
  • Silent passes, which matter more. A worktree whose first run was clean keeps passing this check even if a later commit adds an entitlement. So the security check doesn't protect what it's meant to on any branch validated more than once.

Fix

  • Delete the plist before each codesign call, or have codesign write to stdout (--entitlements -) and parse that.
  • Separately, make the build the check reads always embed freshly signed extensions. For example, delete Debug/Vault.app before its xcodebuild build, or check a Release build, which is what ships.
  • Add a regression check if practical: run the helper twice on two bundles with different entitlements and expect different results.

Sub-issues

0

Linked issues

0

GitHub

0

No branches or pull requests linked.

Comments

2
Bradley

Fixed by #764 (2e3bf6f8, "Make the entitlement checks read this build's entitlements"), which is on main. Closing at Bradley's request on 2026-11-14; the ticket was left open only because nobody marked it done.

Bradley

Fixed by #764 (2e3bf6f8, 2026-10-20), which covers both parts of the fix:

  • Each checkSignedEntitlements call deletes its <name>-entitlements.plist before codesign writes it, and the simulator check does the same with its -simulator-entitlements.plist (local-check.config.ts, around lines 271–274 and 410–411).
  • The check deletes Build/Products/Debug/<bundle> before its build, so it always reads freshly signed extensions.

Every validation since has read that run's own entitlements, including #766 and #767 on 2026-11-09. The optional regression check (running the helper twice on two bundles) wasn't added. Closing.