NullDuration regex is incorrect
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 178
- Forks
- 96
- Avg merge
- 6d 23h
- Merged PRs (30d)
- 3
Description
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Ory Network Project
No response
Describe the bug
The hydra sdk spec defines NullDuration with the following pattern: ^([0-9]+(ns|us|ms|s|m|h))*$.
The kratos and the "client" (combined) spec define it as ^[0-9]+(ns|us|ms|s|m|h)$ which causes values such as "2m0s" to fail validation.
I think that in both cases the regex should actually be ^([0-9]+(ns|us|ms|s|m|h))+$, depending on whether an empty string is valid or not.
Reproducing the bug
Discovered with a generated python+pydantic client. After changing authorization_code_grant_access_token_lifespan to "2m" (for testing purposes) hydra changed the value to "2m0s" which caused subsequent calls to the GET client endpoint to fail with a pydantic ValidationError.
Relevant log output
Relevant configuration
Version
Kratos 1.3.1 / Hydra 2.2.0
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Docker
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the NullDuration pattern in the Hydra, Kratos, and combined client specs, then compare how the generated Python/Pydantic client validates values such as "2m0s". Done means the affected specs accept the intended duration format consistently, with the empty-string behavior decided and covered by validation tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100