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]>
32 lines
1.4 KiB
JavaScript
32 lines
1.4 KiB
JavaScript
#!/usr/bin/env node
|
|
// Same crawl as the service, from a laptop or CI — prints the result as JSON.
|
|
// node cli.mjs <siteUrl> [--pages 20] [--accept '[data-ipal="accept"]'] [--wait 3000]
|
|
// Exit code: 0 = nothing stored before consent but the consent cookie, 1 = something else was, 2 = setup problem.
|
|
// The verdict per cookie needs the site's categories: the panel's "Crawl site" does that.
|
|
import { crawlSite } from './crawl.mjs'
|
|
|
|
const args = process.argv.slice(2)
|
|
const opt = (name, def) => (args.includes(`--${name}`) ? args[args.indexOf(`--${name}`) + 1] : def)
|
|
if (!args[0] || args[0].startsWith('--')) {
|
|
console.error('Usage: node cli.mjs <siteUrl> [--pages N] [--accept selector] [--wait ms]')
|
|
process.exit(2)
|
|
}
|
|
let chromium
|
|
try {
|
|
;({ chromium } = await import('playwright'))
|
|
} catch {
|
|
console.error('Playwright not found: npm install (in services/cookie-crawler) && npx playwright install chromium')
|
|
process.exit(2)
|
|
}
|
|
const result = await crawlSite({
|
|
acceptSelector: opt('accept', '[data-ipal="accept"]'),
|
|
chromium,
|
|
maxPages: Number(opt('pages', 20)),
|
|
siteUrl: args[0],
|
|
waitMs: Number(opt('wait', 3000)),
|
|
})
|
|
console.log(JSON.stringify(result, null, 2))
|
|
const early = result.observations.filter((o) => o.before && o.name !== 'cookie-consent')
|
|
if (early.length) {console.error(`Stored before consent: ${early.map((o) => o.name).join(', ')} — classify them in the panel.`)}
|
|
process.exit(early.length ? 1 : 0)
|