[AUTOMATION] fix(clawpatch): address daily finding#270
Open
michiosw wants to merge 1 commit into
Open
Conversation
3ef4f9c to
26e539e
Compare
Greptile SummaryThis PR hardens Guard daemon startup and local runtime socket directory handling. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(clawpatch): address daily finding" | Re-trigger Greptile |
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.

Where We Are
The local Guard runtime accepts any existing socket parent directory under
/tmpas long asos.MkdirAllsucceeds. If that directory is a symlink or belongs to another uid, the daemon can remove and bindkontext.sockinside an untrusted path.Where We Want To Go
The local Guard runtime should only bind its socket inside a real directory owned by the current user, with
0700permissions. That keeps the Guard socket path under the same ownership rules as managed observe.How do we get there
Mirror the managed-observe socket-directory checks in
internal/localruntime.EnsureSocketDir: reject symlink parents, reject non-directories, require the current uid, and tighten permissions back to0700when needed. Add focused localruntime tests for writable-directory tightening, non-directory rejection, and symlink rejection. Verified withgo test ./...,go vet ./...,npm exec --yes --package pnpm@10.0.0 -- pnpm install --frozen-lockfile,npm exec --yes --package pnpm@10.0.0 -- pnpm --dir web/guard-dashboard typecheck, andgit diff --checkfrom the isolated checkout.