Skip to content

Commit

Permalink
support rm with capital R (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplanelad committed Dec 7, 2023
1 parent 7e1f031 commit e2f7e62
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shellfirm/checks/fs-strict.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
description: "Are you sure that you want to change permissions?"
id: fs-strict:change_permissions
- from: fs-strict
test: rm\s{1,}(?:-rf|-fr|-r|-f)?\s*(.*)
test: rm\s{1,}(?:-Rf|-rf|-fR|-fr|-r|-R|-f)?\s*(.*)
description: "Are you sure you want to continue with deletion?"
id: fs-strict:any_deletion
filters:
Expand All @@ -13,4 +13,4 @@
description: "Are you sure you want to continue with deletion?"
id: fs-strict:folder_deletion
filters:
IsExists: "1"
IsExists: "1"
6 changes: 6 additions & 0 deletions shellfirm/tests/checks/fs-strict-any_deletion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@
description: invalid rm name
- test: rm
description: without arguments
- test: rm -R src
description: with capital r
- test: rm -Rf src
description: with capital r
- test: rm -fR src
description: with capital r
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ expression: test_file_results
test: "rm -Rf /",
check_detection_ids: [
"fs:recursively_delete",
"fs-strict:any_deletion",
],
test_description: "Handle capital R",
},
Expand Down
24 changes: 24 additions & 0 deletions shellfirm/tests/snapshots/checks__fs-strict-any_deletion.yaml.snap
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,28 @@ expression: test_file_results
check_detection_ids: [],
test_description: "without arguments",
},
TestSensitivePatternsResult {
file_path: "fs-strict-any_deletion.yaml",
test: "rm -R src",
check_detection_ids: [
"fs-strict:any_deletion",
],
test_description: "with capital r",
},
TestSensitivePatternsResult {
file_path: "fs-strict-any_deletion.yaml",
test: "rm -Rf src",
check_detection_ids: [
"fs-strict:any_deletion",
],
test_description: "with capital r",
},
TestSensitivePatternsResult {
file_path: "fs-strict-any_deletion.yaml",
test: "rm -fR src",
check_detection_ids: [
"fs-strict:any_deletion",
],
test_description: "with capital r",
},
]

0 comments on commit e2f7e62

Please sign in to comment.