Fix identity field validation schema to prevent field conflicts#8282
Open
Kelsey-Ethyca wants to merge 3 commits into
Open
Fix identity field validation schema to prevent field conflicts#8282Kelsey-Ethyca wants to merge 3 commits into
Kelsey-Ethyca wants to merge 3 commits into
Conversation
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
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Use the new changelog YAML format instead of editing CHANGELOG.md https://claude.ai/code/session_017HuVbasMgn5gdt7kUXxLDD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
usePrivacyRequestForm.ts): RefactoredidentityValidationSchemato conditionally include validation rules only for configured identity fields (name, email, phone)useConsentRequestForm.ts): Applied the same conditional validation schema pattern for email and phone fieldshelpers.ts): Updated phone validation error message to clarify E.164 format requirementvalidation.ts): Updated phone validation error message to be more descriptive and consistentSteps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedhttps://claude.ai/code/session_017HuVbasMgn5gdt7kUXxLDD