WIP: Custom command options for MongoDB hook #837 #1029

Closed
gautamaggarwal2810 wants to merge 2 commits from (deleted):modified_branch into main
Contributor

Fixes #837.Will add unit tests soon.

Fixes #837.Will add unit tests soon.
gautamaggarwal2810 added 1 commit 2025-03-17 07:35:50 +00:00
witten reviewed 2025-03-17 17:48:48 +00:00
witten left a comment
Owner

Looking good!

Looking good!
@@ -131,0 +131,4 @@
dump_command = tuple(
shlex.quote(part)
for part in shlex.split(database.get('mongodump_command') or 'mongodump')
)
Owner

This'll happen as part of running tests, but make sure to look at any black code formatting errors that you get. And tox -e black can do the reformatting for you.

This'll happen as part of running tests, but make sure to look at any `black` code formatting errors that you get. And `tox -e black` can do the reformatting for you.
gautamaggarwal2810 added 1 commit 2025-03-19 08:14:42 +00:00
gautamaggarwal2810 force-pushed modified_branch from f4b584c381 to 33dd66e3e1 2025-03-19 08:21:37 +00:00 Compare
Author
Contributor

Added unit tests.All of them were successful.Please review and suggest any changes to be made.

Added unit tests.All of them were successful.Please review and suggest any changes to be made.
witten reviewed 2025-03-19 17:29:22 +00:00
@@ -15,0 +20,4 @@
if value is None:
return value
# Remove dangerous characters and sequences
return re.sub(r'[;&|><]', '', value).strip()
Owner

Why is this necessary if you're using shlex.quote()? And by removing characters outright instead of quoting them, won't this break some legitimate use cases? For instance, I think this approach would break many legitimate passwords that contain special characters.

Why is this necessary if you're using `shlex.quote()`? And by removing characters outright instead of quoting them, won't this break some legitimate use cases? For instance, I think this approach would break many legitimate passwords that contain special characters.
Author
Contributor

I used this because unit tests were failing without running this.I will try once more without using this function though.

I used this because unit tests were failing without running this.I will try once more without using this function though.
Owner

I'm not sure why they'd fail, but I'd be happy to help with test failures if I can.

I'm not sure why they'd fail, but I'd be happy to help with test failures if I can.

Pull request closed

Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#1029