Files
ipal-kit/src/modules/consent/CookieTable.tsx
T
radoslaw.smolinskiandClaude Opus 5.5 ebf70d49bd Consent: withdrawal clears tool cookies, policy version, consent log, cookie scan; form input hardening
Consent (GDPR)
- Withdrawing consent now deletes GA/Meta/Ads/Clarity/LinkedIn/TikTok/Hotjar
  cookies (prefix patterns) on the host AND parent domains — previously only
  the locale cookie was removed and _ga & co. stayed. Projects extend the list
  via <ConsentProvider cookieMap>, merged with the defaults.
- Cookie Settings → Policy version: raising it asks every visitor again.
- <CookieBanner equalChoice>: Reject styled like Accept (UODO/EDPB), opt-in.
- Opt-in consent log (ipalKit({ consentLog: true }) + logEndpoint): random id,
  choices, version, time — no IP/UA; admin-only collection, retention purge.
- Cookie Settings → Cookies + getCookieTable + unstyled <CookieTable> (/rsc).
- Consent cookie gets Secure on HTTPS; consent id stored with the decision.
- ipal-consent-check: cookie-scan.mjs (before/after consent, known-tool
  catalog PL/EN, flags non-necessary cookies set before consent) and
  import-cookies.ts into the panel (idempotent, keeps editor edits).

Forms
- Server-side type checks per field from the panel definition: email = one
  address (blocks "a@x, b@y" recipient injection into {{email}} confirmations
  and CR/LF header injection), select/radio only configured options, numbers,
  booleans; objects/arrays rejected; control and bidi characters stripped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-16 02:31:58 +02:00

62 lines
2.5 KiB
TypeScript

import type { CookieTableRow } from './getConsentTexts.js'
import type { ConsentTexts } from './texts.js'
export type CookieTableLabels = {
category: string
duration: string
name: string
provider: string
purpose: string
}
type CookieTableProps = {
/** Optional caption above the table. */
caption?: string
/** Category names — pass `texts.categories` from getConsentTexts so they match the banner. */
categories?: ConsentTexts['categories']
/** Classes per element; nothing is styled by default. */
classNames?: Partial<Record<'caption' | 'table' | 'td' | 'th' | 'tr', string>>
/** Column headings in the page's language — from the project (panel field or page content). */
labels: CookieTableLabels
/** From getCookieTable({ payload, locale }) — Cookie Settings → Cookies. */
rows: CookieTableRow[]
}
/**
* The cookie list for the cookie-policy page, straight from the panel — no copy
* pasted into the policy text, so it can't go stale. Plain semantic <table>,
* unstyled: classNames per element, or style it from the page's CSS. Server
* component (no state).
*
* const rows = await getCookieTable({ payload, locale })
* <CookieTable rows={rows} labels={…from the panel…} categories={texts.categories} />
*/
export function CookieTable({ caption, categories, classNames = {}, labels, rows }: CookieTableProps) {
if (rows.length === 0) {return null}
return (
<table className={classNames.table}>
{caption ? <caption className={classNames.caption}>{caption}</caption> : null}
<thead>
<tr className={classNames.tr}>
<th className={classNames.th} scope="col">{labels.name}</th>
<th className={classNames.th} scope="col">{labels.provider}</th>
<th className={classNames.th} scope="col">{labels.category}</th>
<th className={classNames.th} scope="col">{labels.purpose}</th>
<th className={classNames.th} scope="col">{labels.duration}</th>
</tr>
</thead>
<tbody>
{rows.map((row) => (
<tr className={classNames.tr} key={`${row.category}:${row.name}`}>
<td className={classNames.td}><code>{row.name}</code></td>
<td className={classNames.td}>{row.provider ?? ''}</td>
<td className={classNames.td}>{categories?.[row.category]?.title ?? row.category}</td>
<td className={classNames.td}>{row.purpose ?? ''}</td>
<td className={classNames.td}>{row.duration ?? ''}</td>
</tr>
))}
</tbody>
</table>
)
}