@efraindrummer/ghostdeps 0.3.0 → 0.4.0
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/CHANGELOG.md +10 -0
- package/README.md +89 -4
- package/dist/cli.js +191 -8
- package/dist/clients/npm.js +34 -0
- package/dist/diff/inspect.js +223 -0
- package/dist/fix/remediator.js +124 -0
- package/dist/parser/lockfile.js +165 -4
- package/dist/render/html.js +562 -0
- package/dist/render/sarif.js +6 -0
- package/dist/scoring/scoring.js +10 -0
- package/dist/scoring/signals.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Formato basado en [Keep a Changelog](https://keepachangelog.com/es-ES/1.1.0/) y [SemVer](https://semver.org/lang/es/).
|
|
4
4
|
|
|
5
|
+
## [0.4.0] - 2026-11-25
|
|
6
|
+
|
|
7
|
+
### Añadido
|
|
8
|
+
- **Detección de Lifecycle Scripts sospechosos**: inspección heurística de scripts (`preinstall`, `install`, `postinstall`) para detectar descargas remotas (`curl`, `wget`), ejecución de shells (`powershell`, `cmd.exe`, `bash`), ofuscación o evaluación en memoria (`eval`, `Buffer.from`, `base64`) y acceso a credenciales (`.env`, `.ssh`). Penalización configurable (`suspiciousScripts`, -35 pts) y regla SARIF `GD011`.
|
|
9
|
+
- **Soporte completo para `pnpm-lock.yaml`**: resolución recursiva de dependencias transitivas deduplicadas respetando `--depth` y árbol de procedencia (`via`). Soporta ahora los 3 grandes del ecosistema: `npm`, `yarn` y `pnpm`.
|
|
10
|
+
- **Reporte visual interactivo y autónomo en HTML (`--html` o `-f html`)**: informe web 100% self-contained (cero CDNs externas o dependencias remotas) con filtrado instantáneo por nivel de riesgo, búsqueda reactiva, visualización de scripts de instalación y enlaces de auditoría.
|
|
11
|
+
- **Subcomando de remediación automática (`ghostdeps fix`)**: genera e inyecta `overrides` (npm), `resolutions` (yarn) o `pnpm.overrides` (pnpm) en `package.json` para neutralizar dependencias transitivas vulnerables o críticas. Admite `--dry-run`, `--no-backup` y `--override <pkg=ver>`.
|
|
12
|
+
- **Inspector forense de diferencias entre versiones (`ghostdeps diff <paquete>`)**: comparativa de seguridad entre versiones de un paquete en npm. Alerta si cambió de publicador (`_npmUser`), adición de scripts sospechosos, nuevos mantenedores o cambios abruptos de repositorio. Admite análisis forense asistido por IA (`--ai`).
|
|
13
|
+
- **GitHub Action oficial (`action.yml`)**: permite integrar GhostDeps en flujos de CI/CD de GitHub (`uses: efraindrummer/ghostdeps@v0.4.0`) con soporte nativo para reportes en Markdown en el PR Summary y SARIF para GitHub Code Scanning.
|
|
14
|
+
|
|
5
15
|
## [0.3.0] - 2026-11-25
|
|
6
16
|
|
|
7
17
|
### Añadido
|
package/README.md
CHANGED
|
@@ -117,12 +117,13 @@ ghostdeps --version
|
|
|
117
117
|
| `-p, --path <dir>` | Directorio con el `package.json` | directorio actual |
|
|
118
118
|
| `--config <file>` | Archivo de configuración explícito | autodetección |
|
|
119
119
|
| `-d, --dev` | Incluye también `devDependencies` | `false` |
|
|
120
|
-
| `-t, --transitive` | Incluye dependencias transitivas (requiere `package-lock.json`) | `false` |
|
|
120
|
+
| `-t, --transitive` | Incluye dependencias transitivas (requiere `package-lock.json`, `yarn.lock` o `pnpm-lock.yaml`) | `false` |
|
|
121
121
|
| `--depth <n>` | Profundidad máxima con `--transitive` (1 = solo directas) | sin límite |
|
|
122
122
|
| `-i, --ignore <lista>` | Paquetes a omitir, separados por coma; admite `*` | — |
|
|
123
|
-
| `-f, --format <fmt>` | `table`, `json` o `
|
|
123
|
+
| `-f, --format <fmt>` | `table`, `json`, `markdown`, `sarif` o `html` | `table` |
|
|
124
124
|
| `--json` | Atajo de `--format json` | `false` |
|
|
125
|
-
|
|
|
125
|
+
| `--html [file]` | Genera informe interactivo en HTML (atajo de `--format html`) | `false` |
|
|
126
|
+
| `-o, --output <file>` | Escribe el informe en un archivo (sin colores ANSI) | stdout |
|
|
126
127
|
| `--fail-under <score>` | Exit code `1` si algún paquete **evaluado** tiene score menor | — |
|
|
127
128
|
| `-c, --concurrency <n>` | Paquetes analizados en paralelo (1–32) | `4` |
|
|
128
129
|
| `--explain` | Desglose de penalizaciones de cada paquete | `false` |
|
|
@@ -214,7 +215,7 @@ Cómo funciona:
|
|
|
214
215
|
- Reproduce la resolución de Node (`node_modules` anidados y *hoisting*) sobre el lockfile y recorre el grafo en anchura.
|
|
215
216
|
- Cada paquete se analiza **una sola vez** aunque aparezca varias veces en el árbol (se deduplica por nombre).
|
|
216
217
|
- Los paquetes instalados desde git o `file:` se marcan como *No evaluable*; los *workspaces* (`link: true`) no se recorren.
|
|
217
|
-
- Soporta `package-lock.json` (npm ≥ 7 v2/v3)
|
|
218
|
+
- Soporta `package-lock.json` (npm ≥ 7 v2/v3), `yarn.lock` (Yarn v1) y `pnpm-lock.yaml` (pnpm v5/v6/v9).
|
|
218
219
|
|
|
219
220
|
> [!TIP]
|
|
220
221
|
> Un árbol típico tiene cientos de paquetes (~3 peticiones a GitHub cada uno). Usa **siempre** `GITHUB_TOKEN`, y combina `--depth` e `ignore` para acotar. La caché hace que las ejecuciones siguientes sean casi instantáneas.
|
|
@@ -332,6 +333,7 @@ Una vez configurado, tu agente de IA puede auditar proyectos automáticamente cu
|
|
|
332
333
|
| `table` (default) | Terminal, con colores | `ghostdeps` |
|
|
333
334
|
| `json` | Integraciones, scripts, dashboards | `ghostdeps --json > report.json` |
|
|
334
335
|
| `markdown` | Comentarios de PR, `$GITHUB_STEP_SUMMARY`, wikis | `ghostdeps -f markdown -o ghostdeps.md` |
|
|
336
|
+
| `html` | Reporte visual interactivo y autónomo para CI / auditorías | `ghostdeps --html reporte.html` |
|
|
335
337
|
| `sarif` | GitHub Code Scanning / Security alerts | `ghostdeps -f sarif -o ghostdeps.sarif` |
|
|
336
338
|
|
|
337
339
|
En todos los formatos, el informe va a **stdout** (o al archivo de `-o`) y los avisos/progreso a **stderr**, así que se puede redirigir o encadenar sin problemas.
|
|
@@ -415,6 +417,89 @@ Reglas SARIF incluidas:
|
|
|
415
417
|
- `GD008`: Publicador nuevo no habitual (`warning`)
|
|
416
418
|
- `GD009`: Patrón combinado de secuestro/hijacking (`error`)
|
|
417
419
|
- `GD010`: Publicación desactualizada en npm (`note`)
|
|
420
|
+
- `GD011`: Script de ciclo de vida de instalación potencialmente peligroso (`error`)
|
|
421
|
+
|
|
422
|
+
#### Reporte Visual Autónomo en HTML (`--html`)
|
|
423
|
+
|
|
424
|
+
Genera un reporte web 100% self-contained (sin dependencias externas ni fuentes en la nube, ideal para entornos air-gapped o artefactos de CI):
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
ghostdeps --transitive --html reporte-seguridad.html
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Incluye:
|
|
431
|
+
- **Filtrado reactivo instantáneo:** Botones para filtrar por Crítico, Precaución, Saludable o solo dependencias con Lifecycle Scripts.
|
|
432
|
+
- **Buscador interactivo:** Filtra en tiempo real por nombre de paquete o alertas.
|
|
433
|
+
- **Acordeón de detalles:** Al hacer clic en cualquier fila, se expanden penalizaciones exactas, comandos ejecutados en `postinstall`, trazabilidad de transitivas y enlaces directos a npm y GitHub.
|
|
434
|
+
|
|
435
|
+
### Remediación Automática (`ghostdeps fix`)
|
|
436
|
+
|
|
437
|
+
Aísla o actualiza dependencias transitivas vulnerables o críticas inyectando resoluciones forzadas en tu `package.json`:
|
|
438
|
+
- **npm:** genera bloque `overrides`
|
|
439
|
+
- **yarn:** genera bloque `resolutions`
|
|
440
|
+
- **pnpm:** genera bloque `pnpm.overrides`
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# Vista previa sin modificar archivos
|
|
444
|
+
ghostdeps fix --dry-run
|
|
445
|
+
|
|
446
|
+
# Aplicar automáticamente overrides propuestos por el escáner (crea package.json.bak)
|
|
447
|
+
ghostdeps fix
|
|
448
|
+
|
|
449
|
+
# Inyectar un override manual específico
|
|
450
|
+
ghostdeps fix --override "vulnerable-dep=^2.0.4"
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Inspección Forense de Versiones (`ghostdeps diff <paquete>`)
|
|
454
|
+
|
|
455
|
+
Permite auditar qué cambió exactamente entre dos versiones publicadas en npm de cualquier paquete, detectando cambios bruscos o patrones de secuestro de cuentas (account hijacking):
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
# Comparar la última versión con la inmediata anterior
|
|
459
|
+
ghostdeps diff event-stream
|
|
460
|
+
|
|
461
|
+
# Comparar versiones específicas
|
|
462
|
+
ghostdeps diff event-stream --from 3.3.5 --to 3.3.6
|
|
463
|
+
|
|
464
|
+
# Auditoría asistida por IA
|
|
465
|
+
ghostdeps diff ua-parser-js --from 0.7.28 --to 0.7.29 --ai
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Detecta y alerta sobre:
|
|
469
|
+
- Cambio de publicador (`_npmUser`)
|
|
470
|
+
- Modificaciones en scripts de instalación (`preinstall`, `install`, `postinstall`)
|
|
471
|
+
- Nuevos mantenedores añadidos o dados de baja
|
|
472
|
+
- Nuevas dependencias agregadas
|
|
473
|
+
- Alteración de URL de repositorio o redirecciones
|
|
474
|
+
|
|
475
|
+
### GitHub Action Oficial (`action.yml`)
|
|
476
|
+
|
|
477
|
+
Puedes integrar GhostDeps directamente en tus workflows de GitHub Actions:
|
|
478
|
+
|
|
479
|
+
```yaml
|
|
480
|
+
# .github/workflows/security.yml
|
|
481
|
+
name: GhostDeps Security Audit
|
|
482
|
+
|
|
483
|
+
on:
|
|
484
|
+
pull_request:
|
|
485
|
+
branches: [main]
|
|
486
|
+
push:
|
|
487
|
+
branches: [main]
|
|
488
|
+
|
|
489
|
+
jobs:
|
|
490
|
+
audit:
|
|
491
|
+
runs-on: ubuntu-latest
|
|
492
|
+
steps:
|
|
493
|
+
- uses: actions/checkout@v4
|
|
494
|
+
|
|
495
|
+
- name: Run GhostDeps Audit
|
|
496
|
+
uses: efraindrummer/ghostdeps@v0.4.0
|
|
497
|
+
with:
|
|
498
|
+
fail-under: '60'
|
|
499
|
+
transitive: 'true'
|
|
500
|
+
format: 'markdown'
|
|
501
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
502
|
+
```
|
|
418
503
|
|
|
419
504
|
### Cómo leer la tabla
|
|
420
505
|
|
package/dist/cli.js
CHANGED
|
@@ -12,10 +12,13 @@ import { GitHubClient } from './clients/github.js';
|
|
|
12
12
|
import { RateLimitGate } from './clients/http.js';
|
|
13
13
|
import { NpmClient } from './clients/npm.js';
|
|
14
14
|
import { createIgnoreMatcher, loadConfig } from './config.js';
|
|
15
|
+
import { inspectPackageDiff } from './diff/inspect.js';
|
|
15
16
|
import { GhostDepsError, errorMessage } from './errors.js';
|
|
17
|
+
import { applyFixPlan, createFixPlan, detectPackageManager, generateProposals } from './fix/remediator.js';
|
|
16
18
|
import { startMcpServer } from './mcp/server.js';
|
|
17
19
|
import { readLockfile, resolveTransitive } from './parser/lockfile.js';
|
|
18
20
|
import { readManifest } from './parser/manifest.js';
|
|
21
|
+
import { renderHtml } from './render/html.js';
|
|
19
22
|
import { renderMarkdown } from './render/markdown.js';
|
|
20
23
|
import { renderSarif } from './render/sarif.js';
|
|
21
24
|
import { renderExplain, renderSummary, renderTable } from './render/table.js';
|
|
@@ -56,8 +59,16 @@ async function run(opts, command, version) {
|
|
|
56
59
|
return new Promise(() => { }); // Escuchar indefinidamente sobre stdio
|
|
57
60
|
}
|
|
58
61
|
const fromCli = (key) => command.getOptionValueSource(key) === 'cli';
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
let format = opts.format;
|
|
63
|
+
if (opts.json)
|
|
64
|
+
format = 'json';
|
|
65
|
+
if (opts.html) {
|
|
66
|
+
format = 'html';
|
|
67
|
+
if (typeof opts.html === 'string' && !opts.output) {
|
|
68
|
+
opts.output = opts.html;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const quiet = format !== 'table';
|
|
61
72
|
// --- Configuración efectiva: CLI > archivo > defaults ---
|
|
62
73
|
const config = await loadConfig(opts.path, opts.config);
|
|
63
74
|
const dev = fromCli('dev') ? opts.dev : (config.dev ?? opts.dev);
|
|
@@ -177,6 +188,16 @@ async function run(opts, command, version) {
|
|
|
177
188
|
rendered += `\n\n### 🤖 Recomendaciones de Ciberseguridad (${aiResult.provider} / ${aiResult.model})\n\n${aiResult.analysis}\n`;
|
|
178
189
|
}
|
|
179
190
|
}
|
|
191
|
+
else if (format === 'html') {
|
|
192
|
+
rendered = renderHtml(sorted, summary, now, {
|
|
193
|
+
version,
|
|
194
|
+
projectName: manifest.projectName,
|
|
195
|
+
thresholds: config.thresholds,
|
|
196
|
+
failUnder,
|
|
197
|
+
failing,
|
|
198
|
+
ignored,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
180
201
|
else if (format === 'sarif') {
|
|
181
202
|
rendered = renderSarif(sorted, {
|
|
182
203
|
version,
|
|
@@ -231,11 +252,12 @@ async function main() {
|
|
|
231
252
|
.option('-p, --path <dir>', 'directorio que contiene el package.json', process.cwd())
|
|
232
253
|
.option('--config <file>', 'archivo de configuración (por defecto .ghostdepsrc.json o "ghostdeps" en package.json)')
|
|
233
254
|
.option('-d, --dev', 'incluir también devDependencies', false)
|
|
234
|
-
.option('-t, --transitive', 'incluir dependencias transitivas (requiere package-lock.json)', false)
|
|
255
|
+
.option('-t, --transitive', 'incluir dependencias transitivas (requiere package-lock.json, yarn.lock o pnpm-lock.yaml)', false)
|
|
235
256
|
.option('--depth <n>', 'profundidad máxima con --transitive (1 = solo directas)', positiveInt('--depth', 100))
|
|
236
257
|
.option('-i, --ignore <paquetes>', 'paquetes a omitir, separados por coma; admite * (ej. "@types/*")', collectList, [])
|
|
237
|
-
.addOption(new Option('-f, --format <formato>', 'formato de salida').choices(['table', 'json', 'markdown', 'sarif']).default('table'))
|
|
258
|
+
.addOption(new Option('-f, --format <formato>', 'formato de salida').choices(['table', 'json', 'markdown', 'sarif', 'html']).default('table'))
|
|
238
259
|
.option('--json', 'atajo de --format json', false)
|
|
260
|
+
.option('--html [file]', 'generar informe interactivo en HTML (atajo de --format html)')
|
|
239
261
|
.option('-o, --output <file>', 'escribir el informe en un archivo en lugar de stdout')
|
|
240
262
|
.option('--fail-under <score>', 'exit code 1 si algún paquete evaluado queda por debajo del score', scoreArg)
|
|
241
263
|
.option('-c, --concurrency <n>', 'paquetes analizados en paralelo', positiveInt('--concurrency', 32), 4)
|
|
@@ -250,13 +272,17 @@ async function main() {
|
|
|
250
272
|
.option('--mcp', 'iniciar servidor MCP (Model Context Protocol) sobre stdio para agentes de IA', false)
|
|
251
273
|
.addHelpText('after', [
|
|
252
274
|
'',
|
|
275
|
+
'Subcomandos:',
|
|
276
|
+
' ghostdeps fix Inyecta overrides/resolutions en package.json para corregir dependencias críticas',
|
|
277
|
+
' ghostdeps diff <paquete> Compara dos versiones de un paquete en npm para detectar secuestros o scripts maliciosos',
|
|
278
|
+
'',
|
|
253
279
|
'Ejemplos:',
|
|
280
|
+
' ghostdeps --transitive --format html -o reporte.html',
|
|
254
281
|
' ghostdeps --dev --explain',
|
|
255
|
-
' ghostdeps
|
|
282
|
+
' ghostdeps fix --dry-run',
|
|
283
|
+
' ghostdeps diff event-stream --from 3.3.5 --to 3.3.6',
|
|
256
284
|
' ghostdeps --ai',
|
|
257
285
|
' ghostdeps --mcp',
|
|
258
|
-
' ghostdeps --format markdown -o ghostdeps.md',
|
|
259
|
-
' ghostdeps --fail-under 40',
|
|
260
286
|
'',
|
|
261
287
|
'Variables de entorno:',
|
|
262
288
|
' GITHUB_TOKEN / GH_TOKEN token de GitHub (recomendado; 5000 req/h)',
|
|
@@ -270,6 +296,164 @@ async function main() {
|
|
|
270
296
|
.action(async (opts, command) => {
|
|
271
297
|
process.exitCode = await run(opts, command, version);
|
|
272
298
|
});
|
|
299
|
+
// --- Subcomando: ghostdeps fix ---
|
|
300
|
+
program
|
|
301
|
+
.command('fix')
|
|
302
|
+
.description('Genera o inyecta overrides/resolutions en package.json para remediar dependencias críticas o vulnerables.')
|
|
303
|
+
.option('-p, --path <dir>', 'directorio que contiene el package.json', process.cwd())
|
|
304
|
+
.option('--dry-run', 'muestra los cambios propuestos sin modificar package.json', false)
|
|
305
|
+
.option('--no-backup', 'no generar archivo package.json.bak de respaldo')
|
|
306
|
+
.addOption(new Option('--pm <manager>', 'gestor de paquetes forzado').choices(['npm', 'yarn', 'pnpm']))
|
|
307
|
+
.option('--override <pkg=version...>', 'overrides manuales en formato paquete=versión', collectList, [])
|
|
308
|
+
.action(async (cmdOpts) => {
|
|
309
|
+
const targetDir = path.resolve(cmdOpts.path);
|
|
310
|
+
const pkgJsonPath = path.resolve(targetDir, 'package.json');
|
|
311
|
+
const pm = cmdOpts.pm ?? (await detectPackageManager(targetDir));
|
|
312
|
+
const customOverrides = {};
|
|
313
|
+
for (const item of cmdOpts.override) {
|
|
314
|
+
const [pkg, ver] = item.split('=');
|
|
315
|
+
if (pkg && ver)
|
|
316
|
+
customOverrides[pkg.trim()] = ver.trim();
|
|
317
|
+
}
|
|
318
|
+
log(chalk.bold(`\n🔧 GhostDeps Fix — Gestor detectado: ${chalk.cyan(pm)}`));
|
|
319
|
+
const manifest = await readManifest(targetDir, { includeDev: false });
|
|
320
|
+
let all = manifest.dependencies;
|
|
321
|
+
try {
|
|
322
|
+
const { lock } = await readLockfile(targetDir);
|
|
323
|
+
const trans = resolveTransitive(lock, manifest.dependencies, { maxDepth: Number.POSITIVE_INFINITY });
|
|
324
|
+
all = [...manifest.dependencies, ...trans];
|
|
325
|
+
}
|
|
326
|
+
catch {
|
|
327
|
+
// Sin lockfile se analizan directas
|
|
328
|
+
}
|
|
329
|
+
const cache = new DiskCache(defaultCacheDir(), 24 * 3_600_000, true);
|
|
330
|
+
const npm = new NpmClient({ cache, timeoutMs: 15_000, retries: 2, userAgent: `ghostdeps-fix/${version}` });
|
|
331
|
+
const github = new GitHubClient({
|
|
332
|
+
cache,
|
|
333
|
+
timeoutMs: 15_000,
|
|
334
|
+
retries: 2,
|
|
335
|
+
userAgent: `ghostdeps-fix/${version}`,
|
|
336
|
+
gate: new RateLimitGate(),
|
|
337
|
+
maxRateLimitWaitMs: 30_000,
|
|
338
|
+
now: () => new Date(),
|
|
339
|
+
});
|
|
340
|
+
const reports = await analyzeAll(all, { npm, github, now: new Date() }, 4);
|
|
341
|
+
const proposals = generateProposals(reports, customOverrides);
|
|
342
|
+
if (proposals.length === 0) {
|
|
343
|
+
log(chalk.green('✔ No se encontraron dependencias críticas o vulnerables que requieran overrides.'));
|
|
344
|
+
process.exitCode = EXIT.OK;
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
log(chalk.yellow(`\nSe detectaron ${proposals.length} dependencias para remediación:`));
|
|
348
|
+
for (const p of proposals) {
|
|
349
|
+
log(` - ${chalk.bold(p.packageName)}: ${chalk.gray(p.currentSpec)} → ${chalk.green(p.targetVersion)} (${p.reason})`);
|
|
350
|
+
}
|
|
351
|
+
const plan = await createFixPlan(pkgJsonPath, proposals, pm);
|
|
352
|
+
if (cmdOpts.dryRun) {
|
|
353
|
+
log(chalk.cyan('\n[Modo --dry-run] Vista previa del cambio a package.json:'));
|
|
354
|
+
log(plan.updatedContent);
|
|
355
|
+
process.exitCode = EXIT.OK;
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const res = await applyFixPlan(plan, { dryRun: false, backup: cmdOpts.backup });
|
|
359
|
+
if (res.written) {
|
|
360
|
+
log(chalk.green(`\n✔ package.json actualizado con ${pm === 'npm' ? 'overrides' : pm === 'yarn' ? 'resolutions' : 'pnpm.overrides'}.`));
|
|
361
|
+
if (res.backupPath)
|
|
362
|
+
log(chalk.gray(` Copia de seguridad: ${res.backupPath}`));
|
|
363
|
+
log(chalk.cyan(`\nEjecuta "${pm} install" para regenerar tu lockfile con las dependencias corregidas.`));
|
|
364
|
+
}
|
|
365
|
+
process.exitCode = EXIT.OK;
|
|
366
|
+
});
|
|
367
|
+
// --- Subcomando: ghostdeps diff <paquete> ---
|
|
368
|
+
program
|
|
369
|
+
.command('diff <paquete>')
|
|
370
|
+
.description('Compara dos versiones de un paquete de npm para detectar secuestro de cuentas, scripts peligrosos o cambios abruptos.')
|
|
371
|
+
.option('--from <version>', 'versión base a comparar')
|
|
372
|
+
.option('--to <version>', 'versión nueva (por defecto latest)')
|
|
373
|
+
.option('--ai', 'analizar diferencias con IA para evaluar riesgo forense de seguridad', false)
|
|
374
|
+
.addOption(new Option('--ai-provider <provider>', 'proveedor de IA a utilizar').choices(['gemini', 'anthropic', 'openai']))
|
|
375
|
+
.option('--ai-model <model>', 'modelo específico de IA')
|
|
376
|
+
.option('--json', 'imprimir resultado en formato JSON estructurado', false)
|
|
377
|
+
.action(async (packageName, cmdOpts) => {
|
|
378
|
+
try {
|
|
379
|
+
const report = await inspectPackageDiff(packageName, {
|
|
380
|
+
from: cmdOpts.from,
|
|
381
|
+
to: cmdOpts.to,
|
|
382
|
+
ai: cmdOpts.ai,
|
|
383
|
+
aiOptions: { provider: cmdOpts.aiProvider, model: cmdOpts.aiModel },
|
|
384
|
+
});
|
|
385
|
+
if (cmdOpts.json) {
|
|
386
|
+
process.stdout.write(JSON.stringify(report, null, 2) + '\n');
|
|
387
|
+
process.exitCode = EXIT.OK;
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const riskColor = report.riskLevel === 'critical'
|
|
391
|
+
? chalk.bgRed.white.bold
|
|
392
|
+
: report.riskLevel === 'high'
|
|
393
|
+
? chalk.red.bold
|
|
394
|
+
: report.riskLevel === 'medium'
|
|
395
|
+
? chalk.yellow.bold
|
|
396
|
+
: chalk.green.bold;
|
|
397
|
+
log(chalk.bold(`\n🔍 GhostDeps Diff: ${report.packageName} (${report.fromVersion} → ${report.toVersion})`));
|
|
398
|
+
log(`Nivel de riesgo estimado: ${riskColor(` ${report.riskLevel.toUpperCase()} `)}\n`);
|
|
399
|
+
log(chalk.bold('Publicador:'));
|
|
400
|
+
if (report.publisher.changed) {
|
|
401
|
+
log(chalk.red(` ⚠ Cambió de publicador: "${report.publisher.from ?? 'N/A'}" → "${report.publisher.to ?? 'N/A'}"`));
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
log(chalk.gray(` Sin cambios (${report.publisher.to ?? 'mismo publicador'})`));
|
|
405
|
+
}
|
|
406
|
+
if (report.maintainers.added.length > 0 || report.maintainers.removed.length > 0) {
|
|
407
|
+
log(chalk.bold('\nMantenedores:'));
|
|
408
|
+
if (report.maintainers.added.length > 0)
|
|
409
|
+
log(chalk.yellow(` + Añadidos: ${report.maintainers.added.join(', ')}`));
|
|
410
|
+
if (report.maintainers.removed.length > 0)
|
|
411
|
+
log(chalk.gray(` - Removidos: ${report.maintainers.removed.join(', ')}`));
|
|
412
|
+
}
|
|
413
|
+
if (report.installScripts.added.length > 0 ||
|
|
414
|
+
report.installScripts.removed.length > 0 ||
|
|
415
|
+
report.installScripts.modified.length > 0) {
|
|
416
|
+
log(chalk.bold('\nLifecycle Scripts:'));
|
|
417
|
+
for (const s of report.installScripts.added) {
|
|
418
|
+
const prefix = s.suspicious ? chalk.red.bold(' + [SOSPECHOSO]') : chalk.yellow(' +');
|
|
419
|
+
log(`${prefix} ${s.stage}: ${s.to}`);
|
|
420
|
+
}
|
|
421
|
+
for (const s of report.installScripts.modified) {
|
|
422
|
+
const prefix = s.suspicious ? chalk.red.bold(' ~ [SOSPECHOSO]') : chalk.yellow(' ~');
|
|
423
|
+
log(`${prefix} ${s.stage}: ${s.from} → ${s.to}`);
|
|
424
|
+
}
|
|
425
|
+
for (const s of report.installScripts.removed) {
|
|
426
|
+
log(chalk.gray(` - ${s.stage}: ${s.from}`));
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (report.dependencies.added.length > 0 ||
|
|
430
|
+
report.dependencies.removed.length > 0 ||
|
|
431
|
+
report.dependencies.modified.length > 0) {
|
|
432
|
+
log(chalk.bold('\nDependencias:'));
|
|
433
|
+
for (const d of report.dependencies.added)
|
|
434
|
+
log(chalk.green(` + ${d.name}@${d.to}`));
|
|
435
|
+
for (const d of report.dependencies.modified)
|
|
436
|
+
log(chalk.yellow(` ~ ${d.name}: ${d.from} → ${d.to}`));
|
|
437
|
+
for (const d of report.dependencies.removed)
|
|
438
|
+
log(chalk.gray(` - ${d.name}`));
|
|
439
|
+
}
|
|
440
|
+
if (report.alerts.length > 0) {
|
|
441
|
+
log(chalk.bold('\nAlertas de Seguridad:'));
|
|
442
|
+
for (const a of report.alerts)
|
|
443
|
+
log(` - ${chalk.yellow(a)}`);
|
|
444
|
+
}
|
|
445
|
+
if (report.aiAnalysis) {
|
|
446
|
+
log(chalk.bold.cyan('\n🤖 Análisis Forense con IA:'));
|
|
447
|
+
log(report.aiAnalysis);
|
|
448
|
+
}
|
|
449
|
+
log('');
|
|
450
|
+
process.exitCode = report.riskLevel === 'critical' ? EXIT.FAIL_UNDER : EXIT.OK;
|
|
451
|
+
}
|
|
452
|
+
catch (err) {
|
|
453
|
+
log(chalk.red(`\n✖ Error inspeccionando diff: ${err.message}`));
|
|
454
|
+
process.exitCode = EXIT.FATAL;
|
|
455
|
+
}
|
|
456
|
+
});
|
|
273
457
|
// Evita que Commander haga process.exit(1) en errores de uso (colisionaría con --fail-under).
|
|
274
458
|
program.exitOverride();
|
|
275
459
|
try {
|
|
@@ -277,7 +461,6 @@ async function main() {
|
|
|
277
461
|
}
|
|
278
462
|
catch (err) {
|
|
279
463
|
if (err instanceof CommanderError) {
|
|
280
|
-
// Commander ya imprimió el mensaje (o la ayuda/versión).
|
|
281
464
|
process.exitCode = err.exitCode === 0 ? EXIT.OK : EXIT.FATAL;
|
|
282
465
|
return;
|
|
283
466
|
}
|
package/dist/clients/npm.js
CHANGED
|
@@ -3,6 +3,39 @@ import { fetchJson } from './http.js';
|
|
|
3
3
|
const REGISTRY = 'https://registry.npmjs.org';
|
|
4
4
|
/** Nº de versiones previas a la última que se usan para comparar publicadores. */
|
|
5
5
|
const PUBLISHER_HISTORY = 5;
|
|
6
|
+
const SUSPICIOUS_SCRIPT_REGEX = /\b(curl|wget|powershell|cmd\.exe|bash|sh)\b|https?:\/\/|eval\(|Buffer\.from\(|\bbase64\b|\/etc\/(passwd|shadow)|\.ssh\/|\.env\b/i;
|
|
7
|
+
const LIFECYCLE_STAGES = ['preinstall', 'install', 'postinstall'];
|
|
8
|
+
export function inspectInstallScripts(scripts) {
|
|
9
|
+
if (!scripts || typeof scripts !== 'object') {
|
|
10
|
+
return { hasInstallScripts: false, suspicious: false, scripts: [] };
|
|
11
|
+
}
|
|
12
|
+
const detected = [];
|
|
13
|
+
let isSuspicious = false;
|
|
14
|
+
for (const stage of LIFECYCLE_STAGES) {
|
|
15
|
+
const cmd = scripts[stage];
|
|
16
|
+
if (typeof cmd === 'string' && cmd.trim()) {
|
|
17
|
+
const match = SUSPICIOUS_SCRIPT_REGEX.test(cmd);
|
|
18
|
+
let reason;
|
|
19
|
+
if (match) {
|
|
20
|
+
isSuspicious = true;
|
|
21
|
+
if (/curl|wget|https?:\/\//i.test(cmd))
|
|
22
|
+
reason = 'descarga de red en la instalación';
|
|
23
|
+
else if (/powershell|cmd\.exe|bash|sh/i.test(cmd))
|
|
24
|
+
reason = 'ejecución de shell';
|
|
25
|
+
else if (/eval\(|base64|Buffer\.from/i.test(cmd))
|
|
26
|
+
reason = 'posible ofuscación / eval';
|
|
27
|
+
else
|
|
28
|
+
reason = 'patrón sospechoso';
|
|
29
|
+
}
|
|
30
|
+
detected.push({ stage, command: cmd.trim(), suspicious: match, reason });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
hasInstallScripts: detected.length > 0,
|
|
35
|
+
suspicious: isSuspicious,
|
|
36
|
+
scripts: detected,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
6
39
|
function personName(p) {
|
|
7
40
|
if (!p)
|
|
8
41
|
return null;
|
|
@@ -91,6 +124,7 @@ export function extractNpmInfo(name, doc) {
|
|
|
91
124
|
latestPublisher,
|
|
92
125
|
previousPublishers,
|
|
93
126
|
maintainersChange,
|
|
127
|
+
installScripts: inspectInstallScripts(latestDoc?.scripts),
|
|
94
128
|
};
|
|
95
129
|
}
|
|
96
130
|
export class NpmClient {
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comparador de seguridad entre versiones de un paquete (ghostdeps diff <pkg>).
|
|
3
|
+
* Detecta cambios bruscos entre versiones: cambio de publicador (_npmUser),
|
|
4
|
+
* incorporación de scripts de instalación sospechosos, dependencias nuevas,
|
|
5
|
+
* alteración de repositorios o bifurcación de mantenimiento.
|
|
6
|
+
*/
|
|
7
|
+
import { inspectInstallScripts, registryUrl } from '../clients/npm.js';
|
|
8
|
+
import { fetchJson } from '../clients/http.js';
|
|
9
|
+
import { detectAiConfig, queryAnthropic, queryGemini, queryOpenAI } from '../ai/advisor.js';
|
|
10
|
+
function parsePerson(p) {
|
|
11
|
+
if (!p)
|
|
12
|
+
return null;
|
|
13
|
+
if (typeof p === 'string')
|
|
14
|
+
return p.replace(/\s*<.*$/, '').trim() || null;
|
|
15
|
+
if (typeof p === 'object' && p !== null) {
|
|
16
|
+
const obj = p;
|
|
17
|
+
return obj.name ?? obj.email ?? null;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
function parseRepoUrl(repo) {
|
|
22
|
+
if (!repo)
|
|
23
|
+
return null;
|
|
24
|
+
if (typeof repo === 'string')
|
|
25
|
+
return repo;
|
|
26
|
+
if (typeof repo === 'object' && repo !== null && 'url' in repo) {
|
|
27
|
+
return String(repo.url ?? '');
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Función pura que calcula el diff de seguridad entre dos versiones de un packument.
|
|
33
|
+
*/
|
|
34
|
+
export function compareVersions(packageName, doc, fromVer, toVer) {
|
|
35
|
+
const versions = doc.versions ?? {};
|
|
36
|
+
const time = doc.time ?? {};
|
|
37
|
+
// Orden cronológico
|
|
38
|
+
const chronological = Object.entries(time)
|
|
39
|
+
.filter(([v]) => v !== 'created' && v !== 'modified' && versions[v] !== undefined)
|
|
40
|
+
.sort(([, a], [, b]) => Date.parse(a) - Date.parse(b))
|
|
41
|
+
.map(([v]) => v);
|
|
42
|
+
const targetTo = toVer ??
|
|
43
|
+
doc['dist-tags']?.latest ??
|
|
44
|
+
chronological[chronological.length - 1] ??
|
|
45
|
+
'';
|
|
46
|
+
if (!versions[targetTo]) {
|
|
47
|
+
throw new Error(`La versión destino "${targetTo}" no existe en el registro para ${packageName}`);
|
|
48
|
+
}
|
|
49
|
+
let targetFrom = fromVer;
|
|
50
|
+
if (!targetFrom) {
|
|
51
|
+
const idx = chronological.indexOf(targetTo);
|
|
52
|
+
if (idx > 0) {
|
|
53
|
+
targetFrom = chronological[idx - 1];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// Si es la primera versión o no está en cronología, buscar cualquier otra previa
|
|
57
|
+
targetFrom = chronological.find((v) => v !== targetTo) ?? targetTo;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const vFromDoc = versions[targetFrom] ?? {};
|
|
61
|
+
const vToDoc = versions[targetTo] ?? {};
|
|
62
|
+
// 1. Publisher
|
|
63
|
+
const pubFrom = parsePerson(vFromDoc._npmUser);
|
|
64
|
+
const pubTo = parsePerson(vToDoc._npmUser);
|
|
65
|
+
const publisherChanged = Boolean(pubFrom && pubTo && pubFrom !== pubTo);
|
|
66
|
+
// 2. Maintainers
|
|
67
|
+
const parseMaint = (docPart) => {
|
|
68
|
+
const m = docPart.maintainers;
|
|
69
|
+
if (!m)
|
|
70
|
+
return [];
|
|
71
|
+
const arr = Array.isArray(m) ? m : [m];
|
|
72
|
+
return [...new Set(arr.map(parsePerson).filter((n) => !!n))].sort();
|
|
73
|
+
};
|
|
74
|
+
const maintFrom = parseMaint(vFromDoc);
|
|
75
|
+
const maintTo = parseMaint(vToDoc);
|
|
76
|
+
const maintAdded = maintTo.filter((m) => !maintFrom.includes(m));
|
|
77
|
+
const maintRemoved = maintFrom.filter((m) => !maintTo.includes(m));
|
|
78
|
+
// 3. Install scripts
|
|
79
|
+
const scriptsFrom = vFromDoc.scripts ?? {};
|
|
80
|
+
const scriptsTo = vToDoc.scripts ?? {};
|
|
81
|
+
const stages = ['preinstall', 'install', 'postinstall'];
|
|
82
|
+
const scriptsAdded = [];
|
|
83
|
+
const scriptsRemoved = [];
|
|
84
|
+
const scriptsModified = [];
|
|
85
|
+
const inspTo = inspectInstallScripts(scriptsTo);
|
|
86
|
+
const inspFrom = inspectInstallScripts(scriptsFrom);
|
|
87
|
+
for (const st of stages) {
|
|
88
|
+
const s1 = scriptsFrom[st];
|
|
89
|
+
const s2 = scriptsTo[st];
|
|
90
|
+
if (!s1 && s2) {
|
|
91
|
+
const isSusp = inspectInstallScripts({ [st]: s2 }).suspicious;
|
|
92
|
+
scriptsAdded.push({ stage: st, to: s2, suspicious: isSusp });
|
|
93
|
+
}
|
|
94
|
+
else if (s1 && !s2) {
|
|
95
|
+
scriptsRemoved.push({ stage: st, from: s1 });
|
|
96
|
+
}
|
|
97
|
+
else if (s1 && s2 && s1 !== s2) {
|
|
98
|
+
const isSusp = inspectInstallScripts({ [st]: s2 }).suspicious;
|
|
99
|
+
scriptsModified.push({ stage: st, from: s1, to: s2, suspicious: isSusp });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const hasSuspiciousScripts = inspTo.suspicious && !inspFrom.suspicious;
|
|
103
|
+
// 4. Dependencies
|
|
104
|
+
const depsFrom = vFromDoc.dependencies ?? {};
|
|
105
|
+
const depsTo = vToDoc.dependencies ?? {};
|
|
106
|
+
const depsAdded = [];
|
|
107
|
+
const depsRemoved = [];
|
|
108
|
+
const depsModified = [];
|
|
109
|
+
const allDepKeys = new Set([...Object.keys(depsFrom), ...Object.keys(depsTo)]);
|
|
110
|
+
for (const k of allDepKeys) {
|
|
111
|
+
if (!depsFrom[k] && depsTo[k]) {
|
|
112
|
+
depsAdded.push({ name: k, to: depsTo[k] });
|
|
113
|
+
}
|
|
114
|
+
else if (depsFrom[k] && !depsTo[k]) {
|
|
115
|
+
depsRemoved.push({ name: k, from: depsFrom[k] });
|
|
116
|
+
}
|
|
117
|
+
else if (depsFrom[k] !== depsTo[k]) {
|
|
118
|
+
depsModified.push({ name: k, from: depsFrom[k], to: depsTo[k] });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// 5. Repository
|
|
122
|
+
const repoFrom = parseRepoUrl(vFromDoc.repository ?? doc.repository);
|
|
123
|
+
const repoTo = parseRepoUrl(vToDoc.repository ?? doc.repository);
|
|
124
|
+
const repoChanged = Boolean(repoFrom && repoTo && repoFrom !== repoTo);
|
|
125
|
+
// 6. Riesgo y Alertas
|
|
126
|
+
const alerts = [];
|
|
127
|
+
let riskLevel = 'low';
|
|
128
|
+
if (publisherChanged) {
|
|
129
|
+
alerts.push(`Cambio de publicador: "${pubFrom}" → "${pubTo}"`);
|
|
130
|
+
riskLevel = 'medium';
|
|
131
|
+
}
|
|
132
|
+
if (maintAdded.length > 0) {
|
|
133
|
+
alerts.push(`Nuevos mantenedores añadidos: ${maintAdded.join(', ')}`);
|
|
134
|
+
}
|
|
135
|
+
if (repoChanged) {
|
|
136
|
+
alerts.push(`El repositorio fue modificado: "${repoFrom}" → "${repoTo}"`);
|
|
137
|
+
if (riskLevel === 'low')
|
|
138
|
+
riskLevel = 'medium';
|
|
139
|
+
}
|
|
140
|
+
if (scriptsAdded.length > 0 || scriptsModified.length > 0) {
|
|
141
|
+
alerts.push(`Se añadieron o alteraron scripts de instalación en el ciclo de vida`);
|
|
142
|
+
riskLevel = 'medium';
|
|
143
|
+
}
|
|
144
|
+
if (hasSuspiciousScripts) {
|
|
145
|
+
alerts.push(`ALERTA: Se incorporaron scripts de instalación altamente sospechosos (descargas, shell o eval)`);
|
|
146
|
+
riskLevel = 'critical';
|
|
147
|
+
}
|
|
148
|
+
if (publisherChanged && hasSuspiciousScripts) {
|
|
149
|
+
alerts.push(`CRÍTICO: Cambio simultáneo de publicador y adición de scripts sospechosos (Patrón claro de Account Hijacking)`);
|
|
150
|
+
riskLevel = 'critical';
|
|
151
|
+
}
|
|
152
|
+
else if (publisherChanged && scriptsAdded.length > 0) {
|
|
153
|
+
riskLevel = 'high';
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
packageName,
|
|
157
|
+
fromVersion: targetFrom,
|
|
158
|
+
toVersion: targetTo,
|
|
159
|
+
publisher: { from: pubFrom, to: pubTo, changed: publisherChanged },
|
|
160
|
+
maintainers: { added: maintAdded, removed: maintRemoved },
|
|
161
|
+
installScripts: {
|
|
162
|
+
added: scriptsAdded,
|
|
163
|
+
removed: scriptsRemoved,
|
|
164
|
+
modified: scriptsModified,
|
|
165
|
+
hasSuspicious: inspTo.suspicious,
|
|
166
|
+
},
|
|
167
|
+
dependencies: { added: depsAdded, removed: depsRemoved, modified: depsModified },
|
|
168
|
+
repository: { from: repoFrom, to: repoTo, changed: repoChanged },
|
|
169
|
+
riskLevel,
|
|
170
|
+
alerts,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Consulta la API y opcionalmente la IA para analizar el diff entre versiones.
|
|
175
|
+
*/
|
|
176
|
+
export async function inspectPackageDiff(packageName, options = {}) {
|
|
177
|
+
const timeoutMs = options.timeoutMs ?? 15000;
|
|
178
|
+
const retries = options.retries ?? 2;
|
|
179
|
+
const userAgent = options.userAgent ?? 'ghostdeps/diff';
|
|
180
|
+
const { data } = await fetchJson(registryUrl(packageName), {
|
|
181
|
+
timeoutMs,
|
|
182
|
+
retries,
|
|
183
|
+
headers: { accept: 'application/json', 'user-agent': userAgent },
|
|
184
|
+
});
|
|
185
|
+
const report = compareVersions(packageName, data, options.from, options.to);
|
|
186
|
+
if (options.ai) {
|
|
187
|
+
const aiConfig = detectAiConfig(options.aiOptions);
|
|
188
|
+
if (aiConfig) {
|
|
189
|
+
const prompt = `Actúa como analista de seguridad de software y malware en npm.
|
|
190
|
+
Analiza la siguiente diferencia entre dos versiones del paquete "${report.packageName}":
|
|
191
|
+
- Versión base: ${report.fromVersion}
|
|
192
|
+
- Versión nueva: ${report.toVersion}
|
|
193
|
+
- Publicador anterior: ${report.publisher.from ?? 'N/A'}
|
|
194
|
+
- Publicador nuevo: ${report.publisher.to ?? 'N/A'} (¿Cambió?: ${report.publisher.changed ? 'SÍ' : 'NO'})
|
|
195
|
+
- Scripts de ciclo de vida añadidos/modificados: ${JSON.stringify(report.installScripts, null, 2)}
|
|
196
|
+
- Dependencias añadidas: ${JSON.stringify(report.dependencies.added, null, 2)}
|
|
197
|
+
- Repositorio alterado: ${report.repository.changed ? 'SÍ' : 'NO'}
|
|
198
|
+
- Alertas automáticas: ${report.alerts.join('; ')}
|
|
199
|
+
|
|
200
|
+
Emite un diagnóstico forense conciso (máximo 3 párrafos en español):
|
|
201
|
+
1. ¿Presenta indicios de toma de control de cuenta (account hijacking) o inyección maliciosa?
|
|
202
|
+
2. ¿Qué riesgos específicos conllevan los cambios observados?
|
|
203
|
+
3. Recomendación explícita: Aceptar actualización, bloquear en lockfile con override, o reportar a npm security.`;
|
|
204
|
+
try {
|
|
205
|
+
let aiText;
|
|
206
|
+
if (aiConfig.provider === 'gemini') {
|
|
207
|
+
aiText = await queryGemini(aiConfig.apiKey, aiConfig.model, prompt, 30000);
|
|
208
|
+
}
|
|
209
|
+
else if (aiConfig.provider === 'anthropic') {
|
|
210
|
+
aiText = await queryAnthropic(aiConfig.apiKey, aiConfig.model, prompt, 30000);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
aiText = await queryOpenAI(aiConfig.apiKey, aiConfig.model, prompt, 30000);
|
|
214
|
+
}
|
|
215
|
+
report.aiAnalysis = aiText;
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
report.aiAnalysis = `(Error al consultar IA: ${err.message})`;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return report;
|
|
223
|
+
}
|