@bman654/clodex 1.1.0 → 1.2.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/README.md +7 -1
- package/dist/cli.js +990 -320
- package/dist/cli.js.map +1 -1
- package/docs/credential-helpers.md +75 -0
- package/package.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Credential helpers
|
|
2
|
+
|
|
3
|
+
Clodex uses the operating system credential store by default. Headless Linux,
|
|
4
|
+
containers, and WSL installations can instead delegate opaque credential
|
|
5
|
+
storage to an external helper:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
export CLODEX_CREDENTIAL_HELPER=/absolute/path/to/clodex-credential-helper
|
|
9
|
+
clodex providers auth openai
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The value must be an absolute path to an executable file. Clodex invokes the
|
|
13
|
+
helper directly without a shell. Provider configuration records a versioned
|
|
14
|
+
`helper:v1:<helper-id>:<account>` reference. The helper ID is a SHA-256 digest
|
|
15
|
+
of the normalized executable path, so the path and username are not written to
|
|
16
|
+
`providers.json`. A helper-backed credential never silently falls back to the
|
|
17
|
+
OS keyring or an environment variable.
|
|
18
|
+
|
|
19
|
+
Changing `CLODEX_CREDENTIAL_HELPER` to a different path does not redirect old
|
|
20
|
+
references. Clodex refuses the operation before starting the new helper. Restore
|
|
21
|
+
the prior path to read or delete the old credential, or reauthenticate to create
|
|
22
|
+
a reference owned by the new helper.
|
|
23
|
+
|
|
24
|
+
Clodex verifies the selected store with a disposable write, read, and delete
|
|
25
|
+
before starting device authorization. It also reads back real credential
|
|
26
|
+
writes.
|
|
27
|
+
|
|
28
|
+
Credential storage is fail-closed. If the selected credential store fails its
|
|
29
|
+
probe, Clodex stops before device authorization and includes the backend
|
|
30
|
+
diagnostic in the error instead of continuing with tokens that cannot be
|
|
31
|
+
durably stored. Set `CLODEX_CREDENTIAL_HELPER` to the absolute path of an
|
|
32
|
+
external helper, then run the authorization command again.
|
|
33
|
+
|
|
34
|
+
## Protocol
|
|
35
|
+
|
|
36
|
+
The helper receives one of these invocations:
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
helper get clodex <account>
|
|
40
|
+
helper set clodex <account>
|
|
41
|
+
helper delete clodex <account>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- `set` reads the complete opaque credential from standard input and produces
|
|
45
|
+
no output.
|
|
46
|
+
- `get` writes the exact credential to standard output without adding a
|
|
47
|
+
newline.
|
|
48
|
+
- `delete` removes the credential.
|
|
49
|
+
- Exit code `0` means success.
|
|
50
|
+
- Exit code `2` means not found for `get` or `delete`.
|
|
51
|
+
- Any other exit code means the credential operation failed.
|
|
52
|
+
|
|
53
|
+
The service and account arguments are identifiers, not secrets. Credential
|
|
54
|
+
contents are never passed in arguments or environment variables. Helper
|
|
55
|
+
standard error is not copied into Clodex diagnostics, and output and runtime
|
|
56
|
+
are bounded.
|
|
57
|
+
|
|
58
|
+
## Security responsibilities
|
|
59
|
+
|
|
60
|
+
The helper owns storage and its security properties. A helper should:
|
|
61
|
+
|
|
62
|
+
- encrypt credentials at rest using a system or user trust root;
|
|
63
|
+
- serialize concurrent updates when its backend requires it;
|
|
64
|
+
- avoid logging standard input or standard output;
|
|
65
|
+
- make `set` replace the prior value atomically;
|
|
66
|
+
- treat `delete` of a missing entry as success or exit code `2`;
|
|
67
|
+
- return the stored bytes exactly from `get`.
|
|
68
|
+
|
|
69
|
+
Users who need helper arguments can point `CLODEX_CREDENTIAL_HELPER` at a small
|
|
70
|
+
executable wrapper. Clodex intentionally does not evaluate a shell command from
|
|
71
|
+
this setting.
|
|
72
|
+
|
|
73
|
+
Existing `keyring:` and `env:` provider references retain their original
|
|
74
|
+
behavior. Enabling a helper affects newly saved credentials; reauthenticate a
|
|
75
|
+
provider to move it to the helper-backed store.
|