Skip to content

Commit 046c53a

Browse files
committed
fix: cron validation support for star step value
1 parent a947377 commit 046c53a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

regexes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const (
7373
cveRegexString = `^CVE-(1999|2\d{3})-(0[^0]\d{2}|0\d[^0]\d{1}|0\d{2}[^0]|[1-9]{1}\d{3,})$` // CVE Format Id https://cve.mitre.org/cve/identifiers/syntaxchange.html
7474
mongodbIdRegexString = "^[a-f\\d]{24}$"
7575
mongodbConnStringRegexString = "^mongodb(\\+srv)?:\\/\\/(([a-zA-Z\\d]+):([a-zA-Z\\d$:\\/?#\\[\\]@]+)@)?(([a-z\\d.-]+)(:[\\d]+)?)((,(([a-z\\d.-]+)(:(\\d+))?))*)?(\\/[a-zA-Z-_]{1,64})?(\\?(([a-zA-Z]+)=([a-zA-Z\\d]+))(&(([a-zA-Z\\d]+)=([a-zA-Z\\d]+))?)*)?$"
76-
cronRegexString = `(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})`
76+
cronRegexString = `(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|((\*|\d+)(\/|-)\d+)|\d+|\*) ?){5,7})`
7777
spicedbIDRegexString = `^(([a-zA-Z0-9/_|\-=+]{1,})|\*)$`
7878
spicedbPermissionRegexString = "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$"
7979
spicedbTypeRegexString = "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$"

validator_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -13637,6 +13637,7 @@ func TestCronExpressionValidation(t *testing.T) {
1363713637
{"*/20 * * * *", "cron", true},
1363813638
{"0 15 10 ? * MON-FRI", "cron", true},
1363913639
{"0 15 10 ? * 6#3", "cron", true},
13640+
{"0 */15 * * *", "cron", true},
1364013641
{"wrong", "cron", false},
1364113642
}
1364213643

0 commit comments

Comments
 (0)