Skip to content

Make the date of birth future-date rule fixed instead of configurable - #8250

Merged
RushanNanayakkara merged 1 commit into
wso2:masterfrom
RushanNanayakkara:fix-dob-future-date-fixed-validation
Aug 17, 2026
Merged

Make the date of birth future-date rule fixed instead of configurable#8250
RushanNanayakkara merged 1 commit into
wso2:masterfrom
RushanNanayakkara:fix-dob-future-date-fixed-validation

Conversation

@RushanNanayakkara

Copy link
Copy Markdown
Contributor

Purpose

Related issue: https://github.com/wso2-enterprise/wso2-iam-internal/issues/7266
Follow-up to: #8212

#8212 made the dynamic registration flow emit a DateValidator client rule only when the backing claim carried a disallowFutureDate=true property, seeded from claim-config.xml.

That gate turned out to be the wrong mechanism:

  1. It never reaches existing tenants. claim-config.xml seeds claim metadata at tenant provisioning. Tenants created before the property existed keep their old metadata, so they never get the rule. Verified against a real dev-tier tenant: the dynamic flow accepted a future date of birth with no inline error.
  2. It disagreed with the server. SCIMUserOperationListener already rejects a future date of birth for every tenant, unconditionally, with no configuration (identity-inbound-provisioning-scim2#800). Gating only the client hint meant a user on an unseeded tenant got no inline error, submitted, and then hit a server error.

This resolves the rule in code so it applies to every tenant as soon as the change is deployed, and matches what the server already enforces.

Changes

  1. InputValidationService
    • Added NO_FUTURE_DATE_CLAIMS, the set of claims whose value can never be a future date. It contains only the date of birth claim.
    • applyDateValidationIfNeeded now checks membership in that set instead of reading claim metadata. The ClaimMetadataManagementService lookup, its null-service guard, and the ClaimMetadataException handling are gone, along with the tenantDomain plumbing Emit DateValidator client rule for date claims that disallow future values #8212 threaded through processComponentValidations.
  2. Constants — added DOB_CLAIM_URI, alongside the existing USERNAME_CLAIM_URI.
  3. ClaimConstants — removed DISALLOW_FUTURE_DATE_PROPERTY.
  4. claim-config.xml — removed the <disallowFutureDate> entry from the date of birth claim.

Net effect is 61 fewer lines, and one fewer claim metadata fetch per date field on every flow render.

Scoping note

The set is deliberately limited to date of birth rather than applied to every DATE variant input. The flow builder lets an administrator map a date input to any claim, and claims such as expiry or renewal dates are legitimately in the future. testPrepareStepInputsNoDateValidatorForOtherDateClaims guards this.

Tradeoff

Adding another no-future date claim now needs a code change rather than configuration, and the rule can no longer be switched off per tenant. That is intended here: a date of birth is never legitimately in the future, and the server already enforces it unconditionally, so there is no tenant for which the client should say otherwise.

Leftover data

Tenants provisioned while #8212 was in place will still have disallowFutureDate=true in their claim metadata. Nothing reads it after this change, so it is inert and needs no migration.

Testing

  • Full reactor build and InputValidationServiceTest pass on JDK 21: 63 tests, 0 failures.
  • Checkstyle clean on both changed modules.
  • Six tests cover the new behaviour: rule added for date of birth, not added for another date claim, not added for a non-DATE variant, not added for an input with no claim mapping, appended alongside existing rules, and resolved without any claim metadata lookup.

Related PRs

PR wso2#8212 gated the DateValidator client rule on a disallowFutureDate
claim property seeded from claim-config.xml. That property only lands
when a tenant is provisioned, so existing tenants never received it and
the dynamic registration flow showed no inline error for them, even
though SCIMUserOperationListener already rejects a future date of birth
for every tenant unconditionally. The client hint and the server rule
disagreed.

Resolve the rule in code instead. NO_FUTURE_DATE_CLAIMS holds the claims
that can never carry a future date; it is deliberately limited to date of
birth, since other date claims such as expiry or renewal dates are
legitimately in the future. This drops the disallowFutureDate property,
its claim-config.xml entry, and the per-field claim metadata lookup that
ran on every flow render.
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a875b0e-9bc6-4108-9c29-cb04b940d08b

📥 Commits

Reviewing files that changed from the base of the PR and between 99b94e8 and 1573c28.

📒 Files selected for processing (5)
  • components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/src/main/java/org/wso2/carbon/identity/claim/metadata/mgt/util/ClaimConstants.java
  • components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/Constants.java
  • components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/validation/InputValidationService.java
  • components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/test/java/org/wso2/carbon/identity/flow/execution/engine/validation/InputValidationServiceTest.java
  • features/claim-mgt/org.wso2.carbon.claim.mgt.server.feature/resources/conf/claim-config.xml
💤 Files with no reviewable changes (2)
  • features/claim-mgt/org.wso2.carbon.claim.mgt.server.feature/resources/conf/claim-config.xml
  • components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/src/main/java/org/wso2/carbon/identity/claim/metadata/mgt/util/ClaimConstants.java

📝 Walkthrough

Walkthrough

The flow validation engine now applies future-date validation only to the date-of-birth claim. It no longer reads the disallowFutureDate claim metadata property. Tests cover excluded inputs, metadata independence, and existing validation rules.

Changes

Date-of-birth validation

Layer / File(s) Summary
Date-of-birth claim contract
components/flow-orchestration-framework/.../Constants.java, features/claim-mgt/.../claim-config.xml
The flow engine defines DOB_CLAIM_URI. The Date of Birth claim configuration removes disallowFutureDate.
Fixed date validation
components/flow-orchestration-framework/.../InputValidationService.java
Date validation uses a fixed date-of-birth claim set. Tenant claim-metadata lookup and the tenant parameter in recursive validation are removed.
Validation behavior tests
components/flow-orchestration-framework/.../InputValidationServiceTest.java
Tests cover date-of-birth validation, excluded inputs, metadata independence, and appending DateValidator to existing rules.

Suggested reviewers: hwupathum, thamindur

Merge Risk: ⚪ Minimal · up to 1573c

The change makes date-of-birth future-date validation consistent for all tenants and removes an unnecessary metadata lookup; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the purpose, implementation, scope, tradeoffs, testing, and related PRs, but omits most template sections such as release note, documentation, security checks, and test environment. Add the missing template sections and provide explicit entries for documentation, security checks, certification, training, marketing, samples, migrations, test environment, and learning.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: making the date-of-birth future-date rule fixed instead of configurable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested review from ThaminduR and hwupathum August 14, 2026 10:10
@sonarqubecloud

Copy link
Copy Markdown

@jenkins-is-staging

Copy link
Copy Markdown

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/31792212369

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 53.85%. Comparing base (e95d9f8) to head (1573c28).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
...tion/engine/validation/InputValidationService.java 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #8250      +/-   ##
============================================
+ Coverage     52.56%   53.85%   +1.29%     
- Complexity    20949    21701     +752     
============================================
  Files          2236     2234       -2     
  Lines        137313   131933    -5380     
  Branches      21696    20368    -1328     
============================================
- Hits          72179    71059    -1120     
+ Misses        56245    52218    -4027     
+ Partials       8889     8656     -233     
Flag Coverage Δ
unit 38.93% <93.33%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jenkins-is-staging

Copy link
Copy Markdown

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/31792212369
Status: failure

@jenkins-is-staging

Copy link
Copy Markdown

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/32002460994

@jenkins-is-staging

Copy link
Copy Markdown

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/32006412235

@jenkins-is-staging

Copy link
Copy Markdown

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/32002460994
Status: failure

@jenkins-is-staging

Copy link
Copy Markdown

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/32006412235
Status: success

@jenkins-is-staging jenkins-is-staging left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/32006412235

@RushanNanayakkara
RushanNanayakkara merged commit 39a2933 into wso2:master Aug 17, 2026
6 of 7 checks passed
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.

3 participants