fix: add support for preserving quoted group names in sshd_config#1639
fix: add support for preserving quoted group names in sshd_config#1639Gijsreyn wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows-specific parsing/export bug in the Microsoft.OpenSSH.SSHD/sshd_config resource where space-containing, quoted list entries (e.g. AllowGroups administrators "openssh users") were incorrectly split into separate items during get and export.
Changes:
- Added a Pester test that verifies
getandexportpreserve quoted group names containing spaces. - Updated
get_sshd_settings()to prefer explicitly-parsed config-file values for space-separated multi-arg keywords (avoidingsshd -Tquote-stripping/splitting behavior). - Added Rust unit tests covering the new override behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| resources/sshdconfig/tests/sshdconfig.get.tests.ps1 | Adds coverage ensuring quoted group values remain a single array entry for both get and export. |
| resources/sshdconfig/src/get.rs | Restores correct list semantics by overriding sshd -T-normalized values with explicitly parsed config values for affected keywords. |
0faeeaf to
9b7da04
Compare
|
@tgauth - is this something you can take a quick look at? |
|
Thanks for opening this! My initial thoughts are that this issue is applicable to other arguments that can have spaces as well (i.e. regular arguments for paths) and I wonder if we can address those here as well. I'm going to think on it a bit and see if there's a good way to do that, and if not, we can defer it to a future PR. |
PR Summary
Fixes a bug where
sshd_configlist keywords with quoted, space-containing values (e.g. the Windows group "openssh users") were split into separate entries on export and get.PR Context
Fixes #1508.