fix(logmonitor): allow absolute /Config paths again - #232
Open
Bob Sira (bobsira) wants to merge 1 commit into
Open
fix(logmonitor): allow absolute /Config paths again#232Bob Sira (bobsira) wants to merge 1 commit into
Bob Sira (bobsira) wants to merge 1 commit into
Conversation
Restore support for absolute config paths while preserving relative path hardening for /Config. Fixes regression introduced in 2.2.0 (issue #229).
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Restores support for absolute /Config paths while keeping the hardening that forces relative config file names to be resolved under the executable directory (regression from 2.2.0 / issue #229).
Changes:
- Added
ResolveConfigPath()helper to centralize config path validation + resolution behavior. - Updated
/Confighandling inwmainto useResolveConfigPath()and remove duplicated logic.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+270
to
+277
| WCHAR modulePath[MAX_PATH] = {}; | ||
| if (GetModuleFileNameW(nullptr, modulePath, _countof(modulePath)) == 0) | ||
| { | ||
| logWriter.TraceError( | ||
| Utility::FormatString(L"Failed to get module path. Error: %d", GetLastError()).c_str() | ||
| ); | ||
| return false; | ||
| } |
Comment on lines
+254
to
+259
| // Preserve support for absolute paths passed via /Config. | ||
| if (!PathIsRelativeW(userConfigName.c_str())) | ||
| { | ||
| resolvedConfigPath = userConfigName; | ||
| return true; | ||
| } |
Comment on lines
+262
to
+268
| if (userConfigName.find(L"..") != std::wstring::npos || | ||
| userConfigName.find(L'/') != std::wstring::npos || | ||
| userConfigName.find(L'\\') != std::wstring::npos || | ||
| userConfigName.find(L':') != std::wstring::npos) | ||
| { | ||
| return false; | ||
| } |
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.
Restore support for absolute config paths while preserving relative path hardening for /Config.
Fixes regression introduced in 2.2.0 (issue #229 ).