Skip to content

Require ASCII digits in cron expressions - #572

Open
Gorkem-Taha wants to merge 1 commit into
python-validators:masterfrom
Gorkem-Taha:reject-unicode-cron-digits
Open

Gorkem-Taha wants to merge 1 commit into
python-validators:masterfrom
Gorkem-Taha:reject-unicode-cron-digits

Conversation

@Gorkem-Taha

Copy link
Copy Markdown

cron("٣٠ 3 * * *") currently returns True: both str.isdecimal() and int() accept non-ASCII decimal digits. The same problem occurs in each field and in ranges, lists, and steps.

Reject non-ASCII characters at the item boundary before parsing the existing syntax. This covers all numeric positions without changing ASCII ranges, step limits, or whitespace handling. Document the numeric character set in the public function's docstring.

Closes #563.

Validation:

  • Added 13 regression cases covering Arabic-Indic, fullwidth, and Devanagari digits, all five fields, both range endpoints, list items, and step numerators/denominators. All 13 fail on the original implementation and pass with the fix.
  • Full suite on Python 3.12.16: 1,529 passed.
  • Full suite on Python 3.14.10: 1,529 passed.
  • Ruff formatting and lint, strict Pyright, Bandit, and git diff --check pass.

No new dependencies are required.

This branch has not been deployed

No deployments
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.

cron() accepts non-ASCII digits that BusyBox cron rejects

1 participant