@eliware/vyops 1.0.8 → 1.0.9

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/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release Notes
2
2
 
3
+ ## 1.0.9
4
+
5
+ - Fix `--password-stdin` to read piped passwords correctly on current Node.js
6
+ runtimes.
7
+ - Restore password-authenticated backup workflows for VyOS hosts.
8
+
9
+ Verification:
10
+
11
+ - `npm test` (100% coverage across statements, branches, functions, and lines)
12
+ - `npm run lint`
13
+ - `npm run audit`
14
+
3
15
  ## 1.0.8
4
16
 
5
17
  - Fail immediately with a redacted VyOS error when confirmed commits reject a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliware/vyops",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Deploy native VyOS configuration files over SSH.",
5
5
  "main": "vyops.mjs",
6
6
  "scripts": {
@@ -48,4 +48,4 @@
48
48
  "LICENSE",
49
49
  "RELEASE_NOTES.md"
50
50
  ]
51
- }
51
+ }
package/src/main.mjs CHANGED
@@ -6,7 +6,12 @@ import { readAndValidateConfig } from './validate.mjs';
6
6
  import { pushBack, shouldSkip } from './git.mjs';
7
7
  import { closeAll } from './ssh.mjs';
8
8
  import { log, registerHandlers, registerSignals } from '@eliware/common';
9
- import { readFile } from 'node:fs/promises';
9
+
10
+ async function readPasswordStdin() {
11
+ const chunks = [];
12
+ for await (const chunk of process.stdin) chunks.push(chunk);
13
+ return Buffer.concat(chunks).toString('utf8').replace(/\r?\n$/, '');
14
+ }
10
15
 
11
16
  const errors = registerHandlers({ log });
12
17
  const signals = registerSignals({ log, shutdownHook: async () => closeAll() });
@@ -23,7 +28,7 @@ try {
23
28
  process.exit(0);
24
29
  }
25
30
  if (args.passwordStdin) {
26
- args.password = (await readFile(0, 'utf8')).replace(/\r?\n$/, '');
31
+ args.password = await readPasswordStdin();
27
32
  if (!args.password) throw new Error('password-stdin received an empty password');
28
33
  }
29
34
  if (args.backup) {