Skip to content
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

[v17] Read ~/.tsh/environment as the target user #52136

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

r0mant
Copy link
Collaborator

@r0mant r0mant commented Feb 13, 2025

This PR adds a readfile sub-command that can be reexec'd in order to read a file as a target user. This is useful in cases where we need to do some processing on file contents as root, but we want to make sure the target user has access to the file at the time of reading it (e.g. to prevent arbitrary file reads as root on behalf of the user). It works by passing an os.Pipe to the subcommand in order to send the file contents back to the parent process. To support future use cases, ProcessFileAsUser is generic and accepts a process() callback responsible for reading file contents from an io.Reader and marshaling into some type T.

changelog: Fixed security issue with arbitrary file reads on SSH nodes.

@r0mant r0mant added this pull request to the merge queue Feb 13, 2025
Merged via the queue into branch/v17 with commit a16df65 Feb 13, 2025
41 checks passed
@r0mant r0mant deleted the eriktate/v17/tshenvfix branch February 13, 2025 19:02
@camscale camscale mentioned this pull request Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants