yamlock 0.2.4 → 0.2.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/README.md +16 -1
- package/dist/cli/cli.js +13 -3
- package/dist/crypto/utils.js +1 -0
- package/package.json +1 -1
- package/dist/cli/.gitkeep +0 -0
- package/dist/crypto/.gitkeep +0 -0
- package/dist/utils/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
░░▀░░▀░▀░▀░░░▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
+
[](https://www.npmjs.com/package/yamlock)
|
|
8
|
+
[](https://github.com/phoenixweiss/yamlock/actions)
|
|
9
|
+
|
|
7
10
|
# yamlock
|
|
8
11
|
|
|
9
12
|
Value-level encryption for YAML and JSON configuration files. The name **yamlock** combines "YAML" and "lock" while also sounding like "warlock", hinting at a little configuration magic.
|
|
@@ -65,7 +68,8 @@ Options of note:
|
|
|
65
68
|
- `--output <file>` writes the result to a separate file instead of overwriting the input.
|
|
66
69
|
- `--paths <path1,path2>` targets only the specified fields (dot/bracket notation like `db.password` or `users[0].token`).
|
|
67
70
|
- Command `keygen` produces a random key and shows how to store it (shell export or `.env`).
|
|
68
|
-
-
|
|
71
|
+
- Command `algorithms` prints two lists: tested presets (covered by yamlock) and additional ciphers available from the runtime.
|
|
72
|
+
- Command `version` prints the installed CLI version.
|
|
69
73
|
|
|
70
74
|
### Node.js API
|
|
71
75
|
|
|
@@ -114,6 +118,12 @@ const restored = processConfig(processed, {
|
|
|
114
118
|
});
|
|
115
119
|
```
|
|
116
120
|
|
|
121
|
+
## Advanced usage
|
|
122
|
+
|
|
123
|
+
- **Selective encryption**: combine `--paths` on the CLI or `paths: []` in `processConfig` to encrypt only sensitive sections of a config file.
|
|
124
|
+
- **CI/CD flows**: see [examples/docs/ci-cd.md](examples/docs/ci-cd.md) for a GitHub Actions job that decrypts configs for builds and re-encrypts them before publishing artifacts.
|
|
125
|
+
- **Key rotation**: follow [examples/docs/key-rotation.md](examples/docs/key-rotation.md) for a step-by-step process, including scripting tips for large repos.
|
|
126
|
+
|
|
117
127
|
### Supported algorithms
|
|
118
128
|
|
|
119
129
|
| Algorithm | Type | Notes |
|
|
@@ -125,6 +135,11 @@ const restored = processConfig(processed, {
|
|
|
125
135
|
|
|
126
136
|
You can also pass any algorithm supported by the current Node.js runtime (`crypto.getCiphers()`), along with custom `keyLength`, `ivLength`, or `authTagLength` overrides. Only the algorithms above are actively tested; additional presets may be added or revised in future releases.
|
|
127
137
|
|
|
138
|
+
## Release information
|
|
139
|
+
|
|
140
|
+
- The badges at the top show the latest npm version and the status of the Node test suite.
|
|
141
|
+
- See [CHANGELOG.md](CHANGELOG.md) for detailed release notes; install a specific tag via `npm install yamlock@<version>`.
|
|
142
|
+
|
|
128
143
|
### Encrypted value format
|
|
129
144
|
|
|
130
145
|
Every locked string follows the format:
|
package/dist/cli/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import { randomBytes } from 'node:crypto';
|
|
|
8
8
|
import yaml from 'js-yaml';
|
|
9
9
|
|
|
10
10
|
import { processConfig } from '../utils/config.js';
|
|
11
|
-
import { listSupportedAlgorithms } from '../crypto/utils.js';
|
|
11
|
+
import { listSupportedAlgorithms, TESTED_ALGORITHMS } from '../crypto/utils.js';
|
|
12
12
|
|
|
13
13
|
const require = createRequire(import.meta.url);
|
|
14
14
|
const packageJson = require('../../package.json');
|
|
@@ -161,8 +161,18 @@ export async function runCli(argv = process.argv) {
|
|
|
161
161
|
|
|
162
162
|
if (command === 'algorithms') {
|
|
163
163
|
const algorithms = listSupportedAlgorithms();
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
const tested = TESTED_ALGORITHMS.slice().sort();
|
|
165
|
+
const testedSet = new Set(tested);
|
|
166
|
+
const additional = algorithms.filter((name) => !testedSet.has(name));
|
|
167
|
+
|
|
168
|
+
print('Tested algorithms (covered by yamlock fixtures):');
|
|
169
|
+
tested.forEach((name) => print(`- ${name}`));
|
|
170
|
+
|
|
171
|
+
if (additional.length > 0) {
|
|
172
|
+
print('\nAdditional algorithms available in this runtime:');
|
|
173
|
+
additional.forEach((name) => print(`- ${name}`));
|
|
174
|
+
print('\nUse at your own risk; these ciphers are not part of the official test matrix yet.');
|
|
175
|
+
}
|
|
166
176
|
return exit(0);
|
|
167
177
|
}
|
|
168
178
|
|
package/dist/crypto/utils.js
CHANGED
|
@@ -9,6 +9,7 @@ export const ALGORITHM_PRESETS = {
|
|
|
9
9
|
'aes-128-cbc': { keyLength: 16, ivLength: 16, authTagLength: 0 },
|
|
10
10
|
'chacha20-poly1305': { keyLength: 32, ivLength: 12, authTagLength: 16 }
|
|
11
11
|
};
|
|
12
|
+
export const TESTED_ALGORITHMS = Object.keys(ALGORITHM_PRESETS);
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Returns the sorted list of cipher algorithms supported by the current runtime.
|
package/package.json
CHANGED
package/dist/cli/.gitkeep
DELETED
|
File without changes
|
package/dist/crypto/.gitkeep
DELETED
|
File without changes
|
package/dist/utils/.gitkeep
DELETED
|
File without changes
|