Repository navigation
fix(rules): match PATH lines piped through tee into a login file - #1045
Merged
kyle-elliott-asymptote merged 2 commits intoOct 26, 2026
Conversation
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.
What was wrong
path-injection-into-login-filerequires a>/>>redirect into the startup file. The other everyday way to append a line, piping it intotee, was not covered. So these went unflagged:echo 'export PATH=/tmp/bin:$PATH' | tee -a ~/.bashrcecho 'export PATH=/srv/bin:$PATH' | sudo tee /etc/profile.d/custom.shsudo teeis also the usual way to write a root-owned file such as/etc/profile.d/*, becausesudo echo ... >> filedoes not work.The fix
The write clause accepts
teeas well as a redirect:(>>?|\btee\b)\s*[^|;&]*(<startup files>). A read likegrep PATH ~/.bashrc | tee path-notes.txtstill does not match, because theteetarget is not a startup file. I updated the description and bumped the rule version to 2.Tests
I added two match fixtures and one no_match fixture. Before the fix:
What I ran