Fix security issues in find-wild and temp file handling#8
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens CLAI’s tool execution and on-disk data handling by removing eval from find-wild, moving persistent history into an XDG state directory, and switching predictable /tmp artifacts to per-session mktemp files with cleanup.
Changes:
- Remove
evalfromtools/find-wild.shand add basic directory validation before runningfind. - Store persistent history under
${XDG_STATE_HOME:-~/.local/state}/clai/and write payload/response/tool logs to securemktempfiles tracked for cleanup on exit. - Add Bats coverage for
find-wildbehavior and for transient temp-file cleanup on transport failures.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/find-wild.sh | Replaces eval-based find invocation with direct execution and directory validation. |
| clai.sh | Introduces XDG state dir, secure temp session files, and EXIT cleanup hook; updates logging/payload/response/history paths. |
| test/smoke.bats | Ensures CLAI creates state dir and cleans up temp session files after failures. |
| test/find_wild.bats | Adds regression tests for the updated find-wild behavior. |
| README.md | Documents new state/temp-file behavior and updates credits/test descriptions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
evalfrom thefind-wildtool and validate the search path/tmpfilesmktempsession files and clean them up on exitfind-wildfix and session-file cleanup behaviorVerification
make lintmake testFixes #1
Fixes #2