FFFF security(S33B-E): tmpfs secret injection by tps-flint · Pull Request #44 · tpsdev-ai/cli · GitHub
[go: up one dir, main page]

Skip to content

security(S33B-E): tmpfs secret injection#44

Merged
heskew merged 4 commits intomainfrom
tmpfs-secrets
Feb 27, 2026
Merged

security(S33B-E): tmpfs secret injection#44
heskew merged 4 commits intomainfrom
tmpfs-secrets

Conversation

@tps-flint
Copy link
Contributor

Secrets no longer passed as Docker env vars (visible in docker inspect).

Host side (office.ts):

  • After container starts, writes each secret as a file in /run/secrets/ (tmpfs) via docker exec
  • Touches /run/secrets/.ready as sentinel

Container side (supervisor):

  • Waits up to 30s for /run/secrets/.ready
  • Reads all secret files into its own environment
  • Unlinks all files immediately — secrets exist only in process memory
  • Uses su -m to preserve env when dropping to agent user

Result: Secrets live in tmpfs briefly (milliseconds), then only in process memory. Not visible in docker inspect, not on disk.

Closes S33B-E from the security findings catalog.

Secrets no longer passed as Docker env vars (visible in docker inspect).

Host side (office.ts):
- After container starts, writes each secret as a file in /run/secrets/ (tmpfs)
  via docker exec. Touches /run/secrets/.ready as sentinel.

Container side (supervisor):
- Waits up to 30s for /run/secrets/.ready
- Reads all secret files into its own environment
- Unlinks all files immediately — secrets exist only in process memory
- Uses su -m to preserve env when dropping to agent user
- Agent inherits API keys via env but no files exist on any filesystem

Result: secrets live in tmpfs briefly (milliseconds), then only in
process memory. Not visible in docker inspect, not on disk.
CodeQL flagged clear-text logging of sensitive info. Secret values
were passed as docker exec arguments (visible in ps output) and
the error path could leak stderr content.

Fix: pipe secret values via stdin to 'cat > /run/secrets/KEY'.
Error message no longer includes the value. Secrets never appear
in process argument lists.
CodeQL tracks taint from API_KEY_VARS through to spawnSync input.
Extract to a dedicated function with clear intent — this is the
security boundary where secrets intentionally flow to the container.
@heskew heskew merged commit 34a91be into main Feb 27, 2026
10 checks passed
@heskew heskew deleted the tmpfs-secrets branch February 27, 2026 09:43
@tps-flint tps-flint mentioned this pull request Feb 27, 2026
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.

3 participants

0