@eliware/vyops 1.0.7 → 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 +27 -0
- package/package.json +2 -2
- package/src/main.mjs +7 -2
- package/src/ssh.mjs +8 -1
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
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
|
+
|
|
15
|
+
## 1.0.8
|
|
16
|
+
|
|
17
|
+
- Fail immediately with a redacted VyOS error when confirmed commits reject a
|
|
18
|
+
configuration after the confirmation prompt.
|
|
19
|
+
- Prevent malformed PKI and other validation failures from appearing to hang
|
|
20
|
+
at the commit-confirm step.
|
|
21
|
+
- Add regression coverage for post-prompt validation errors and structured
|
|
22
|
+
failures without detail text.
|
|
23
|
+
|
|
24
|
+
Verification:
|
|
25
|
+
|
|
26
|
+
- `npm test` (100% coverage across statements, branches, functions, and lines)
|
|
27
|
+
- `npm run lint`
|
|
28
|
+
- `npm run audit`
|
|
29
|
+
|
|
3
30
|
## 1.0.7
|
|
4
31
|
|
|
5
32
|
- Add password-based SSH bootstrap through the secure `--password-stdin` mode.
|
package/package.json
CHANGED
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
|
-
|
|
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 =
|
|
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) {
|
package/src/ssh.mjs
CHANGED
|
@@ -167,6 +167,12 @@ export function interactive(client, commands, log = () => {}) {
|
|
|
167
167
|
const ansi = new RegExp(`${String.fromCharCode(27)}\\[[0-9;?]*[ -/]*[@-~]`, 'g');
|
|
168
168
|
const title = new RegExp(`${String.fromCharCode(27)}\\][^${String.fromCharCode(7)}]*(?:${String.fromCharCode(7)}|${String.fromCharCode(27)}\\\\)`, 'g');
|
|
169
169
|
const clean = value => value.replace(ansi, '').replace(title, '').replace(/\r/g, '');
|
|
170
|
+
const failureDetail = value => value.split('\n')
|
|
171
|
+
.map(line => line.trim())
|
|
172
|
+
.find(line => /(?:failed|failure|invalid|error|aborted|pending)/i.test(line))
|
|
173
|
+
?.replace(/(certificate|private key|key)\s+"[^"]+"/ig, '$1 "[redacted]"')
|
|
174
|
+
.replace(/\s+/g, ' ')
|
|
175
|
+
.slice(0, 240);
|
|
170
176
|
const prompt = value => /(?:^|\n)[A-Za-z0-9._-]+@[A-Za-z0-9._:-]+(?::~\$|#)\s*$/.test(value);
|
|
171
177
|
const sendNext = () => {
|
|
172
178
|
if (waiting || index >= commands.length) return;
|
|
@@ -190,7 +196,8 @@ export function interactive(client, commands, log = () => {}) {
|
|
|
190
196
|
settled = true;
|
|
191
197
|
clearTimeout(timer);
|
|
192
198
|
stream.close();
|
|
193
|
-
|
|
199
|
+
const detail = failureDetail(cleaned);
|
|
200
|
+
reject(new Error(`interactive command failed: ${currentItem.command}${detail ? ` (${detail})` : ''}`));
|
|
194
201
|
return;
|
|
195
202
|
}
|
|
196
203
|
const pagerReturn = /No next tag\s*\(press RETURN\)/i.test(cleaned);
|