ory / ory/sdk

NullDuration regex is incorrect

Open
#458 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
178
Forks
96
Avg merge
6d 23h
Merged PRs (30d)
3

Description

Preflight checklist
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.