Skip to content

Expire idle Touch ID sessions and add a caller hint to the prompt - #1333

Open
theoephraim wants to merge 1 commit into
mainfrom
fix-session-expiry
Open

theoephraim wants to merge 1 commit into
mainfrom
fix-session-expiry

Conversation

@theoephraim

Copy link
Copy Markdown
Member

What

  • Idle expiry for Touch ID sessions (macOS helper). keychain() reads only checked that a cached LAContext existed for the session, so one approval lasted until varlock lock, sleep, screen lock, or the daemon exiting. The daemon now tracks when each session was last used and drops it after 5 minutes of inactivity. Each gated read or decrypt extends the session. sessionWarm and the menu bar state now reflect this.
  • Short caller hint in the prompt. The Touch ID reason now names the project folder and the AI agent when one is detected from the caller's environment (Claude Code, Codex), e.g. "Varlock is trying to decrypt secrets for my-api (requested by Claude Code)". Kept to one short phrase on purpose. It comes from the caller's environment, so it is a hint, not a verified identity.
  • Docs: the macOS Keychain page now mentions the 5 minute idle window.

Notes

  • varlock() decrypts may still be re-prompted by macOS on its own schedule for Secure Enclave key operations. We don't control that while using the SE key directly; the local encryption v2 work addresses it.
  • Tested locally on macOS with a temporary 30s timeout: repeated reads kept the session alive with no prompt, and an idle gap past the timeout prompted again.

keychain() reads only checked that a cached LAContext existed, so an approval
lasted until lock, sleep, or daemon exit. The daemon now tracks when each
session was last used and drops it after 5 minutes of inactivity. Each gated
use extends the session. sessionWarm now reflects this expiry.

The prompt reason now names the project folder and the AI agent (Claude Code,
Codex) when detected from the caller's environment. These are hints only,
since a same-user process can fake them.
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

bumpy-frog

The changes in this PR will be included in the next version bump.

patch Patch releases

  • @varlock/native-helper-darwin 1.24.0 → 1.24.1
  • varlock 1.25.0 → 1.25.1 (cascade)

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No blocking issues. One non-blocking finding below.

Approach: Explicit idle expiry at the shared authentication gate is appropriate for keychain reads, and caller hints remain separate from authorization.

Reviewed changes include all six changed files and their authentication, IPC, and menu-bar callers.

  • Session expiry: Cached contexts expire after five minutes without gated use; authentication refreshes their timestamps, and warm-state queries exclude expired sessions.
  • Prompt hints: IPC forwards the caller PID so prompts can include a bounded project-folder name and detected agent label from its environment.
  • Documentation and release: The Keychain documentation describes idle expiry, and the macOS native helper receives a patch bump.

Swift syntax parsing passed. macOS authentication and menu-bar behavior could not be exercised on this Linux runner.

Non-blocking

  • P2: The menu-bar icon stays unlocked after idle expiry. The expiry-aware state query is only reflected when the icon is refreshed by a successful gated operation, explicit lock, or opening the menu. After the last session idles out, the icon therefore remains unlocked until another event occurs; schedule a refresh when the last active session expires.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Dec 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@env-spec/parser@1333
npm i https://pkg.pr.new/varlock@1333
npm i https://pkg.pr.new/@varlock/native-helper-darwin@1333

commit: d9ff073

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
varlock-website d9ff073 Commit Preview URL

Branch Preview URL
Dec 04 2026, 09:27 PM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant