You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is not enough validation for step
So when we use cron expression like "0/9999 * * * * ?", it still works, but it seems like out of expectation, and more strange
Further more, what do you expect for "0/9999 0/666 * * * ?"
Maybe we need to use the bounds to limit range as well as start and end
The text was updated successfully, but these errors were encountered:
// cron/parser.go
// Validate step ranges for each cron field
func validateStep(step int, min int, max int) error {
if step == 0 {
return fmt.Errorf("step cannot be 0")
}
if step < min || step > max {
return fmt.Errorf("step %d is out of bounds, must be between %d and %d", step, min, max)
}
return nil
}
// The cron expression parsing logic
func parseCronExpression(expression string) error {
// Example for validating minute field with step values
minuteField := "0/9999" // Example invalid value
step := parseStep(minuteField) // hypothetical function to parse step value from cron expression
// Step validation for minute field (0 to 59)
if err := validateStep(step, 0, 59); err != nil {
return err
}
// Example for validating hour field with step values
hourField := "0/666" // Example invalid value
step = parseStep(hourField) // hypothetical function to parse step value from cron expression
// Step validation for hour field (0 to 23)
if err := validateStep(step, 0, 23); err != nil {
return err
}
// Similarly for other fields (day of month, month, day of week), define their valid ranges:
// - Day of month: 1 to 31
// - Month: 1 to 12
// - Day of week: 0 to 6 (Sunday to Saturday)
return nil
}
cron/parser.go
Line 313 in bc59245
There is not enough validation for step

So when we use cron expression like "0/9999 * * * * ?", it still works, but it seems like out of expectation, and more strange
Further more, what do you expect for "0/9999 0/666 * * * ?"
Maybe we need to use the bounds to limit range as well as start and end
The text was updated successfully, but these errors were encountered: