-
Notifications
You must be signed in to change notification settings - Fork 39
GH#3716: Fix CRITICAL security issues from PR #1359 review #4062
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,6 +34,11 @@ cmd_cron() { | |||||||||||||||||
| log_error "--interval requires a value" | ||||||||||||||||||
| return 1 | ||||||||||||||||||
| } | ||||||||||||||||||
| # GH#3716: Validate interval is a positive integer before use in cron/launchd commands | ||||||||||||||||||
| if ! [[ "$2" =~ ^[0-9]+$ ]] || [[ "$2" -eq 0 ]]; then | ||||||||||||||||||
| log_error "--interval must be a positive integer (minutes), got: $2" | ||||||||||||||||||
| return 1 | ||||||||||||||||||
| fi | ||||||||||||||||||
|
Comment on lines
+38
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To enhance defense-in-depth against potential injection attacks when parsing numeric data from untrusted sources, it's crucial to validate numeric fields. Similar to the validation for
Suggested change
References
|
||||||||||||||||||
| interval="$2" | ||||||||||||||||||
| shift 2 | ||||||||||||||||||
| ;; | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To enhance defense-in-depth against potential injection attacks when parsing numeric data from untrusted sources, it's crucial to validate numeric fields. You can simplify this positive integer validation by using a single regular expression that excludes zero. This makes the check more concise, readable, and robust.
References