Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: request_secret file delivery leaves plaintext secrets on disk for up to ~25 hours, long enough to end up in regular backups #48078

Openk6lcm(GitHub profile, opens in a new tab) opened this issue 0 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Have an agent call request_secret with delivery: "file" (for example, for a sudo password) and enter the value in the secret card.
  2. The agent runs its command using the returned file path.
  3. Look in <secret store>/files/ afterwards: the file is still there, holding the value in plain text.
  4. Run your regular backup (hourly or daily snapshots, file versioning, cloud sync of the home folder, etc.).

Expected behavior

A secret delivered as a file stays on disk only as long as the command needs it, and is kept somewhere backup tools skip, so it never ends up in backups.

Actual behavior

SecretRequests.ts writes the value in plain text to <store>/files/<id> (mode 600) inside the user's persistent T3 data folder. Nothing deletes it after use. The hourly sweepExpiredFiles job removes it only once it is older than SECRET_REF_TTL_MS (24 h), so it can stay on disk for about 25 hours. The folder isn't marked to be skipped by backup tools.

Impact: anyone with a responsible backup schedule will almost certainly back up the secret before the sweep deletes it. A sudo password or API token then lives on in backups for as long as they're kept, often months or years. Until the sweep runs, any process running as the user can also read the file.

Suggested fixes:

  1. Delete the delivered file within minutes rather than 24 h, or let the agent signal that it's done so the file can be deleted right away.
  2. Write delivered secrets somewhere backup tools normally skip, such as a per-user temporary or runtime folder (for example $XDG_RUNTIME_DIR on Linux), instead of the persistent data folder. Also mark the folder to be skipped where the operating system supports it, e.g. a CACHEDIR.TAG file or the system backup tool's exclusion setting.
  3. Tell the user on the secret card where the value will be saved and how long it will stay.

Related: #34318 (same feature, different problem), #47230 (other plaintext secret).

Impact

Major degradation or frequent failure

Version or commit

0.1.13

Environment

T3 Code desktop, Claude provider

Logs or stack traces

No response

  1. tanstack-source added labelsbug

Sign in to join this conversation.