ENG-3005: Add Privacy Center configuration UI to Property page#7670
ENG-3005: Add Privacy Center configuration UI to Property page#7670
Conversation
Adds a configurable Privacy Center section to the property edit page, including a live preview panel that updates as the user types. - Extends PropertyFormValues with privacy_center_config and paths - Adds toggle to enable/disable the Privacy Center on a property - Top-level config fields: title, description, logo, favicon, privacy policy URL - Repeatable actions editor with policy key dropdown, identity inputs (email/phone), and custom privacy request fields (Location or Other type) - Repeatable paths field array - Split-pane layout: config form on left, live preview on right Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
| <Box flexShrink={0} mt={0.5}> | ||
| {/* eslint-disable-next-line @next/next/no-img-element */} | ||
| <img | ||
| src={iconPath} |
Check failure
Code scanning / CodeQL
DOM text reinterpreted as HTML High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 days ago
In general, the fix is to ensure that untrusted data used in DOM-related contexts (including URL-bearing attributes like src) are validated and/or sanitized before use. Instead of directly passing user-controlled iconPath into the <img src> attribute, restrict it to a safe set of URL schemes and/or patterns, or fall back to a benign value if it does not meet those constraints.
The best fix here without changing functionality is to add a small helper that “normalizes” the icon path: it will accept only HTTP(S) URLs or relative paths and reject anything else (such as javascript:, data:, or other exotic schemes). If the value is unsafe or malformed, we simply do not render the image. This preserves existing behavior for legitimate values while blocking dangerous ones. The change is localized to ActionCard in PrivacyCenterPreview.tsx.
Concretely:
- Inside
PrivacyCenterPreview.tsx, define a helper function (aboveActionCard) calledsanitizeIconPaththat:- Accepts
string | null | undefined. - Returns
string | undefined. - For empty/falsy values, returns
undefined. - Parses the URL; if it has an explicit scheme, only allows
http:andhttps:. - If parsing fails (e.g., a plain relative path), treat it as a relative URL and allow it.
- Returns
undefinedfor disallowed schemes.
- Accepts
- In
ActionCard, computeconst safeIconPath = sanitizeIconPath(iconPath);and only render the<img>ifsafeIconPathis truthy; usesafeIconPathas thesrcvalue.
No new imports are strictly needed; we can use the built-in URL constructor.
When a user selects default_access_policy, default_erasure_policy, or default_consent_policy and icon_path is currently empty, pre-populate the field with the standard Ethyca privacy center icon URL. A tooltip on the icon_path field shows the default URL for the selected policy key. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ticket ENG-3005
Description Of Changes
Adds a full-featured Privacy Center configuration UI to the property edit page (
/properties/[id]). Previously,privacy_center_configcould only be set via direct API calls.Changes include:
GET /dsr/policy), icon path, title, description, confirm/cancel button text, identity inputs (email/phone with Required toggle), and custom privacy request fieldsNo backend changes needed —
PUT /api/v1/plus/property/{propertyId}already acceptsprivacy_center_configandpathsvia thePropertyCreateschema.Code Changes
src/features/properties/PropertyForm.tsx— ExtendedPropertyFormValueswithprivacy_center_configandpaths; added Privacy Center toggle section and split-pane layout support via optionalrightPanelpropsrc/pages/properties/[id].tsx— Wired inPrivacyCenterPreviewas right panel; removed narrowmaxWidthconstraintsrc/features/properties/privacy-center/helpers.ts—DEFAULT_ACTIONandDEFAULT_PRIVACY_CENTER_CONFIGfactory objectssrc/features/properties/privacy-center/PathsFieldArray.tsx— Repeatable paths editor using FormikFieldArraysrc/features/properties/privacy-center/PrivacyCenterConfigForm.tsx— Top-level config fields + wires inActionsFieldArraysrc/features/properties/privacy-center/ActionsFieldArray.tsx— Repeatable actions editor with add/removesrc/features/properties/privacy-center/ActionEntryForm.tsx— Per-action fields: policy key dropdown, identity inputs, custom fieldssrc/features/properties/privacy-center/CustomPrivacyFieldsArray.tsx— Repeatable custom fields with Location / Other type branchingsrc/features/properties/privacy-center/PrivacyCenterPreview.tsx— Live preview rendering logo, title, description, action cards from Formik contextSteps to Confirm
/properties/[id]/ja) and verify it appearsPUT /api/v1/plus/property/{propertyId}is called withprivacy_center_configandpathsin the payloadPre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works