Skip to content

feat(windows): expand %VAR% env vars in config paths, generalise temp dir check#127

Merged
shayne-snap merged 1 commit into
mainfrom
investigate/mid-review-issues
May 25, 2026
Merged

feat(windows): expand %VAR% env vars in config paths, generalise temp dir check#127
shayne-snap merged 1 commit into
mainfrom
investigate/mid-review-issues

Conversation

@shayne-snap
Copy link
Copy Markdown
Contributor

Summary

Two follow-up improvements from the Windows compatibility pass (PR #120):

1. Windows environment variable expansion in config paths

Adds so paths like and are resolved at config-load time.

2. Cross-platform temp directory detection

Extracts from the inline / checks. The new helper uses — which returns the correct temp root on all platforms (e.g. on Windows) — and falls back to the Unix hardcoded paths for safety.

Testing

  • config_file_windows_test.go — tests with , , and undefined vars (windows-only build tag)
  • rule_policy_windows_test.go — verifies Windows temp paths get external-directory exemption and non-temp paths still trigger approval (windows-only build tag)

… dir check

- Add expandWindowsPercentEnv to resolve %USERPROFILE%, %APPDATA%, etc.
  in config file path resolution on Windows.
- Extract pathInsideTrustedTemp helper that uses os.TempDir() for
  cross-platform temp directory detection, replacing hardcoded /tmp/
  and /private/tmp/ prefix checks.
- Add build-tagged Windows tests for both changes.
@shayne-snap shayne-snap merged commit df17511 into main May 25, 2026
2 checks passed
@shayne-snap shayne-snap deleted the investigate/mid-review-issues branch May 25, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant