Skip to content

Support sftp in wrap file #14772

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ampleyfly
Copy link

Add and test basic support for sftp in wrap-file. The functionality depends on the "sftp" cli tool being installed, and fails with a helpful message if it is not.

This solution requires any credentials to be supplied in the url, or some other
means of authentication (such as an identity file configured for the
user) to be used.

Mainly for testing purposes, "source_identityfile" can be used to point
out an identity file. Also mainly for testing purposes, "source_hostkey"
can be used to specify a trusted public key for the host.

The test sets up a temporary local ssh server using generated keys (committing them yields complaints from GitGuardian).

@ampleyfly ampleyfly requested a review from jpakkane as a code owner July 8, 2025 08:45
@ampleyfly ampleyfly force-pushed the support-sftp-in-wrap-file-2 branch 2 times, most recently from aa52575 to 4a41116 Compare July 8, 2025 11:48
@ampleyfly
Copy link
Author

ampleyfly commented Jul 8, 2025

Turns out the test doesn't work in the CI here. At least in the Suse case, it is because apparently sshd won't use keys stored in a mounted volume. I've reproduced the problem locally, so will try to solve it from there. I have yet to figure out what is going wrong in the other case, where it seems even starting sshd is problematic.

EDIT: Turns out there's an option that disables the checks sshd does, so most of the problems were solved by that. The rest of the messing about is to do with msys.

@ampleyfly ampleyfly force-pushed the support-sftp-in-wrap-file-2 branch 21 times, most recently from b9a71a0 to 9623c76 Compare July 10, 2025 09:55
This requires any credentials to be supplied in the url, or some other
means of authentication (such as an identity file configured for the
user) to be used. Supplying a password in the URL is not supported.

Mainly for testing purposes, "source_identityfile" can be used to point
out an identity file. Also mainly for testing purposes, "source_hostkey"
can be used to specify a trusted public key for the host.
@ampleyfly ampleyfly force-pushed the support-sftp-in-wrap-file-2 branch from 9623c76 to 98e526f Compare July 12, 2025 11:03
Also add a python script that can recreate the archive of the foo
sources used by the test.
@ampleyfly ampleyfly force-pushed the support-sftp-in-wrap-file-2 branch from 98e526f to e9e361c Compare July 20, 2025 12:54
f.write(f'[{url.hostname}]:{url.port} {self.wrap.get("source_hostkey")}')
args += ['-o', 'UserKnownHostsFile=known_hosts']
if 'source_identityfile' in self.wrap.values:
args += ['-o', f'IdentityFile={self.wrap.get("source_identityfile")}']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code that fiddles with the end user's crypto setup makes me especially anxious. If you set these arguments in the wrap file, then that file can only work on the machine it has been generated on (or en exact replica of it). There might also be some sort of a information leakage vulnerability here, but I don't have the skills to say so one way or another.

Because of these and similar reasons we try to stay away from access control as much as possible. Are these features absolutely necessary or can we just say "set up access control outside Meson"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants