Skip to content

Comments

Fix DurationType regex vulnerability and add tests#160

Open
outlookenjoyer wants to merge 1 commit intocloud-custodian:mainfrom
outlookenjoyer:fix-duration-regex
Open

Fix DurationType regex vulnerability and add tests#160
outlookenjoyer wants to merge 1 commit intocloud-custodian:mainfrom
outlookenjoyer:fix-duration-regex

Conversation

@outlookenjoyer
Copy link

Fixes #147 #155

Description

The old regex used [a-z]+ to parse time units, which caused the regex engine to hang on bad inputs like mmmmmmmmmm!

Changes

  • Swapped [a-z]+ with a hardcoded list of valid units (ms, s, h, etc.)
  • Sorted the units by length so ms matches safely before m
  • Added tests

Verification

  • Tests pass (pytest tests/test_celtypes.py)

cc @slott56

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 21, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: outlookenjoyer / name: Rustam (2a663e8)

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.

Possible ReDoS Security Issue in duration_pat Regex (celtypes.py:1333)

1 participant