Fix settingsOverrideScriptPath crash when path contains a space - #389
Open
PeetMcK wants to merge 1 commit into
Open
Fix settingsOverrideScriptPath crash when path contains a space#389PeetMcK wants to merge 1 commit into
PeetMcK wants to merge 1 commit into
Conversation
cliTask's single-string overload splits the command by " " to derive
launchPath, so a settingsOverrideScriptPath like
/Library/Application Support/vendor/xcreds-override-helper
becomes launchPath="/Library/Application", arguments=["Support/vendor/...
xcreds-override-helper"]. NSConcreteTask then throws
*** NSInvalidArgumentException: launch path not accessible
from `DefaultsOverride.refreshCachedPrefs()` during plugin init, which
takes down the SecurityAgent auth chain — loginwindow hangs on a black
screen with no XCreds UI on every full logout cycle.
The cliTask backslash-escape branch can't rescue this caller because
the preceding `FileManager.fileExists(atPath:)` validation in
`refreshCachedPrefs()` runs on the raw string. A backslash-escaped
path satisfies cliTask but fails fileExists; an unescaped path
satisfies fileExists but crashes cliTask. There is no value of
settingsOverrideScriptPath that works when the helper lives under
a path with a space — including Apple's conventional
`/Library/Application Support/<vendor>/` install location.
Fix: call the existing `arguments: [String]?` overload with an empty
array so cliTask takes its no-split branch and uses the command
verbatim as launchPath. settingsOverrideScriptPath is documented as
the *path* to the helper (not a shell command line), so callers that
relied on undocumented space-splitting were always wrong.
Reproduced on macOS 26.4.1 (arm64). Verified the fix on the same
configuration with the helper at
`/Library/Application Support/lithiumbridge/xcreds-override-helper`.
Single-line change to DefaultsOverride.swift; no API surface impact.
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.
Summary
Found this bug when trying to locate my
settingsOverrideScriptPathin/Library/Application Support.DefaultsOverride.swift:69callscliTask(prefScriptPath). The single-string overload splitscommandon" "to derivelaunchPath(UNIXUtilities.swift:29), corrupting anysettingsOverrideScriptPaththat contains a space.NSConcreteTaskthen throwslaunch path not accessible, crashing the plugin duringrefreshCachedPrefs()and stalling the auth chain.The backslash-rebuild branch in
cliTaskcan't rescue this caller —refreshCachedPrefspre-validates withFileManager.fileExists(atPath:)on the raw string, so an escaped path fails fileExists and an unescaped path crashes cliTask.Fix
Takes the existing
arguments != nilbranch incliTask, which usescommandverbatim aslaunchPath.