Security review: drafts no longer public, submissions staff-only, safe links, upload sandbox
- Fix: resolveRoute served never-published drafts by URL (Payload's find returns them with _status 'draft') — also via Markdown, MCP get_page and metadata. Drafts are dropped on every branch; `draft: true` for previews. - Fix: getArchiveEntries listed drafts in archive pages despite its comment; `_status: published` is added automatically when the collection has drafts. - form-submissions readable only by editor+ (form-builder default: any account of the admin collection, incl. plain users from an open sign-up); delete admin. - Forms stay public for rendering, but the Emails tab (recipients) is hidden from anonymous REST reads. - safeHref: CMS links only http(s), mailto, tel, sms, #, / — javascript:, data: and control-character tricks are dropped in resolveLinkHref. - Analytics IDs validated in the panel and before reaching the browser. - buildUploadSecurityHeaders: sandbox CSP for /api/<upload>/file/* so an uploaded SVG can't run script on the site's origin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { Field } from 'payload'
|
||||
|
||||
import { validateAnalyticsId } from '../../../modules/analytics/idFormats.js'
|
||||
|
||||
/**
|
||||
* Analytics / marketing tag IDs. All are PUBLIC (exposed client-side), so no
|
||||
* read restriction. Google tags (GA4/GTM) use Consent Mode; the rest load only
|
||||
@@ -13,6 +15,7 @@ export const analyticsFields: Field[] = [
|
||||
description: 'Google Analytics 4 Measurement ID. (Google — Consent Mode)',
|
||||
placeholder: 'G-XXXXXXXXXX',
|
||||
},
|
||||
validate: validateAnalyticsId('ga4MeasurementId', 'G-XXXXXXXXXX'),
|
||||
},
|
||||
{
|
||||
name: 'gtmContainerId',
|
||||
@@ -21,6 +24,7 @@ export const analyticsFields: Field[] = [
|
||||
description: 'Google Tag Manager container ID. (Google — Consent Mode)',
|
||||
placeholder: 'GTM-XXXXXXX',
|
||||
},
|
||||
validate: validateAnalyticsId('gtmContainerId', 'GTM-XXXXXXX'),
|
||||
},
|
||||
{
|
||||
name: 'metaPixelId',
|
||||
@@ -29,6 +33,7 @@ export const analyticsFields: Field[] = [
|
||||
description: 'Meta (Facebook) Pixel ID. Loads only after MARKETING consent.',
|
||||
placeholder: '1234567890123456',
|
||||
},
|
||||
validate: validateAnalyticsId('metaPixelId', '1234567890123456'),
|
||||
},
|
||||
{
|
||||
name: 'clarityProjectId',
|
||||
@@ -37,6 +42,7 @@ export const analyticsFields: Field[] = [
|
||||
description: 'Microsoft Clarity project ID (heatmaps). Loads only after ANALYTICS consent.',
|
||||
placeholder: 'abcdefghij',
|
||||
},
|
||||
validate: validateAnalyticsId('clarityProjectId', 'abcdefghij'),
|
||||
},
|
||||
{
|
||||
name: 'linkedInPartnerId',
|
||||
@@ -45,6 +51,7 @@ export const analyticsFields: Field[] = [
|
||||
description: 'LinkedIn Insight Tag partner ID. Loads only after MARKETING consent.',
|
||||
placeholder: '1234567',
|
||||
},
|
||||
validate: validateAnalyticsId('linkedInPartnerId', '1234567'),
|
||||
},
|
||||
{
|
||||
name: 'tiktokPixelId',
|
||||
@@ -53,5 +60,6 @@ export const analyticsFields: Field[] = [
|
||||
description: 'TikTok Pixel ID. Loads only after MARKETING consent.',
|
||||
placeholder: 'CXXXXXXXXXXXXXXXXXXX',
|
||||
},
|
||||
validate: validateAnalyticsId('tiktokPixelId', 'CXXXXXXXXXXXXXXXXXXX'),
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user