Default cookie consent to GDPR and track its source

When IP geolocation does not resolve a country, or resolves one with no
known cookie-consent regulation (common on localhost and unmapped
regions), the banner previously fell back to OPT_OUT with no recorded
regulation. Apply GDPR (OPT_IN) as the safe default in that case so the
strictest consent model wins when origin is unknown.

To keep consent records auditable, stamp each one with a regulation
source of DETECTED (resolved from geolocation) or DEFAULT (fell back to
GDPR). The shared cookiebanner.ResolveRegulation helper centralizes the
decision for both the config and consent endpoints, and the new value is
exposed through GraphQL, MCP, the CLI, the n8n node, and the console
consent-records views.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-10 17:48:07 +02:00
parent e3ccb76b03
commit ed9831a734
18 changed files with 315 additions and 64 deletions

View File

@@ -58,6 +58,7 @@ export const cookieBannerConsentRecordPageQuery = graphql`
userAgent
sdkVersion
regulation
regulationSource
countryCode
consentData
createdAt
@@ -159,6 +160,11 @@ export default function CookieBannerConsentRecordPage({
{record.regulation || "-"}
</span>
</PropertyRow>
<PropertyRow label={__("Regulation Source")}>
<span className="font-mono text-sm">
{record.regulationSource || "-"}
</span>
</PropertyRow>
<PropertyRow label={__("Country")}>
<span className="font-mono text-sm">
{record.countryCode || "-"}

View File

@@ -217,6 +217,7 @@ export default function CookieBannerConsentRecordsPage({
<Th>{__("IP Address")}</Th>
<Th>{__("SDK Version")}</Th>
<Th>{__("Regulation")}</Th>
<Th>{__("Source")}</Th>
<Th>{__("Country")}</Th>
<SortableTh field="CREATED_AT">{__("Date")}</SortableTh>
</Tr>

View File

@@ -36,6 +36,7 @@ const consentRecordFragment = graphql`
ipAddress
sdkVersion
regulation
regulationSource
countryCode
createdAt
}
@@ -81,6 +82,11 @@ export function ConsentRecordRow({ recordKey }: ConsentRecordRowProps) {
{record.regulation || "-"}
</span>
</Td>
<Td>
<span className="font-mono text-sm">
{record.regulationSource || "-"}
</span>
</Td>
<Td>
<span className="font-mono text-sm">
{record.countryCode || "-"}