Skip to content

Fix cron validation to reject trailing garbage in fields#1100

Open
sidtuladhar wants to merge 2 commits into
masterfrom
u/sidtuladhar/TRON-1761
Open

Fix cron validation to reject trailing garbage in fields#1100
sidtuladhar wants to merge 2 commits into
masterfrom
u/sidtuladhar/TRON-1761

Conversation

@sidtuladhar
Copy link
Copy Markdown

The regex pattern in FieldParser used .match() semantics without an end anchor, allowing invalid expressions like "5kevin" or "*/10abc" to pass validation silently. Adding a $ anchor ensures the entire field must match the pattern.

Fixes TRON-1761

The regex pattern in FieldParser used .match() semantics without an end
anchor, allowing invalid expressions like "5kevin" or "*/10abc" to pass
validation silently. Adding a $ anchor ensures the entire field must
match the pattern.

Fixes TRON-1761
@sidtuladhar sidtuladhar requested a review from a team as a code owner May 19, 2026 14:25
mbrankin-art
mbrankin-art previously approved these changes May 19, 2026
@nemacysts
Copy link
Copy Markdown
Member

@sidtuladhar i've added some of the CIB folks as reviewers as well :)

@nemacysts
Copy link
Copy Markdown
Member

that said, i'm not 100% sure that this will prevent the issue we saw: 10 14 15-21 * 5 is technically a valid cron schedule, it's just not something that tron handles (i assume 'cause it was a pain to implement when this code was initially written)

could you test running what paasta validate runs (https://github.com/Yelp/paasta/blob/master/paasta_tools/tron_tools.py#L1353) on a yaml file that looks like the one that broke sync-deploy using this change?

@sidtuladhar
Copy link
Copy Markdown
Author

@nemacysts right, it wouldn't prevent that. When i run paasta validate on the yaml that has the broken cron syntax for tron, there are no errors

had to add strip() bc some cron syntax has trailing whitespace
@sidtuladhar
Copy link
Copy Markdown
Author

this prevents monthday and weekday in the parsing now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants