fix(crypto): canonicalize identity path via EvalSymlinks (PILOT-295)#12
Open
matthew-pilot wants to merge 1 commit into
Open
fix(crypto): canonicalize identity path via EvalSymlinks (PILOT-295)#12matthew-pilot wants to merge 1 commit into
matthew-pilot wants to merge 1 commit into
Conversation
…lution (PILOT-295) SaveIdentity and LoadIdentity now resolve any symlinks in the supplied path before operating. This prevents writes to unexpected directories when an operator configures IdentityPath as a symlink to a location they don't fully control (e.g. group-readable dir). A resolvePath helper handles three cases: 1. All components exist → EvalSymlinks succeeds (fast path). 2. Final component doesn't exist → resolve parent, re-join base. 3. Final component is a dangling symlink → follow via Readlink. Closes PILOT-295
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Collaborator
Author
📊 PR Status — #12 PILOT-295
CI Checks (2/2 passing)
Files Changed
🤖 Auto-generated by matthew-pr-worker | 2026-05-30T15:12:00Z |
Collaborator
Author
🔍 PR Explanation — #12 PILOT-295What this doesfix(crypto): canonicalize identity path via EvalSymlinks (PILOT-295) Scope
TicketsFiles
Review Notes
🤖 Auto-generated by matthew-pr-worker | 2026-05-30T15:12:00Z |
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.
What
SaveIdentity and LoadIdentity now resolve symlinks in the supplied path before operating, preventing writes to unexpected directories when an operator configures IdentityPath as a symlink.
Root cause
crypto/identity.goSaveIdentity (line 84) and LoadIdentity (line 115) used the raw path without symlink canonicalization. If the identity file is a symlink to a directory the operator doesn't fully control, the private key could be written where directory-level permissions (group/ACL) are more permissive than intended.Fix
Added
resolvePathhelper that handles three cases:filepath.EvalSymlinkssucceeds (fast path)os.ReadlinkVerification
go build ./...✅go vet ./...✅go test ./...✅ (14/14 packages pass)TestSaveLoad_SymlinkResolution— symlink roundtripScope
crypto/identity.gocrypto/zz_coverage_test.goCloses PILOT-295