Cookie scanner, phase 2: browser crawl through a shared scanner service
cookieScanner.crawl (opt-in) adds "Crawl site" to the Cookie review box. The
site asks the shared scanner service (services/cookie-crawler: Node +
Playwright, Dockerfile, deployed once on Coolify) to crawl its sitemap pages
twice, with no consent and after "Accept all". The service posts cookies,
storage keys and third-party hosts back to POST /api/ipal/cookie-crawl/results
(bearer token, running job only). No browser in the site.
Findings land as drafts through the same merge rules. Anything stored before
consent that is not necessary, and tracker requests before consent, are
violations, flagged on the review entries from the latest crawl only. The
cookie-crawl global keeps the latest result (no history). A dashboard warning
(CookieCrawlAlert) and an opt-in e-mail through the project's mail adapter
follow a crawl with violations or new unknown cookies. Scheduled crawls: a
Coolify scheduled task with the token. ipalEnvRules({ cookieCrawl: true }).
Also: the six older real-Payload tests no longer leave an orphaned
payload generate:types process (typescript.autoGenerate: false).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4f69f6ed20
commit
4bb9c663fd
+29
-4
@@ -11,7 +11,10 @@ import { buildSiteSettings } from './globals/SiteSettings/index.js'
|
||||
import { adminOnly, adminOrSelf, injectRoles } from './modules/access/index.js'
|
||||
import { buildConsentLogCollection, buildConsentLogEndpoint } from './modules/consent/consentLog.js'
|
||||
import { buildCookieReviewCollection } from './modules/consent/scanner/collection.js'
|
||||
import { buildCookieCrawlEndpoints } from './modules/consent/scanner/crawl/endpoints.js'
|
||||
import { buildCookieCrawlGlobal } from './modules/consent/scanner/crawl/global.js'
|
||||
import { buildCookieScanEndpoints } from './modules/consent/scanner/endpoint.js'
|
||||
import { mergeCookieScanLabels } from './modules/consent/scanner/labels.js'
|
||||
import { buildConstructionFields } from './modules/construction/fields.js'
|
||||
import { buildArchiveFields } from './modules/content/index.js'
|
||||
import { testEmailEndpoint } from './modules/email/test/testEmailEndpoint.js'
|
||||
@@ -317,10 +320,32 @@ export const ipalKit = (options: IpalOptions): Plugin => {
|
||||
if (options.cookieScanner) {
|
||||
const scannerOptions = options.cookieScanner === true ? {} : options.cookieScanner
|
||||
config.collections = [...(config.collections ?? []), applyCollectionOverride(buildCookieReviewCollection(scannerOptions), scannerOptions.collectionOverrides)]
|
||||
config.endpoints = [
|
||||
...(config.endpoints ?? []),
|
||||
...buildCookieScanEndpoints(scannerOptions, { localeCount: options.i18n.locales.length, stats: Boolean(options.stats) }),
|
||||
]
|
||||
const scanPlugin = { localeCount: options.i18n.locales.length, stats: Boolean(options.stats) }
|
||||
config.endpoints = [...(config.endpoints ?? []), ...buildCookieScanEndpoints(scannerOptions, scanPlugin)]
|
||||
// Browser crawl through the scanner service (opt-in): latest-result global, endpoints, dashboard warning.
|
||||
if (scannerOptions.crawl) {
|
||||
const crawl = scannerOptions.crawl === true ? {} : scannerOptions.crawl
|
||||
const labels = mergeCookieScanLabels(scannerOptions.labels)
|
||||
const crawlGlobal = buildCookieCrawlGlobal(labels)
|
||||
const override = crawl.globalOverride
|
||||
config.globals = [
|
||||
...(config.globals ?? []),
|
||||
override ? applyGlobalOverrides([crawlGlobal], { [crawlGlobal.slug]: override } as never)[0] : crawlGlobal,
|
||||
]
|
||||
config.endpoints = [...(config.endpoints ?? []), ...buildCookieCrawlEndpoints({ labels, options: scannerOptions, plugin: scanPlugin })]
|
||||
if (crawl.dashboard !== false) {
|
||||
config.admin = {
|
||||
...(config.admin ?? {}),
|
||||
components: {
|
||||
...(config.admin?.components ?? {}),
|
||||
beforeDashboard: [
|
||||
...(config.admin?.components?.beforeDashboard ?? []),
|
||||
{ path: '@intecion/ipal-kit/admin#CookieCrawlAlert', serverProps: { adminRoute: options.adminRoute ?? '/admin', labels } },
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- built-in statistics: cookieless visits + consented history (opt-in) ---
|
||||
|
||||
Reference in New Issue
Block a user