@methodwhite/auto-hardening 1.7.2 → 1.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.3 - 2026-08-02
4
+
5
+ - Eliminada la dependencia runtime `chalk`.
6
+ - Reducida la superficie de cadena de suministro a cero dependencias de producción.
7
+ - Sustituidos los colores del CLI por ANSI nativo.
8
+
3
9
  ## 1.7.2 - 2026-08-02
4
10
 
5
11
  - Añadido workflow de publicación npm mediante Trusted Publishing/OIDC.
package/auto-hardening.js CHANGED
@@ -5,9 +5,12 @@ import path from 'node:path';
5
5
  import process from 'node:process';
6
6
  import { execFileSync } from 'node:child_process';
7
7
  import { randomUUID, createHash } from 'node:crypto';
8
- import chalk from 'chalk';
8
+ const color = (code, text) => process.stdout.isTTY ? `\u001b[${code}m${text}\u001b[0m` : text;
9
+ const red = (text) => color(31, text);
10
+ const yellow = (text) => color(33, text);
11
+ const green = (text) => color(32, text);
9
12
 
10
- const VERSION = '1.7.2';
13
+ const VERSION = '1.7.3';
11
14
  const quarantineDir = process.env.PROGRAMDATA ? path.join(process.env.PROGRAMDATA, 'MethodWhite', 'auto-hardening', 'quarantine') : path.join(os.tmpdir(), 'methodwhite-auto-hardening', 'quarantine');
12
15
  const stateDir = process.env.PROGRAMDATA ? path.join(process.env.PROGRAMDATA, 'MethodWhite', 'auto-hardening') : path.join(os.tmpdir(), 'methodwhite-auto-hardening');
13
16
  const powershell = (script) => execFileSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', script], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024, stdio: ['ignore', 'pipe', 'pipe'] }).trim();
@@ -182,8 +185,8 @@ function apply() {
182
185
  if (after.policies.some((p) => p.status !== true && p.id !== 'windows-update' && p.action !== 'audit-only')) throw new Error('La verificación posterior no fue satisfactoria.');
183
186
  return { changed: true, backupId: saved.id, policies: after.policies };
184
187
  } catch (error) {
185
- console.error(chalk.red(`Aplicación incompleta: ${error.message}`));
186
- console.error(chalk.yellow(`Backup disponible para rollback: ${saved.id}`));
188
+ console.error(red(`Aplicación incompleta: ${error.message}`));
189
+ console.error(yellow(`Backup disponible para rollback: ${saved.id}`));
187
190
  throw error;
188
191
  }
189
192
  }
@@ -207,7 +210,7 @@ function rollback(id) {
207
210
  if (defender.EnableNetworkProtection) settings.push(`-EnableNetworkProtection ${psLiteral(defender.EnableNetworkProtection)}`);
208
211
  if (settings.length) powershell(`Set-MpPreference ${settings.join(' ')}`);
209
212
  }
210
- console.log(chalk.green(`Rollback aplicado: ${id}`));
213
+ console.log(green(`Rollback aplicado: ${id}`));
211
214
  }
212
215
 
213
216
 
@@ -306,4 +309,4 @@ try {
306
309
  if (flags.has('--plan')) console.log(JSON.stringify(plan(report), null, 2));
307
310
  else if (flags.has('--status') || flags.has('--audit') || flags.size === 0) console.log(flags.has('--json') ? JSON.stringify(report, null, 2) : JSON.stringify(report, null, 2));
308
311
  if (flags.has('--apply')) console.log(JSON.stringify(apply(), null, 2));
309
- } catch (error) { console.error(chalk.red(`Error: ${error.message}`)); process.exitCode = 1; }
312
+ } catch (error) { console.error(red(`Error: ${error.message}`)); process.exitCode = 1; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@methodwhite/auto-hardening",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Audita y aplica medidas de hardening defensivo en Windows con modo dry-run seguro.",
5
5
  "type": "module",
6
6
  "main": "auto-hardening.js",
@@ -47,8 +47,5 @@
47
47
  ],
48
48
  "publishConfig": {
49
49
  "access": "public"
50
- },
51
- "dependencies": {
52
- "chalk": "^5.3.0"
53
50
  }
54
51
  }