Skip to content

Fix invalid handling of comma-separated mach modes - #1294

Merged
Krzysztof Kanas (kkanas) merged 2 commits into
devfrom
robertwoj/38930848
Aug 5, 2026
Merged

Fix invalid handling of comma-separated mach modes#1294
Krzysztof Kanas (kkanas) merged 2 commits into
devfrom
robertwoj/38930848

Conversation

@robertwoj-microsoft

@robertwoj-microsoft Robert Wojciechowski (robertwoj-microsoft) commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

Fix improper handling of comma-separated mach modes.

Root cause

Match User *@*,<guid>

Contents of the pattern were passed directly to the sshd command: sshd -T -C user=*@*,<guid>. The semantics is that the patterns are comma-separated and consittute an alternative of matches. The sshd command though, expects only a single parameter: either *@* or <guid>.

The fix

Now the code splits the pattern by the comma character and tries sshd -T -C user=<param> command for each parsed parameter. Compliance is determined by combining all the patterns to not leave room for missed settings. For example, if we checked only the first pattern, we could miss settings for the users that have GUID as username in this case.

Additional changes

As now for each parameter we check the same setting, I added the parameter context to the indicators to distinguish them. In the original IcM scenario we could have 2 indicators with the same message.

Checklist

  • I have read the contribution guidelines.
  • I added unit-tests to validate my changes. All unit tests are passing.
  • I have merged the latest dev branch prior to this PR submission.
  • I ran pre-commit on my changes prior to this PR submission.
  • I submitted this PR against the dev branch.

(cherry picked from commit d83f228d4681631a129540ee0506386617e31194)
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

Test Results

1 347 tests  +1   1 347 ✅ +1   1m 43s ⏱️ +25s
   78 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit f5c799d. ± Comparison against base commit 14aa423.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@kkanas
Krzysztof Kanas (kkanas) enabled auto-merge (squash) August 5, 2026 12:28
@kkanas
Krzysztof Kanas (kkanas) merged commit 10d4fac into dev Aug 5, 2026
61 checks passed
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.

4 participants