Skip to content

Fix security review followups from #161#162

Merged
jeremy merged 2 commits intomainfrom
sec-audit-followup
Feb 27, 2026
Merged

Fix security review followups from #161#162
jeremy merged 2 commits intomainfrom
sec-audit-followup

Conversation

@jeremy
Copy link
Member

@jeremy jeremy commented Feb 27, 2026

Summary

Addresses the 3 unresolved review threads from #161 (second Copilot review pass after merge):

  • Symlink-safe trust boundary checksrepoConfigPath and localConfigPaths now resolve symlinks on CWD before comparing against the (already-resolved) boundary. Prevents the walk from escaping the trust boundary on systems where $HOME contains symlinks (e.g. /home/user/data/users/user).
  • Remove redundant RequireSecureURL call — The inner if profileName != "" re-check was dead code; cfg.BaseURL already reflects the post-profile value by that point.
  • Fix isConfigCmd docstring — Was concatenated onto the transformCobraError comment block. Now standalone above its function.

Test plan

  • make check passes (fmt, vet, lint, unit tests, e2e)
  • Existing TestRepoConfigPath_StopsAtHome, TestLocalConfigPaths_* tests exercise the symlink-resolved paths

- Resolve symlinks on CWD in repoConfigPath and localConfigPaths so
  trust-boundary comparisons are consistent (both sides now resolved)
- Remove redundant duplicate RequireSecureURL check after profile merge
- Fix isConfigCmd docstring placement (was fused with transformCobraError)
Copilot AI review requested due to automatic review settings February 27, 2026 23:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Follow-up security hardening and cleanup after #161, focused on making config trust-boundary checks robust against symlinked working directories and removing/repairing small correctness and documentation issues.

Changes:

  • Resolve symlinks for CWD before trust-boundary comparisons in repo/local config discovery.
  • Remove redundant HTTPS validation re-check after profile application.
  • Fix comment placement so isConfigCmd and transformCobraError docstrings are correctly attached.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
internal/config/config.go Resolves symlinks for CWD to strengthen trust-boundary comparisons when discovering repo/local config paths.
internal/cli/root.go Removes dead/redundant RequireSecureURL logic and fixes docstring placement for helper functions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

repoConfigPath and localConfigPaths now return empty/nil when
EvalSymlinks(cwd) fails, rather than falling back to the unresolved
path. Prevents trust-boundary bypass under unusual filesystem conditions.
@jeremy jeremy merged commit be39d6a into main Feb 27, 2026
10 of 11 checks passed
@jeremy jeremy deleted the sec-audit-followup branch February 27, 2026 23:25
@jeremy jeremy added the bug Something isn't working label Feb 28, 2026
@jeremy jeremy mentioned this pull request Feb 28, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants