Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support rm with capital R #133

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
},
]
Loading