Repository navigation
fix(openbao-env): 🐛 remove every temp file when openbao-env exits - #130
Merged
Merged
Conversation
tmpfile was called as $(tmpfile): a subshell, so the parent never recorded the files and the EXIT trap removed none of them. Curl bodies and token headers stayed in /dev/shm/openbao. Temp files now live in one per-run directory created in the parent and removed on EXIT, INT, TERM and HUP; directories older than 2 minutes (SIGKILL, or left by 1.0.0) are purged.
✅ PR Validation Passed
📋 Pipeline Status
🤖 Generated by @helpers4 CI • 2026-11-06 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
openbao-env1.0.0 left its temp files (curl response bodies,X-Vault-Tokenheader files) in/dev/shm/openbaoas.tmp.*. Reported from an end-to-end run on fajro: 8 leftovers after the firstdevcontainer up. Some may hold tokens. They stay in memory with mode 600, owned by the remote user, but must not stay around.Cause:
tmpfilewas called asx="$(tmpfile)". A command substitution runs in a subshell, so the file was added to the subshell'sTMP_FILESand the parent's EXIT trap had nothing to remove. Every fetch leaked all of its temp files.Fix (v1.0.1):
/dev/shm/openbao/.tmp.XXXXXX, created in the parent process (tmpfilenow returns the path inREPLY). It is removed on EXIT, and INT/TERM/HUP now exit through that trap.token.newleft behind)..tmp.*entries older than 2 minutes: SIGKILLed runs, and what 1.0.0 left.Type of Change
How Has This Been Tested?
dev_server.shnow asserts that no.tmp.*is left after the first load, and after 4 concurrent login shells (one fetches, the others wait for the lock).test.shanddev_server.shpass locally in the built base:ubuntu image.Checklist
🤖 Generated with Claude Code