Skip to content

Fix identity field validation schema to prevent field conflicts#8282

Open
Kelsey-Ethyca wants to merge 3 commits into
mainfrom
claude/slack-session-JOKzK
Open

Fix identity field validation schema to prevent field conflicts#8282
Kelsey-Ethyca wants to merge 3 commits into
mainfrom
claude/slack-session-JOKzK

Conversation

@Kelsey-Ethyca
Copy link
Copy Markdown
Contributor

Ticket []

Description Of Changes

This PR fixes a validation schema issue where identity fields (name, email, phone) were always included in the Yup validation schema, even when not configured in identity_inputs. This caused conflicts when custom privacy request fields used the same field names.

The changes ensure that validation rules are only added for identity fields that are actually configured, preventing validation conflicts with custom fields that may share the same keys.

Additionally, phone number validation error messages have been improved to be more descriptive and consistent across the codebase, clarifying the E.164 format requirement.

Code Changes

  • Privacy Request Modal (usePrivacyRequestForm.ts): Refactored identityValidationSchema to conditionally include validation rules only for configured identity fields (name, email, phone)
  • Consent Request Modal (useConsentRequestForm.ts): Applied the same conditional validation schema pattern for email and phone fields
  • Admin UI Form Helpers (helpers.ts): Updated phone validation error message to clarify E.164 format requirement
  • Privacy Center Validation (validation.ts): Updated phone validation error message to be more descriptive and consistent

Steps to Confirm

  1. Test privacy request forms with custom fields that share names with identity fields (e.g., a custom "email" field)
  2. Verify that validation works correctly when identity fields are optional or not configured
  3. Confirm phone number validation error messages display the improved format guidance
  4. Ensure existing privacy request and consent request flows continue to work as expected

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
  • No UX review needed
  • No followup issues
  • No migrations
  • No documentation updates required

https://claude.ai/code/session_017HuVbasMgn5gdt7kUXxLDD

Custom privacy request fields with key "phone" (or "email", "name") were
incorrectly having identity field validation rules applied to them, even
when those identity inputs were not configured. This was because the
identity validation schema unconditionally included validation for all
three fields (name/email/phone), regardless of whether they were present
in identity_inputs.

The fix conditionally includes identity field validations only when the
corresponding identity_input is configured. Also improved the phone
validation error messages to specify the expected E.164 format (e.g.
+15551234567) instead of just "Phone is invalid".

Slack thread: https://ethyca.slack.com/archives/C07JPAXLKV4/p1780003433667269?thread_ts=1780001924.843699&cid=C07JPAXLKV4

https://claude.ai/code/session_017HuVbasMgn5gdt7kUXxLDD
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Preview May 28, 2026 9:36pm
fides-privacy-center Ignored Ignored May 28, 2026 9:36pm

Request Review

@github-actions
Copy link
Copy Markdown

Title Lines Statements Branches Functions
admin-ui Coverage: 11%
8.54% (4061/47512) 7.59% (2096/27582) 5.82% (813/13961)
fides-js Coverage: 78%
79.17% (1977/2497) 66.25% (1249/1885) 73.31% (349/476)
privacy-center Coverage: 88%
86.59% (517/597) 82.33% (247/300) 81.08% (90/111)

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.

2 participants