Skip to content

Missing Public API for SSH Extensions #97

@Bip901

Description

@Bip901

Currently, the only public API to obtain the protocol extensions is the following property of SshSession:

// Summary:
//     Gets the set of protocol extensions (and their values) enabled for the current
//     session.
//
// Remarks:
//     Populated only after an (optional) ExtensionInfoMessage is received from the
//     other side.
public IReadOnlyDictionary<string, string>? ProtocolExtensions => Protocol?.Extensions;

Which is implemented by taking the intersection of the local and remote extensions:

// file SshSession.cs, method HandleMessageAsync(ExtensionInfoMessage message, CancellationToken cancellation)

foreach (string protocolExtension in Config.ProtocolExtensions)
{
    if (extensionInfo.TryGetValue(protocolExtension, out var value))
    {
        Protocol.Extensions.Add(protocolExtension, value);
    }
}

This results in loss of information, as there's no other public API to obtain the extensions the remote party advertised and aren't in the local extension list.

Some SSH extensions are only advertised by one of the parties, as noted by RFC 8308:

   When it is specified, an extension MAY dictate that, in order to take
   effect, both parties must include it in their SSH_MSG_EXT_INFO or
   that it is sufficient for only one party to include it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions