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]>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { createContext, type ReactNode, use } from 'react'
|
||||
|
||||
import type { ConsentTexts } from './texts.js'
|
||||
import type { ConsentCookieMap } from './useConsent.js'
|
||||
|
||||
import { useConsent } from './useConsent.js'
|
||||
|
||||
@@ -9,8 +10,34 @@ type ConsentContextValue = { texts: ConsentTexts } & ReturnType<typeof useConsen
|
||||
|
||||
const ConsentContext = createContext<ConsentContextValue | null>(null)
|
||||
|
||||
export function ConsentProvider({ children, texts }: { children: ReactNode; texts: ConsentTexts }) {
|
||||
const consent = useConsent()
|
||||
type ConsentProviderProps = {
|
||||
children: ReactNode
|
||||
/** Extra cookies per category to delete when consent is withdrawn — merged with the built-in list. */
|
||||
cookieMap?: ConsentCookieMap
|
||||
/**
|
||||
* Consent log endpoint (createConsentLogEndpoint, e.g. '/api/ipal/consent'):
|
||||
* every decision is POSTed — random id, choices, policy version, no personal
|
||||
* data — so the site can demonstrate consent (GDPR Art. 7(1)). Off when omitted.
|
||||
*/
|
||||
logEndpoint?: string
|
||||
texts: ConsentTexts
|
||||
}
|
||||
|
||||
export function ConsentProvider({ children, cookieMap, logEndpoint, texts }: ConsentProviderProps) {
|
||||
const consent = useConsent({
|
||||
cookieMap,
|
||||
onDecision: logEndpoint
|
||||
? (record) => {
|
||||
void fetch(logEndpoint, {
|
||||
body: JSON.stringify(record),
|
||||
headers: { 'content-type': 'application/json' },
|
||||
keepalive: true,
|
||||
method: 'POST',
|
||||
}).catch(() => {})
|
||||
}
|
||||
: undefined,
|
||||
version: texts.version,
|
||||
})
|
||||
return <ConsentContext value={{ ...consent, texts }}>{children}</ConsentContext>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user