FixUserFilePermissions.ps1: use wildcard to get keys - #864
sharpchen (sharpchen) wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Updates the Windows FixUserFilePermissions.ps1 helper to discover user SSH keys with algorithm-prefixed variants (e.g., id_ed25519_sk*) by expanding the Get-ChildItem -Include patterns.
Changes:
- Switch key discovery from exact filenames (
id_rsa,id_ed25519, …) to wildcard patterns (id_rsa*,id_ed25519*, …) to cover algorithm-prefixed variants.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Get-ChildItem ~\.ssh\* -File -Include "id_rsa*","id_dsa*","id_ecdsa*","id_ed25519*" -ErrorAction SilentlyContinue | | ||
| Where-Object Extension -eq '' | | ||
| ForEach-Object { |
There was a problem hiding this comment.
Might have *.bak as well, would you like to include them?
There was a problem hiding this comment.
Sure, I don't want to overcomplicate this but maybe this should be optional behavior? Keep the default script behavior as-is, and if an IncludeCustomKeys switch is passed, then it expands the search
There was a problem hiding this comment.
That would be effectively to include any file. I think -SSHKeys $files can be better to allow user to pass any file they want.
PR Summary
Use wildcard pattern for
-IncludePR Context
ssh keys can have arbitrary names, using algorithm name as prefix should be a common and good practice.
Currently it only matches on exact name, use wildcard to include those with prefixes.