Skip to content

NullDuration regex is incorrect #458

@james-emerton

Description

@james-emerton

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions