Skip to content

Commit c5d1506

Browse files
committed
Fix validation regex for cron schedules
1 parent f4a857d commit c5d1506

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cronman

100644100755
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,13 @@ validate_schedule() {
247247
local month="${fields[3]}"
248248
local weekday="${fields[4]}"
249249

250-
# Simple pattern check
251-
if [[ ! $minute =~ ^(\*|[0-9\-,/]+)$ ]] || \
252-
[[ ! $hour =~ ^(\*|[0-9\-,/]+)$ ]] || \
253-
[[ ! $day =~ ^(\*|[0-9\-,/]+)$ ]] || \
254-
[[ ! $month =~ ^(\*|[0-9\-,/]+)$ ]] || \
255-
[[ ! $weekday =~ ^(\*|[0-9\-,/]+)$ ]]; then
250+
# Simple pattern check - very permissive, just check for valid characters
251+
# Allow: *, digits, hyphens, commas, slashes
252+
if [[ ! $minute =~ ^[0-9*,/-]+$ ]] || \
253+
[[ ! $hour =~ ^[0-9*,/-]+$ ]] || \
254+
[[ ! $day =~ ^[0-9*,/-]+$ ]] || \
255+
[[ ! $month =~ ^[0-9*,/-]+$ ]] || \
256+
[[ ! $weekday =~ ^[0-9*,/-]+$ ]]; then
256257
print_error "Invalid schedule format"
257258
return 1
258259
fi

0 commit comments

Comments
 (0)