ssh-config icon indicating copy to clipboard operation
ssh-config copied to clipboard

Consideration of aligning cases to lower case when compute to match OpenSSH behavior

Open xhiroga opened this issue 1 year ago • 1 comments

Summary

OpenSSH treats configuration directives case-insensitively, but ssh-config does not. For example:

Host example
    hOsTnaME 1.2.3.4
% ssh -G example
host example
hostname 1.2.3.4

However, SSHConfig.compute() keeps case and developer should be consider it.

Proposal

Add a mechanism to handle directives in a case-insensitive manner to match OpenSSH. Possible approaches include:

  1. Always normalize directive names to lowercase internally.
  2. Add an option such as ignoreCase: true for compute() to unify case.
  3. Maintain both the original and lowercase versions of the directive.

It would be great if ssh-config could support case-insensitive directives to better align with OpenSSH behavior. I'd be happy to contribute a PR if there's a preferred approach.

xhiroga avatar Dec 28 '24 23:12 xhiroga

I'd prefer the second approach, such as compute(host, { lowerCase: true }), to ignore case sensitivity and to convert the parameter names in the result to lower case. Future major release may opt in this flag by default.

Please feel free to send PR :-D

cyjake avatar Dec 31 '24 07:12 cyjake