Skip to content

Fix commands that require escalation#793

Merged
0xfornax merged 1 commit into
rocket-pool:masterfrom
jshufro:jms/fixpurge
May 9, 2025
Merged

Fix commands that require escalation#793
0xfornax merged 1 commit into
rocket-pool:masterfrom
jshufro:jms/fixpurge

Conversation

@jshufro
Copy link
Copy Markdown
Contributor

@jshufro jshufro commented May 8, 2025

https://go.dev/play/p/WbgPaKbHJdE demonstrates the need/safety of shellescape

Basically, we want to delete the getEscalationCmd to make sure that when root is required, it is used 'correctly'.

'Correctly' here means in a statement that looks like sudo bash -c 'rm -rf .rocketpool/validators'/*, otherwise the *-expansion fails if validators is not readable by the non-escalated user. To make sure we don't have misuse, we delete the getEscalationCmd, and add a function called readOutputSudo which does the same thing as readOutput, but first gets the appropriate escalation command (sudo or doas), and safely wraps the command in a sudo/doas bash -c '%s'

@0xfornax 0xfornax merged commit 0107eba into rocket-pool:master May 9, 2025
4 checks passed
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.

2 participants