secrez 2.2.0-beta.1 → 2.2.0-beta.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
@@ -11,7 +11,7 @@
11
11
  - add `editorProvider` hook for tests and improve `edit` command test reliability
12
12
  - vault permissions (FS-1): secure legacy containers to `0o700` dirs / `0o600` files at login
13
13
  - strengthen password-based export encryption (`.secrez` files): new **v2** format uses PBKDF2 with a random salt stored in the file; password and iteration count are required at import (`-i`); legacy **v1** exports remain importable with password only
14
- - require Node.js 20 or later (`engines.node >=20.0.0`)
14
+ - require Node.js 22.23.4 or later (`engines.node >=22.23.4`), matching the October 2026 Node.js security release
15
15
  - clear cryptographic secrets from memory on `signout`, `quit`, and double `^C` (best-effort buffer zeroing)
16
16
  - replace deprecated dependencies: `homedir` → `os.homedir`, `ethereumjs-util` → `ethers.getAddress`, `qrcode-reader` → `jsqr`, upgrade `jimp` to 1.x
17
17
  - harden `totp --from-clipboard` on Linux: run `xclip` with `spawn` and write PNG bytes to disk instead of shell redirection
package/README.md CHANGED
@@ -89,7 +89,7 @@ Secrez uses [NaCl](https://github.com/dchest/tweetnacl-js) as its primary crypto
89
89
 
90
90
  ## How to install it
91
91
 
92
- Secrez requires Node.js 20 or later. If you have installed an older version, it may generate unclear errors and refuse to install or work properly. We recommend installing Node using nvm if possible. For more information, refer to [https://github.com/nvm-sh/nvm](https://github.com/nvm-sh/nvm).
92
+ Secrez requires Node.js 22.23.4 or later (security-patched LTS). If you have installed an older version, it may generate unclear errors and refuse to install or work properly. We recommend installing Node using nvm if possible. For more information, refer to [https://github.com/nvm-sh/nvm](https://github.com/nvm-sh/nvm).
93
93
 
94
94
  Since this monorepo uses [Pnpm](https://pnpm.io/), it is better to install secrez using pnpm because the lock file will be used to avoid unexpected conflicts among modules. To install pnpm, run:
95
95
 
@@ -488,60 +488,7 @@ Thank you for any contributions! 😉
488
488
  ## Test coverage
489
489
 
490
490
  ```
491
- 211 passing (28s)
492
-
493
- --------------------|---------|----------|---------|---------|--------------------------------------
494
- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
495
- --------------------|---------|----------|---------|---------|--------------------------------------
496
- All files | 86.68 | 74.22 | 86.18 | 86.62 |
497
- src | 65.8 | 54.31 | 68.96 | 66.14 |
498
- Command.js | 74.66 | 74.13 | 78.57 | 75.67 | ...5-62,73,80,93,127,164-172,179-182
499
- PreCommand.js | 57.14 | 34.61 | 80 | 57.14 | 10-19,68-77
500
- Welcome.js | 56.75 | 34.37 | 50 | 56.75 | ...4,129,138-140,148-163,174-175,181
501
- cliConfig.js | 100 | 100 | 100 | 100 |
502
- src/commands | 89.08 | 75.91 | 93.77 | 89.02 |
503
- Alias.js | 88.6 | 78.68 | 100 | 88.46 | 101,112,139,169,173,180,190,213-214
504
- Cat.js | 98.91 | 88.88 | 100 | 98.91 | 152
505
- Cd.js | 96.42 | 86.66 | 100 | 96.42 | 44
506
- Conf.js | 90 | 74.46 | 77.77 | 90 | 107-110,138-141,150
507
- Contacts.js | 86.06 | 75.6 | 100 | 85.95 | ...5,165,172,184,237,250,260,268-269
508
- Copy.js | 87.5 | 71.92 | 72.72 | 87.36 | ...7,127,178,195,217-222,237-238,265
509
- Ds.js | 90.27 | 82.6 | 100 | 90.14 | 99,108-113,125,147-148
510
- Edit.js | 71.18 | 65 | 100 | 71.18 | 63,69,78,89-97,134-148
511
- Export.js | 85.71 | 71.76 | 85.71 | 85.71 | ...4,232-236,241,253,262,265,269-283
512
- Find.js | 90.3 | 74.16 | 100 | 90.12 | ...3,282-302,371,423-426,441-444,451
513
- Git.js | 88.88 | 80.95 | 100 | 88.88 | 61,73,81,88,114
514
- Help.js | 100 | 80 | 100 | 100 | 29
515
- Import.js | 89.95 | 82.14 | 91.66 | 89.86 | ...4,414,420,468,484-485,493-500,527
516
- Lcat.js | 100 | 85.71 | 100 | 100 | 54
517
- Lcd.js | 95.65 | 81.81 | 100 | 95.65 | 50
518
- Lls.js | 95.45 | 72.72 | 100 | 95.45 | 97
519
- Lpwd.js | 92.3 | 100 | 100 | 92.3 | 36
520
- Ls.js | 91.54 | 76.31 | 100 | 91.04 | 103,114-116,130,185
521
- Mkdir.js | 92.59 | 60 | 100 | 92.59 | 56-57
522
- Mv.js | 86.59 | 71.66 | 100 | 86.31 | 93-99,133,155-156,165,175-182
523
- Paste.js | 84.61 | 70.83 | 100 | 84.61 | 72,78,81,89,113,130-131,139
524
- Pwd.js | 92.3 | 100 | 100 | 92.3 | 33
525
- Quit.js | 92.3 | 50 | 100 | 92.3 | 27
526
- Rm.js | 90.9 | 76 | 100 | 90.74 | 63,125-126,136,144
527
- Shell.js | 86.66 | 40 | 88.88 | 86.66 | 15,21,65,82
528
- Show.js | 72.54 | 45.45 | 57.14 | 74 | ...8,100,106-114,117,123-126,132,145
529
- Ssh.js | 78 | 57.69 | 85.71 | 78 | 87,95,100,129,133,141-148
530
- Tag.js | 96.26 | 91.37 | 100 | 96.22 | 122,171,204-205
531
- Totp.js | 89.28 | 72.3 | 92.3 | 89.18 | ...7,196-197,237,247,289-294,308-309
532
- Touch.js | 96.36 | 80.64 | 100 | 96.29 | 164,240
533
- Use.js | 91.66 | 86.95 | 100 | 91.66 | 68,83-84
534
- Ver.js | 90 | 66.66 | 100 | 90 | 25
535
- Whoami.js | 83.33 | 60 | 80 | 83.33 | 27,35,48
536
- index.js | 87.5 | 50 | 100 | 86.95 | 15,22,31
537
- src/prompts | 72 | 33.33 | 36.36 | 72 |
538
- MainPromptMock.js | 72 | 33.33 | 36.36 | 72 | 29-35,44-50
539
- src/utils | 83.58 | 78.43 | 69.23 | 83.33 |
540
- AliasManager.js | 100 | 91.66 | 100 | 100 | 47
541
- ContactManager.js | 73.33 | 60 | 85.71 | 73.33 | 12,34-36
542
- HelpProto.js | 89.07 | 82.6 | 100 | 88.88 | 49,135-137,153-154,171-176,195
543
- Logger.js | 65.9 | 56.25 | 42.1 | 65.11 | ...16,25,37-49,57,69,74,84,88,93,105
544
- --------------------|---------|----------|---------|---------|--------------------------------------
491
+
545
492
  ```
546
493
 
547
494
  ## Copyright
package/bin/secrez.js CHANGED
@@ -7,11 +7,20 @@ const commandLineArgs = require("command-line-args");
7
7
 
8
8
  const pkg = require("../package");
9
9
 
10
- const nodeMajor = parseInt(process.versions.node.split(".")[0], 10);
11
- if (nodeMajor < 20) {
10
+ const MIN_NODE = [22, 23, 4];
11
+ const nodeParts = process.versions.node.split(".").map((n) => parseInt(n, 10));
12
+ const nodeTooOld =
13
+ nodeParts[0] < MIN_NODE[0] ||
14
+ (nodeParts[0] === MIN_NODE[0] && nodeParts[1] < MIN_NODE[1]) ||
15
+ (nodeParts[0] === MIN_NODE[0] &&
16
+ nodeParts[1] === MIN_NODE[1] &&
17
+ (nodeParts[2] || 0) < MIN_NODE[2]);
18
+ if (nodeTooOld) {
12
19
  console.error(
13
20
  chalk.red(
14
- `Secrez requires Node.js 20 or later (current: ${process.versions.node}).`
21
+ `Secrez requires Node.js ${MIN_NODE.join(".")} or later (current: ${
22
+ process.versions.node
23
+ }).`
15
24
  )
16
25
  );
17
26
  process.exit(1);
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "secrez",
3
- "version": "2.2.0-beta.1",
3
+ "version": "2.2.0-beta.3",
4
4
  "license": "MIT",
5
5
  "nyc": {
6
6
  "include": "src",
7
7
  "exclude": []
8
8
  },
9
9
  "dependencies": {
10
- "@secrez/core": "~1.1.0",
11
- "@secrez/crypto": "~1.1.0",
12
- "@secrez/eth": "~0.0.6",
13
- "@secrez/fs": "~1.1.0",
14
- "@secrez/utils": "~1.1.0",
10
+ "@secrez/core": "~1.1.1",
11
+ "@secrez/crypto": "~1.1.1",
12
+ "@secrez/eth": "~0.0.7",
13
+ "@secrez/fs": "~1.1.1",
14
+ "@secrez/utils": "~1.1.1",
15
15
  "case": "^1.6.3",
16
16
  "chalk": "^3.0.0",
17
17
  "clipboardy": "^2.3.0",
@@ -27,7 +27,7 @@
27
27
  "qrcode": "^1.5.4"
28
28
  },
29
29
  "devDependencies": {
30
- "@secrez/test-helpers": "~2.0.3",
30
+ "@secrez/test-helpers": "~2.0.4",
31
31
  "chai": "^4.5.0",
32
32
  "chalk": "^3.0.0",
33
33
  "cross-env": "^7.0.3",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "homepage": "https://github.com/secrez/secrez#readme",
56
56
  "engines": {
57
- "node": ">=20.0.0"
57
+ "node": ">=22.23.4"
58
58
  },
59
59
  "gitHead": "42cbc519dd2802a1e03c6203bb724c726c2bfb79",
60
60
  "scripts": {
package/src/PreCommand.js CHANGED
@@ -7,16 +7,28 @@ class PreCommand {
7
7
  if (this.prompt.editorProvider) {
8
8
  return this.prompt.editorProvider(options);
9
9
  } /* istanbul ignore next */ else {
10
- const rl = this.prompt.getRl && this.prompt.getRl();
11
- if (rl) {
12
- rl.pause();
13
- }
10
+ // Do not pause/resume inquirer-command-prompt's cached rl: after the user
11
+ // submits `edit …`, that Interface is already closed. On Node 24+,
12
+ // rl.pause()/resume() on a closed Interface throw ERR_USE_AFTER_CLOSE
13
+ // ("readline was closed"). Even on Node 22, pause/resume on the dead
14
+ // Interface still toggles process.stdin and races the next prompt.
15
+ // MemoryEditor owns stdin directly instead.
16
+ const stdin = process.stdin;
17
+ const wasRaw = typeof stdin.isRaw === "boolean" ? stdin.isRaw : false;
14
18
 
15
19
  try {
16
20
  return await editInMemory(options.content || "");
17
21
  } finally {
18
- if (rl) {
19
- rl.resume();
22
+ if (stdin.isTTY && typeof stdin.setRawMode === "function") {
23
+ try {
24
+ stdin.setRawMode(wasRaw);
25
+ } catch (e) {
26
+ // ignore — stdin may already be in the desired mode
27
+ }
28
+ }
29
+ // Ensure stdin is flowing again for the next inquirer/command prompt
30
+ if (typeof stdin.resume === "function" && stdin.isPaused()) {
31
+ stdin.resume();
20
32
  }
21
33
  }
22
34
  }
@@ -15,6 +15,14 @@ const insert = (s, x, c) => s.slice(0, x) + c + s.slice(x);
15
15
  const EDITOR_STATUS =
16
16
  "Ctrl-d save · Ctrl-c abort · Ctrl-k del line · Ctrl-a home · Ctrl-e end · Ctrl-g reset";
17
17
 
18
+ // ansi-escapes `clearScreen` is RIS (\u001bc). Terminal.app answers that
19
+ // reset with a blue background and a foreground that does not contrast, so
20
+ // the file text is drawn and then invisible. Erase the viewport, home the
21
+ // cursor, and restore the default colors before painting the buffer.
22
+ function clearViewport() {
23
+ return "\u001b[0m" + esc.eraseScreen + esc.cursorTo(0, 0);
24
+ }
25
+
18
26
  function terminalRows() {
19
27
  return process.stdout.rows || 24;
20
28
  }
@@ -55,7 +63,7 @@ const Editor = {
55
63
  abort(c) {
56
64
  this.done = true;
57
65
  this.aborted = !(c.ctrl && c.name === "d");
58
- this.out.write(esc.clearScreen + esc.cursorTo(0, 0));
66
+ this.out.write(clearViewport());
59
67
  this.close();
60
68
  },
61
69
 
@@ -176,16 +184,11 @@ const Editor = {
176
184
  },
177
185
 
178
186
  render() {
179
- if (this.firstRender) {
180
- this.firstRender = false;
181
- this.out.write("\n".repeat(terminalRows()));
182
- }
183
-
184
187
  const rows = terminalRows();
185
188
  const statusRow = Math.max(0, rows - 1);
186
189
  const { lines, cursorX, cursorY } = this;
187
190
  this.out.write(
188
- esc.clearScreen +
191
+ clearViewport() +
189
192
  lines.join("\n") +
190
193
  esc.cursorTo(0, statusRow) +
191
194
  "\x1b[2m" +
@@ -207,7 +210,6 @@ function createEditor(text) {
207
210
  initialLines: [],
208
211
  cursorX: 0,
209
212
  cursorY: 0,
210
- firstRender: true,
211
213
  done: false,
212
214
  aborted: false,
213
215
  value: "",
@@ -122,9 +122,16 @@ function onKeypress(stream, cb) {
122
122
  stream.resume();
123
123
 
124
124
  return () => {
125
- stream.setRawMode(oldRawMode);
126
- stream.pause();
127
125
  stream.removeListener("data", onData);
126
+ if (typeof stream.setRawMode === "function") {
127
+ try {
128
+ stream.setRawMode(oldRawMode);
129
+ } catch (e) {
130
+ // ignore
131
+ }
132
+ }
133
+ // Do not stream.pause() here: pausing process.stdin leaves the next
134
+ // inquirer prompt racing a closed/paused readline (ERR_USE_AFTER_CLOSE).
128
135
  };
129
136
  }
130
137