@solvenza/cookies-compliance 1.2.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +960 -36
- package/bin/audit-cli.js +134 -13
- package/dist/audit.cjs +811 -0
- package/dist/audit.cjs.map +1 -0
- package/dist/audit.d.cts +60 -0
- package/dist/audit.d.ts +60 -0
- package/dist/audit.js +380 -0
- package/dist/audit.js.map +1 -0
- package/dist/chunk-C5QPXHTH.js +3557 -0
- package/dist/chunk-C5QPXHTH.js.map +1 -0
- package/dist/chunk-OHOHIAK6.js +442 -0
- package/dist/chunk-OHOHIAK6.js.map +1 -0
- package/dist/chunk-Q3FZFXQE.js +89 -0
- package/dist/chunk-UQU54ANZ.js +225 -0
- package/dist/chunk-UQU54ANZ.js.map +1 -0
- package/dist/chunk-W5MG56VI.js +269 -0
- package/dist/chunk-W5MG56VI.js.map +1 -0
- package/dist/consent.esm.cjs +2195 -84
- package/dist/consent.esm.cjs.map +1 -1
- package/dist/consent.esm.d.cts +173 -6
- package/dist/consent.esm.d.ts +173 -6
- package/dist/consent.esm.js +57 -23
- package/dist/consent.esm.js.map +1 -1
- package/dist/consent.min.js +437 -55
- package/dist/consent.min.js.map +1 -1
- package/dist/presets.cjs +495 -0
- package/dist/presets.cjs.map +1 -0
- package/dist/presets.d.cts +51 -0
- package/dist/presets.d.ts +51 -0
- package/dist/presets.js +16 -0
- package/dist/presets.js.map +1 -0
- package/dist/types--kyI7OOR.d.cts +314 -0
- package/dist/types--kyI7OOR.d.ts +314 -0
- package/dist/wrappers/angular.cjs +2341 -65
- package/dist/wrappers/angular.cjs.map +1 -1
- package/dist/wrappers/angular.d.cts +85 -5
- package/dist/wrappers/angular.d.ts +85 -5
- package/dist/wrappers/angular.js +217 -3
- package/dist/wrappers/angular.js.map +1 -1
- package/dist/wrappers/next.cjs +2353 -103
- package/dist/wrappers/next.cjs.map +1 -1
- package/dist/wrappers/next.d.cts +25 -1
- package/dist/wrappers/next.d.ts +25 -1
- package/dist/wrappers/next.js +30 -5
- package/dist/wrappers/next.js.map +1 -1
- package/dist/wrappers/nuxt.cjs +4171 -0
- package/dist/wrappers/nuxt.cjs.map +1 -0
- package/dist/wrappers/nuxt.d.cts +33 -0
- package/dist/wrappers/nuxt.d.ts +33 -0
- package/dist/wrappers/nuxt.js +51 -0
- package/dist/wrappers/nuxt.js.map +1 -0
- package/dist/wrappers/react.cjs +2336 -141
- package/dist/wrappers/react.cjs.map +1 -1
- package/dist/wrappers/react.d.cts +87 -1
- package/dist/wrappers/react.d.ts +87 -1
- package/dist/wrappers/react.js +21 -51
- package/dist/wrappers/react.js.map +1 -1
- package/dist/wrappers/vue.cjs +4163 -0
- package/dist/wrappers/vue.cjs.map +1 -0
- package/dist/wrappers/vue.d.cts +144 -0
- package/dist/wrappers/vue.d.ts +144 -0
- package/dist/wrappers/vue.js +28 -0
- package/dist/wrappers/vue.js.map +1 -0
- package/dist/wrappers/wordpress.js +1 -1
- package/package.json +26 -5
- package/schema.json +143 -4
- package/dist/chunk-DDAAVRWG.js +0 -25
- package/dist/chunk-FBRP4MSA.js +0 -1907
- package/dist/chunk-FBRP4MSA.js.map +0 -1
- package/dist/consent-engine-DOMyEKfk.d.cts +0 -193
- package/dist/consent-engine-DOMyEKfk.d.ts +0 -193
- /package/dist/{chunk-DDAAVRWG.js.map → chunk-Q3FZFXQE.js.map} +0 -0
package/bin/audit-cli.js
CHANGED
|
@@ -1,25 +1,146 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Solvenza Cookies Compliance Audit CLI
|
|
5
|
-
*
|
|
4
|
+
* Solvenza Cookies Compliance Audit CLI & GitHub Action Runner
|
|
5
|
+
* Automated LSSI art. 22.2, RGPD & AEPD Compliance Auditor.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import * as fs from "node:fs";
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
import { LssiAuditor } from "../dist/audit.js";
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
async function run() {
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
|
|
15
|
+
let configPath = "consent.json";
|
|
16
|
+
let srcDir = "src";
|
|
17
|
+
let url = undefined;
|
|
18
|
+
let failOnError = true;
|
|
19
|
+
let outputJson = false;
|
|
20
|
+
|
|
21
|
+
for (let i = 0; i < args.length; i++) {
|
|
22
|
+
const arg = args[i];
|
|
23
|
+
if (arg === "--config" && args[i + 1]) {
|
|
24
|
+
configPath = args[++i];
|
|
25
|
+
} else if (arg === "--src" && args[i + 1]) {
|
|
26
|
+
srcDir = args[++i];
|
|
27
|
+
} else if (arg === "--url" && args[i + 1]) {
|
|
28
|
+
url = args[++i];
|
|
29
|
+
} else if (arg === "--no-fail" || arg === "--fail-on-error=false") {
|
|
30
|
+
failOnError = false;
|
|
31
|
+
} else if (arg === "--fail-on-error=true") {
|
|
32
|
+
failOnError = true;
|
|
33
|
+
} else if (arg === "--json") {
|
|
34
|
+
outputJson = true;
|
|
35
|
+
} else if (arg.startsWith("http://") || arg.startsWith("https://")) {
|
|
36
|
+
url = arg;
|
|
37
|
+
} else if (arg === "--help" || arg === "-h") {
|
|
38
|
+
printHelp();
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Also support GitHub Actions input environment variables
|
|
44
|
+
if (process.env.INPUT_CONFIG_PATH) configPath = process.env.INPUT_CONFIG_PATH;
|
|
45
|
+
if (process.env.INPUT_SRC_DIR) srcDir = process.env.INPUT_SRC_DIR;
|
|
46
|
+
if (process.env.INPUT_URL) url = process.env.INPUT_URL;
|
|
47
|
+
if (process.env.INPUT_FAIL_ON_ERROR !== undefined) {
|
|
48
|
+
failOnError = process.env.INPUT_FAIL_ON_ERROR !== "false";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const report = await LssiAuditor.audit({
|
|
52
|
+
configPath: fs.existsSync(path.resolve(configPath)) ? configPath : undefined,
|
|
53
|
+
srcDir: fs.existsSync(path.resolve(srcDir)) ? srcDir : undefined,
|
|
54
|
+
url,
|
|
55
|
+
failOnError,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (outputJson) {
|
|
59
|
+
console.log(JSON.stringify(report, null, 2));
|
|
60
|
+
} else {
|
|
61
|
+
printConsoleReport(report);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// If running inside GitHub Actions:
|
|
65
|
+
if (process.env.GITHUB_STEP_SUMMARY) {
|
|
66
|
+
try {
|
|
67
|
+
const summaryMd = LssiAuditor.formatGitHubSummary(report);
|
|
68
|
+
fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, summaryMd + "\n");
|
|
69
|
+
} catch {}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Emit GitHub Actions annotations
|
|
73
|
+
for (const f of report.findings) {
|
|
74
|
+
if (f.severity === "CRITICAL") {
|
|
75
|
+
console.log(`::error file=${f.file || ""},line=${f.line || 1},title=[${f.rule}]::${f.message}`);
|
|
76
|
+
} else if (f.severity === "WARNING") {
|
|
77
|
+
console.log(`::warning file=${f.file || ""},line=${f.line || 1},title=[${f.rule}]::${f.message}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Set GitHub Actions outputs
|
|
82
|
+
if (process.env.GITHUB_OUTPUT) {
|
|
83
|
+
try {
|
|
84
|
+
fs.appendFileSync(process.env.GITHUB_OUTPUT, `compliant=${report.compliant}\n`);
|
|
85
|
+
fs.appendFileSync(process.env.GITHUB_OUTPUT, `score=${report.score}\n`);
|
|
86
|
+
fs.appendFileSync(process.env.GITHUB_OUTPUT, `violations-count=${report.summary.critical}\n`);
|
|
87
|
+
} catch {}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (failOnError && !report.compliant) {
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function printConsoleReport(report) {
|
|
96
|
+
console.log(`\n================================================================`);
|
|
97
|
+
console.log(`🛡️ SOLVENZA COOKIES COMPLIANCE - AUDITORÍA LSSI & AEPD`);
|
|
98
|
+
console.log(`================================================================\n`);
|
|
99
|
+
console.log(`Puntuación de Cumplimiento: ${report.score} / 100`);
|
|
100
|
+
console.log(`Estado: ${report.compliant ? "✅ CUMPLIMIENTO VÁLIDO" : "❌ VIOLACIONES DETECTADAS"}`);
|
|
101
|
+
console.log(`Archivos escaneados: ${report.scannedFilesCount}\n`);
|
|
102
|
+
console.log(`Resumen de hallazgos:`);
|
|
103
|
+
console.log(` 🔴 Críticos (Riesgo sanción): ${report.summary.critical}`);
|
|
104
|
+
console.log(` 🟡 Advertencias (Técnicas): ${report.summary.warnings}`);
|
|
105
|
+
console.log(` 🔵 Información: ${report.summary.info}\n`);
|
|
106
|
+
|
|
107
|
+
if (report.findings.length > 0) {
|
|
108
|
+
console.log(`Detalle de incidencias:`);
|
|
109
|
+
report.findings.forEach((f, idx) => {
|
|
110
|
+
const icon = f.severity === "CRITICAL" ? "🔴 [CRÍTICO]" : f.severity === "WARNING" ? "🟡 [ADVERTENCIA]" : "🔵 [INFO]";
|
|
111
|
+
console.log(`\n${idx + 1}. ${icon} ${f.rule}: ${f.message}`);
|
|
112
|
+
if (f.file) console.log(` Ubicación: ${f.file}${f.line ? `:${f.line}` : ""}`);
|
|
113
|
+
if (f.details) console.log(` Detalle: ${f.details}`);
|
|
114
|
+
if (f.remediation) console.log(` Solución: ${f.remediation}`);
|
|
115
|
+
});
|
|
116
|
+
console.log(`\n----------------------------------------------------------------\n`);
|
|
117
|
+
} else {
|
|
118
|
+
console.log(`🎉 ¡Excelente! Todos los recursos cumplen con el aislamiento previo al consentimiento.\n`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function printHelp() {
|
|
11
123
|
console.log(`
|
|
12
124
|
🛡️ Solvenza Cookies Compliance Audit CLI
|
|
13
|
-
Uso: npx @solvenza/cookies-compliance/consent-audit <URL>
|
|
14
125
|
|
|
15
|
-
|
|
16
|
-
|
|
126
|
+
Uso:
|
|
127
|
+
consent-audit [opciones] [URL]
|
|
128
|
+
|
|
129
|
+
Opciones:
|
|
130
|
+
--config <ruta> Ruta al archivo consent.json (por defecto: ./consent.json)
|
|
131
|
+
--src <directorio> Directorio con código fuente a escanear (por defecto: ./src)
|
|
132
|
+
--url <url> URL viva o entorno de preview para auditar fugas
|
|
133
|
+
--no-fail No salir con código de error (exit 1) aunque existan violaciones
|
|
134
|
+
--json Imprimir reporte en formato JSON
|
|
135
|
+
--help, -h Mostrar esta ayuda
|
|
136
|
+
|
|
137
|
+
Ejemplos:
|
|
138
|
+
consent-audit --config ./consent.json --src ./src
|
|
139
|
+
consent-audit --url https://mi-sitio-web.com
|
|
17
140
|
`);
|
|
18
|
-
process.exit(1);
|
|
19
141
|
}
|
|
20
142
|
|
|
21
|
-
|
|
22
|
-
console.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
console.log(`\nAuditoría completada con éxito. Estado: CUMPLIMIENTO CORRECTO (0 fugas detectadas).\n`);
|
|
143
|
+
run().catch((err) => {
|
|
144
|
+
console.error("Error fatal durante la auditoría:", err);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
});
|