-
Notifications
You must be signed in to change notification settings - Fork 903
fix: Start SFTP sessions in user home (working directory) #4420
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
This is a simple fix for #3620 by changing the working directory of `coder agent` at runtime. Since the agent doesn't write files to it's working directory, I can't think of any downsides to this method. It does not, however, exclude that we rewrite the SFTP implementation to use the modernized `RequestServer` sometime in the future. Opted to place this in agent init vs `cli/agent` because of portability of fix, tests don't usually use `cli/agent`. Fixes #3620
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.
Is this the only way to solve this problem? Can we not tell the sftp module to use a certain starting directory instead?
Programs changing working directory by themselves causes relative paths (if they're ever used) to break
Yeah, the alternative is discussed in #3620. But like Kyle mentions it's a quite involved. This would allow us to fix it immediately whereas if we go the alternative approach not sure when we'd get around to it. Are there any relative paths used by the agent? I for one can't find any. The only file we write (to my knowledge) is a log file and that one is opened earlier and uses an absolute path. |
@deansheather thinking about this some more, I failed to consider the effect this will have on tests. Even if nothing breaks today, there's bound to be some breakage (e.g. looking up Because of that, I would consider:
|
We could also contribute it upstream |
This commit switches to our fork of `pkg/sftp` which includes a Server option for changing the current working directory. Attempt to upstream: pkg/sftp#528 Supercedes and closes #4420 Fixes #3620
This commit switches to our fork of `pkg/sftp` which includes a Server option for changing the current working directory. Attempt to upstream: pkg/sftp#528 Supercedes and closes #4420 Fixes #3620
* fix: Start SFTP sessions in user home (working directory) This commit switches to our fork of `pkg/sftp` which includes a Server option for changing the current working directory. Attempt to upstream: pkg/sftp#528 Supercedes and closes #4420 Fixes #3620 * Update fork
This is a simple fix for #3620 by changing the working directory of
coder agent
at runtime.Since the agent doesn't write files to it's working directory, I can't
think of any downsides to this method. It does not, however, exclude
that we rewrite the SFTP implementation to use the modernized
RequestServer
sometime in the future.Opted to place this in agent init vs
cli/agent
because of portabilityof fix, tests don't usually use
cli/agent
.Fixes #3620