-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split Message
into Request
and Response
#42
Conversation
Okay folks, I packed a bit more features in here than I wanted but I guess going commit-by-commit shows what's going on. The end result is having direct functions on the Other change is extracting the And the first change is a Message split into Request and Response. Which should make clients a bit more robust. |
Hi @wiktor-k, this is a great start! Personally, I feel @baloo's proposed changes in #43 (using traits instead of enums) may be a little nicer just in terms of extensibility - for example, being able to implement On that note, it could be worth implementing some mechanism to handle "unknown" message types in the @baloo's implementation will return |
Yup, definitely it's a step into the right direction. I'm wondering how would one "register" which types to use for which response codes but let's wait until @baloo implements it further and it takes more shape :) |
yeah, I don't know how to deal with the router either. This was a good idea until it was not. I need a piece of code to do the routing between message types. |
Hmm... well this could be relatively easily implemented in the I've seen people using custom extensions but not entire message types. (I'm not saying it's a bad idea or discourage anyone from using it, just stating my PoV). One way or another I'm happy to wait with this PR until @baloo emerges with insights from his side-quest :) That said I'm happy that we're discussing design decisions here so at least it's clear what alternatives have been considered. 👍 |
Yeah very fair - with the new |
Indeed, that's great to hear! 🚀 Is there some venue where one can track the progress or is it in 1:1 e-mails between with you and Damien? I'd be interested if the Query extension will be migrated to this new |
@wiktor-k @baloo v14 is here: djmdjm/drafts@fb5055b See both the new I can make a PR this week to merge into this branch to accommodate for this |
The new draft has been published: https://www.ietf.org/archive/id/draft-miller-ssh-agent-14.html#section-3.8
For example, the "query" extension looks like:
The response message code for Noting that:
The method signature of
One way could be to encapsulate these response types into an enum ExtensionReponse {
Success,
Response(Extension)
}
pub trait Session: 'static + Sync + Send + Sized {
async fn extension(
&mut self,
mut extension: Extension,
) -> Result<ExtensionResponse, Box<dyn std::error::Error>> {
}
} But very open to suggestions! |
Hey thanks for following up on that!
How is this not a violation of the protocol? If the non-support of an extension is signaled by agent failure:
How can a client know whether the agent supported the extension or not if no reply is expected this one specific command?! This can't be a specific use-case. |
No worries @baloo! It definitely helps my use-case where I'm layering a request/response based protocol over the agent protocol - hope it helps some others too! On the "[email protected]" case; I think it actually does respond; it sends either |
I'm in the exact same boat hey. |
How about: pub trait Session: 'static + Sync + Send + Sized {
async fn extension(
&mut self,
mut extension: Extension,
) -> Result<Option<Extension>, Box<dyn std::error::Error>> {
}
} Return |
Just traced an ssh-agent version 9.6p1, and yes it does reply the expected |
I'm thinking of the non-RFCed version that appears in the OpenSSH built-in agent, where FWIW, the stock OpenSSH agent doesn't seem to support the "query" extension in the draft RFC, so 🤷
Looks great to me - and makes it easy to implement arbitrary extensions. Since we will need to return |
Yeah, I deleted that comment immediately after posting it, realizing I was mixing things up. Sorry about the noise. |
4253023
to
ba947aa
Compare
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Let's revisit the draft-14 in a followup PR. We'll merge this and proceed with the license change in #36 |
As it says on the tin.
It makes the type system check if we're not sending requests as replies in the agent and vice versa.
I think some cleanup is still needed (e.g. not using
message
as a variable name, or duplication inRequest::SignRequest
) but I'm filing it earlier to gather your feedback :)