Commit 65ffdbe
committed
fix(safety): detect GNU rm long options --recursive/--force (CongkeChen review #5)
CongkeChen review on 9edfacd: _DELETE_PATTERNS only matched short options (-rf), so 'rm --recursive --force /' bypassed R001. Add two patterns: one for rm directly followed by --recursive/--force, one for rm with a preceding option then --recursive/--force. Covers --recursive, --force, --recursive --force, --force --recursive, --recursive -f, -r --force, and --recursive=yes (GNU --opt=val form). 'rm file.txt' still correctly not flagged. Add regression test test_dangerous_files_bash_rm_gnu_long_options.1 parent 9edfacd commit 65ffdbe
2 files changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
39 | 59 | | |
40 | 60 | | |
41 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
| |||
0 commit comments