Security audit fixes for 1.18.0: Markdown negotiation private + Vary: Accept (F3), public lists capped (F4), operator sort names refused (F5), CSP report log normalised and capped (F1), buildUrlField and the reference socials (F2), document locks for staff only

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 16:56:09 +01:00
co-authored by Claude Opus 5.5
parent d2f19095dc
commit e9f9947eb7
20 changed files with 677 additions and 49 deletions
+10 -5
View File
@@ -1,4 +1,5 @@
import { Container } from '@intecion/ipal-kit/blocks/rsc'
import { safeHref } from '@intecion/ipal-kit'
import { NoSnippet } from '@intecion/ipal-kit/rsc'
import Link from 'next/link'
@@ -47,11 +48,15 @@ export async function Footer({ company, footer, locale }: Props) {
<Link className="hover:text-link-hover" href={link.href}>{link.label}</Link>
</li>
))}
{(company.socials ?? []).map((s) => (
<li key={s.url}>
<a className="hover:text-link-hover" href={s.url} rel="noopener noreferrer" target="_blank">{s.label}</a>
</li>
))}
{(company.socials ?? []).flatMap((s) => {
// the field validates; the render checks again (an import or an older version may hold anything)
const href = safeHref(s.url)
return href ? [
<li key={href}>
<a className="hover:text-link-hover" href={href} rel="noopener noreferrer" target="_blank">{s.label}</a>
</li>,
] : []
})}
</ul>
</Container>
</NoSnippet>
+3 -2
View File
@@ -1,6 +1,6 @@
import type { GlobalConfig } from 'payload'
import { adminOrEditor, buildGlobalRevalidateHook, rowLabel } from '@intecion/ipal-kit'
import { adminOrEditor, buildGlobalRevalidateHook, buildUrlField, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** Company data for a PL market site: footer, contact block details, LocalBusiness JSON-LD. */
@@ -33,7 +33,8 @@ export const Company: GlobalConfig = {
labels: { plural: 'Profiles', singular: 'Profile' },
fields: [
{ name: 'label', type: 'text', required: true },
{ name: 'url', type: 'text', required: true },
// rendered into href: https:// only, never javascript: or data: (security.md "Addresses rendered into href")
buildUrlField({ required: true }),
],
},
],
+2 -2
View File
@@ -1,6 +1,6 @@
import { faqItemsFromLayout } from '@intecion/ipal-kit/blocks'
// @starter:if localBusiness
import { buildLocalBusinessJsonLd, createContentHelpers } from '@intecion/ipal-kit'
import { buildLocalBusinessJsonLd, createContentHelpers, isAllowedUrl } from '@intecion/ipal-kit'
import { contentConfig } from '@/content.config'
import { i18nConfig } from '@/i18n.config'
@@ -72,7 +72,7 @@ export const {
address: { city: company.address?.city ?? undefined, country: company.address?.country ?? 'PL', postalCode: company.address?.postalCode ?? undefined, street: company.address?.street ?? undefined },
name: company.name,
openingHours: company.hours ?? undefined,
sameAs: (company.socials ?? []).map((s) => s.url),
sameAs: (company.socials ?? []).map((s) => s.url).filter((url) => isAllowedUrl(url)),
telephone: company.phone ?? undefined,
type: 'ProfessionalService',
url: baseUrl,