fix(install-dir): make config field authoritative#109
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates install directory resolution so config.json’s install_dir becomes the authoritative source (ahead of STEPSECURITY_HOME), while also hardening scheduler installers (systemd/launchd) against malformed unit/plist output.
Changes:
- Flip install-dir precedence to: CLI
--install-dir>config.install_dir>STEPSECURITY_HOME> legacy default, and canonicalize viafilepath.Clean. - Add
paths.SetDisabled()for explicit--install-dir=behavior and update tests accordingly. - Improve scheduler installers: reject root systemd installs, escape systemd
Environment=values, and XML-escape launchd plist string fields.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/systemd/systemd.go |
Reject root installs; escape STEPSECURITY_HOME for systemd unit Environment=. |
internal/paths/paths.go |
Make config.InstallDir authoritative over env; add SetDisabled; clean resolved paths. |
internal/paths/paths_test.go |
Update precedence tests; add coverage for SetDisabled and canonicalization. |
internal/launchd/launchd.go |
XML-escape templated plist <string> values to avoid malformed plists. |
cmd/stepsecurity-dev-machine-guard/main.go |
Route --install-dir= through SetDisabled; update precedence commentary and logging setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ashishkurmi
approved these changes
May 26, 2026
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 does this PR do?
Type of change
Testing
./stepsecurity-dev-machine-guard --verbose./stepsecurity-dev-machine-guard --json | python3 -m json.toolmake lintmake testRelated Issues