Skip to content

Date of Birth accepts future dates and dates that do not exist #28342

Description

@RushanNanayakkara

Description

The Date of Birth claim (http://wso2.org/claims/dob) is validated only against a format pattern, ^\d{4}-\d{2}-\d{2}$. That constrains the shape of the value, not its meaning, so two classes of invalid value are accepted and persisted:

  1. Future dates2030-01-01 matches the pattern.
  2. Dates that do not exist2025-02-30 and 2025-02-29 also match the pattern.

The value is stored on every write path that reaches the user store: self-registration (both the classic page and the dynamic registration flow), the Console user create and edit forms, and the SCIM2 user endpoints. My Account's profile page already rejected future dates in the browser, so the same claim was enforced inconsistently depending on which UI the value came through, and a value blocked in one place could be stored from another.

Steps to Reproduce

  1. Create a user through SCIM2 with a future date of birth:

    POST /scim2/Users
    {
      "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
      "userName": "DEFAULT/dobtest@example.com",
      "password": "<password>",
      "emails": [{ "primary": true, "value": "dobtest@example.com" }],
      "urn:scim:wso2:schema": { "dateOfBirth": "2030-01-01" }
    }
    

    Expected: rejected with HTTP 400. Actual: HTTP 201, and a GET on the created user returns dateOfBirth: 2030-01-01.

  2. Repeat with "dateOfBirth": "2025-02-30", a date that does not exist. Same result.

  3. Register through the self-registration page and enter a future date of birth. The value is accepted and stored.

  4. Open the same user's profile in My Account. The future date is rejected there, so the value cannot be re-saved even though it was stored.

Please select the area issue is related to

Authentication & Registration

Version

7.4.0-SNAPSHOT (master)

Environment Details (with versions)

Reproducible on any deployment; not specific to a database or user store. Note that server-side claim validation runs only when UserClaimUpdate.EnableUserClaimInputRegexValidation is enabled, which is the shipped default.

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions