@wirecat/cli-base 0.56.0 → 0.57.0
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 +12 -0
- package/dist/config.d.ts +4 -1
- package/dist/config.js +5 -2
- package/docs/standards/security.md +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,18 @@ Versions before 0.8.0 are in the [git tags](https://github.com/WireCatLabs/cli-b
|
|
|
8
8
|
Every entry says what changed as a caller sees it, why, and what to watch for — the rules are
|
|
9
9
|
[`docs/dev/CONVENTIONS.md`](docs/dev/CONVENTIONS.md#the-changelog).
|
|
10
10
|
|
|
11
|
+
## 0.57.0 — 25.10.2026
|
|
12
|
+
|
|
13
|
+
### Changed — may break callers
|
|
14
|
+
|
|
15
|
+
- **`saveConfigFile` writes `config.json` as `0600`, owner-only, instead of `0644`.** A config names the owner's
|
|
16
|
+
accounts, profiles and paths, and cli-core already created the first one as `0600` — so the first `config set`
|
|
17
|
+
turned a private file into one every user on the computer could read. A save now replaces the file with an
|
|
18
|
+
owner-only one, whatever mode it had. A folder that already exists keeps its mode; a CLI's `doctor` reports one
|
|
19
|
+
others can enter. Watch for: anything that reads the config as a different user — a system-wide service, a
|
|
20
|
+
container running under another uid, a second account sharing the file — can no longer read it after the next
|
|
21
|
+
save. Run it as the owner, or give it its own config. Windows is unchanged: Node sets only the read-only bit there.
|
|
22
|
+
|
|
11
23
|
## 0.56.0 — 25.10.2026
|
|
12
24
|
|
|
13
25
|
### Added
|
package/dist/config.d.ts
CHANGED
|
@@ -14,5 +14,8 @@ export declare const writeSecurely: (path: string, contents: string | Uint8Array
|
|
|
14
14
|
* The schema belongs to the host: what a profile holds is the one thing no shared package can know.
|
|
15
15
|
*/
|
|
16
16
|
export declare const loadConfigFile: <TSchema extends v.GenericSchema>(path: string, schema: TSchema, fallback: () => v.InferOutput<TSchema>) => v.InferOutput<TSchema>;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Owner-only, `0600`: a config names the owner's accounts and paths, and a save replaces a file any
|
|
19
|
+
* other user could read. A folder that already exists keeps its mode; `doctor` reports an open one.
|
|
20
|
+
*/
|
|
18
21
|
export declare const saveConfigFile: (path: string, config: unknown) => void;
|
package/dist/config.js
CHANGED
|
@@ -55,7 +55,10 @@ export const loadConfigFile = (path, schema, fallback) => {
|
|
|
55
55
|
}
|
|
56
56
|
return result.output;
|
|
57
57
|
};
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Owner-only, `0600`: a config names the owner's accounts and paths, and a save replaces a file any
|
|
60
|
+
* other user could read. A folder that already exists keeps its mode; `doctor` reports an open one.
|
|
61
|
+
*/
|
|
59
62
|
export const saveConfigFile = (path, config) => {
|
|
60
|
-
writeSecurely(path, `${JSON.stringify(config, null, 2)}\n`,
|
|
63
|
+
writeSecurely(path, `${JSON.stringify(config, null, 2)}\n`, 0o600);
|
|
61
64
|
};
|
|
@@ -123,10 +123,11 @@ the message store. The owner adds `--allow-any-file` to send one anyway.
|
|
|
123
123
|
|
|
124
124
|
### WC-SECR-10 · Private files are written atomically with private modes
|
|
125
125
|
|
|
126
|
-
A file that holds a secret or private state is written with `writeSecurely`: atomically, mode `0600`, in a directory
|
|
126
|
+
A file that holds a secret or private state, `config.json` included, is written with `writeSecurely`: atomically, mode `0600`, in a directory
|
|
127
127
|
created with mode `0700`. `writeSecurely` takes text or bytes. A
|
|
128
128
|
temporary credential file is `0600` and removed in `finally`.
|
|
129
|
-
|
|
129
|
+
The shared messenger `doctor` reports a wrong mode, the config file and its folder included, and prints the `chmod`
|
|
130
|
+
fix without applying it.
|
|
130
131
|
|
|
131
132
|
- **Why:** another user on the same computer must not read the session.
|
|
132
133
|
- **Enforced by:** `src/config.test.ts`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "The parts every command line tool needs: output modes, terminal rendering, error model, exit codes, credentials, clocks",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|