secrez 2.2.0-beta.5 → 2.2.0-beta.8
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 +4 -8
- package/package.json +1 -1
- package/src/Command.js +11 -5
- package/src/commands/Edit.js +84 -71
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
**2.2.0
|
|
3
|
+
**2.2.0**
|
|
4
4
|
|
|
5
|
+
- replace the system editor with an integrated in-memory editor for `edit`. Secrets stay in memory and are no longer written to temporary files. The `-e`/`--editor` and `-i`/`--internal` options are removed; the in-memory editor is the only editor
|
|
6
|
+
- change how `edit` treats the git repo. The remote check runs while you edit, instead of blocking before the editor opens. If the repository was changed outside Secrez, the editor closes and later writes stay blocked for the session: quit, sync the repo by hand, then start Secrez again. If Secrez is only behind the remote, editing continues; on save you can write anyway, or return to the unsaved text and leave it with Ctrl-c
|
|
5
7
|
- remove deprecated `bash` command (use `shell` instead)
|
|
6
|
-
- `
|
|
7
|
-
- in-memory editor: `Ctrl-k` deletes the current line and pulls up the next one
|
|
8
|
-
- replace `shell` command implementation: run commands with `spawn` and `cwd` instead of interpolating the working directory into a shell string (fixes command injection via malicious paths)
|
|
9
|
-
- harden `ssh` command: validate user and host, pass arguments to `ttab`/`ssh` without shell interpolation (fixes command injection via crafted hostnames)
|
|
10
|
-
- replace external editor with an in-memory editor for `edit`: secrets are no longer written to temporary files on disk; removed `-e`/`--editor` and `-i`/`--internal` options (the internal editor is now the only editor)
|
|
11
|
-
- add `editorProvider` hook for tests and improve `edit` command test reliability
|
|
8
|
+
- stop interpolating commands into a shell string: `shell` and `ssh` pass arguments with `spawn`, and `totp --from-clipboard` does the same for `xclip`
|
|
12
9
|
- vault permissions (FS-1): secure legacy containers to `0o700` dirs / `0o600` files at login
|
|
13
10
|
- 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
11
|
- require Node.js 22.23.4 or later (`engines.node >=22.23.4`), matching the October 2026 Node.js security release
|
|
15
12
|
- clear cryptographic secrets from memory on `signout`, `quit`, and double `^C` (best-effort buffer zeroing)
|
|
16
13
|
- replace deprecated dependencies: `homedir` → `os.homedir`, `ethereumjs-util` → `ethers.getAddress`, `qrcode-reader` → `jsqr`, upgrade `jimp` to 1.x
|
|
17
|
-
- harden `totp --from-clipboard` on Linux: run `xclip` with `spawn` and write PNG bytes to disk instead of shell redirection
|
|
18
14
|
- companion workspace releases: `@secrez/core@1.1.0`, `@secrez/crypto@1.1.0`, `@secrez/fs@1.1.0`, `@secrez/utils@1.1.0`, `@secrez/eth@0.0.6`
|
|
19
15
|
- warn at signup when PBKDF2 iterations are below 100,000 and require explicit confirmation to proceed (KDF-3)
|
|
20
16
|
|
package/package.json
CHANGED
package/src/Command.js
CHANGED
|
@@ -152,13 +152,17 @@ class Command extends PreCommand {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
logGitConflictBlocked(conflictCheck) {
|
|
155
|
-
this.
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
const checker = this.internalFs && this.internalFs.gitConflictChecker;
|
|
156
|
+
if (!checker || !checker.sessionBlockAnnounced) {
|
|
157
|
+
this.Logger.yellow(conflictCheck.message);
|
|
158
|
+
if (checker) checker.sessionBlockAnnounced = true;
|
|
159
|
+
}
|
|
160
|
+
this.Logger.red(
|
|
161
|
+
"Operation blocked for data integrity. Quit Secrez, sync the repo by hand, then start Secrez again."
|
|
158
162
|
);
|
|
159
163
|
}
|
|
160
164
|
|
|
161
|
-
async askToBypassGitConflict(conflictCheck) {
|
|
165
|
+
async askToBypassGitConflict(conflictCheck, options = {}) {
|
|
162
166
|
this.Logger.yellow(conflictCheck.message);
|
|
163
167
|
const shouldContinue = await this.useInput({
|
|
164
168
|
type: "confirm",
|
|
@@ -166,7 +170,9 @@ class Command extends PreCommand {
|
|
|
166
170
|
default: false,
|
|
167
171
|
});
|
|
168
172
|
if (!shouldContinue) {
|
|
169
|
-
|
|
173
|
+
if (!options.reopenEditor) {
|
|
174
|
+
this.Logger.grey("Operation cancelled.");
|
|
175
|
+
}
|
|
170
176
|
return false;
|
|
171
177
|
}
|
|
172
178
|
return true;
|
package/src/commands/Edit.js
CHANGED
|
@@ -87,90 +87,103 @@ class Edit extends require("../Command") {
|
|
|
87
87
|
try {
|
|
88
88
|
let data = await this.internalFs.getTreeIndexAndPath(options.path);
|
|
89
89
|
let file = data.path;
|
|
90
|
-
|
|
90
|
+
let tree = data.tree;
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
let sanitizedPath = Entry.sanitizePath(file);
|
|
93
|
+
if (sanitizedPath !== file) {
|
|
94
|
+
throw new Error("A filename cannot contain \\/><|:&?*^$ chars.");
|
|
95
|
+
}
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
let exists = false;
|
|
98
|
+
let fileData;
|
|
99
|
+
try {
|
|
100
|
+
fileData = await this.prompt.commands.cat.cat(
|
|
101
|
+
{ path: options.path },
|
|
102
|
+
true
|
|
103
|
+
);
|
|
104
|
+
exists = true;
|
|
105
|
+
} catch (e) {
|
|
106
|
+
if (options.field) {
|
|
107
|
+
throw new Error("Field can be specified only for existent files");
|
|
108
|
+
}
|
|
109
|
+
fileData = [{ content: "" }];
|
|
108
110
|
}
|
|
109
|
-
fileData = [{ content: "" }];
|
|
110
|
-
}
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
let p = tree.getNormalizedPath(file);
|
|
113
|
+
let fields = {};
|
|
114
|
+
if (exists && !options.unformatted && isYaml(p)) {
|
|
115
|
+
fields = fileData[0].content ? yamlParse(fileData[0].content) : {};
|
|
116
|
+
if (typeof fields === "object") {
|
|
117
|
+
options.choices = Object.keys(fields);
|
|
118
|
+
if (options.choices.length && !options.field) {
|
|
119
|
+
options.message = "Select the field to edit";
|
|
120
|
+
options.field = await this.useSelect(options);
|
|
121
|
+
if (!options.field) {
|
|
122
|
+
if (!hardBlocked) {
|
|
123
|
+
this.Logger.reset("Changes aborted or file not changed");
|
|
124
|
+
}
|
|
125
|
+
return;
|
|
124
126
|
}
|
|
125
|
-
return;
|
|
126
127
|
}
|
|
128
|
+
} else {
|
|
129
|
+
delete options.field;
|
|
127
130
|
}
|
|
128
|
-
} else {
|
|
131
|
+
} else if (!isYaml(p)) {
|
|
129
132
|
delete options.field;
|
|
130
133
|
}
|
|
131
|
-
|
|
132
|
-
delete options.field;
|
|
133
|
-
}
|
|
134
|
-
if (hardBlocked) return;
|
|
135
|
-
|
|
136
|
-
let content = options.field
|
|
137
|
-
? fields[options.field] || ""
|
|
138
|
-
: fileData[0].content;
|
|
139
|
-
let newContent = await this.useEditor(
|
|
140
|
-
Object.assign(options, {
|
|
141
|
-
content,
|
|
142
|
-
onEditorReady: checkPromise
|
|
143
|
-
? (handle) => {
|
|
144
|
-
editorAbort = handle.abort;
|
|
145
|
-
if (hardBlocked) handle.abort();
|
|
146
|
-
}
|
|
147
|
-
: undefined,
|
|
148
|
-
})
|
|
149
|
-
);
|
|
134
|
+
if (hardBlocked) return;
|
|
150
135
|
|
|
151
|
-
|
|
136
|
+
const originalContent = options.field
|
|
137
|
+
? fields[options.field] || ""
|
|
138
|
+
: fileData[0].content;
|
|
139
|
+
let draft = originalContent;
|
|
140
|
+
let newContent;
|
|
141
|
+
|
|
142
|
+
while (true) {
|
|
143
|
+
if (hardBlocked) return;
|
|
144
|
+
|
|
145
|
+
newContent = await this.useEditor(
|
|
146
|
+
Object.assign(options, {
|
|
147
|
+
content: draft,
|
|
148
|
+
onEditorReady: checkPromise
|
|
149
|
+
? (handle) => {
|
|
150
|
+
editorAbort = handle.abort;
|
|
151
|
+
if (hardBlocked) handle.abort();
|
|
152
|
+
}
|
|
153
|
+
: undefined,
|
|
154
|
+
})
|
|
155
|
+
);
|
|
152
156
|
|
|
153
|
-
|
|
154
|
-
userLeftEditor = true;
|
|
155
|
-
this.Logger.reset("Changes aborted or file not changed");
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
157
|
+
if (hardBlocked) return;
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
159
|
+
if (!(newContent && newContent !== originalContent)) {
|
|
160
|
+
userLeftEditor = true;
|
|
161
|
+
this.Logger.reset("Changes aborted or file not changed");
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
draft = newContent;
|
|
166
|
+
|
|
167
|
+
if (checkPromise) {
|
|
168
|
+
const result = await checkPromise;
|
|
169
|
+
if (hardBlocked) return;
|
|
170
|
+
if (result.checkFailed) {
|
|
171
|
+
this.Logger.yellow(
|
|
172
|
+
"Warning: Could not check git status. Proceeding anyway."
|
|
173
|
+
);
|
|
174
|
+
} else if (result.hasRisk && result.allowBypass === false) {
|
|
175
|
+
reportHardBlock(result);
|
|
176
|
+
return;
|
|
177
|
+
} else if (result.hasRisk) {
|
|
178
|
+
const shouldContinue = await this.askToBypassGitConflict(result, {
|
|
179
|
+
reopenEditor: true,
|
|
180
|
+
});
|
|
181
|
+
if (!shouldContinue) continue;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
break;
|
|
172
186
|
}
|
|
173
|
-
}
|
|
174
187
|
|
|
175
188
|
if (exists) {
|
|
176
189
|
let node = tree.root.getChildFromPath(p);
|