-
Notifications
You must be signed in to change notification settings - Fork 14
Environment variable passing support #35
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
Conversation
742d9e3 to
ee10438
Compare
|
Yay, working now:
@mkj Please review? :) |
… Unknown channel req type 'env')... that's according to RFC 4254, but we'll deem more env vars as 'safe to pass' than just LANG, TERM, and DISPLAY. [src/serve.rs:98] "Got ENV request" = "Got ENV request" [src/serve.rs:99] a.name()? = "LANG" [src/serve.rs:100] a.value()? = "C.UTF-8" Co-authored-by: Marko Malenic <[email protected]> Co-authored-by: Julio Beltran Ortega <[email protected]>
1848f79 to
e6b1c6a
Compare
mkj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good. One small comment on naming.
The docs could maybe have a note that the strings are not sanitised, so if they're passed to a shell/C FFI etc the application needs to be careful (strip \0 etc). That probably applies to username/password as well - I can have a look at that, no need to hold up this PR.
56c7900 to
7cce6fb
Compare
Thanks Matt! I did think a bit about input sanitisation/validation but honestly I didn't know how much of it you wanted to include at the lib level so I left it a bit open for now... perhaps the length of both name and value should ideally be clipped to reasonable defaults while you are at it?... among other input validation standard recommendations. |
I don't think the core library needs to do it - the name/value are slices of the input packet, so don't use any space beyond the fixed input buffer. On embedded platforms to keep a string copy I assume they're usually using |
Adds the necessary structs/types/event for env var sending/handling (and avoids runtime message: WARN - Unknown channel req type 'env')... that's according to RFC 4254, but we'll deem more env vars as 'safe to pass' than just LANG, TERM, and DISPLAY. I.e (potentially with
SSH_STAMP_prefix):UART_TX_PINandUART_RX_PINWIFI_SSID,WIFI_PWGENERATE_HOST_KEYPUBLIC_KEY, etc...This PR is essential to implement support on brainstorm/ssh-stamp#44.
/cc @mmalenic