fix(memtrack): prompt sudo on interactive stdin#459
Draft
not-matthias wants to merge 2 commits into
Draft
Conversation
Use the controlling input terminal to decide whether sudo can prompt for a password. Keep the non-interactive wrapper safe after credentials are validated.\n\nFixes COD-3153
Greptile SummaryThis PR updates sudo prompting for memtrack runs. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "fix(memtrack): detect sudo prompts via c..." | Re-trigger Greptile |
Merging this PR will not alter performance
|
Use /dev/tty so piped stdin still prompts when a controlling terminal is available. Add a Bash regression covering piped stdin and redirected stdout.\n\nRefs COD-3153
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
validate_sudo_accesspreviously checked stdin/stdout directly, so both redirected output and piped input could skip the password prompt even when the process still had a controlling terminal. The subsequent non-interactive sudo command then failed when credentials were not cached.Use
/dev/ttyto detect whether sudo can prompt through the controlling terminal. Add a Linux integration test that launches a real Bash command with piped stdin and redirected stdout, then verifies a fake sudo receives--validatebefore the non-interactive command.Fixes COD-3153