yamlock
Period: Since November 2025
A developer tool that encrypts selected values in YAML and JSON while keeping the configuration readable.
Protect a value, keep the context
Application configuration often mixes ordinary settings with passwords and service tokens. Encrypting the whole file hides useful context; keeping everything as plaintext exposes the sensitive parts. I built yamlock to work at the level of individual values: choose the fields that need protection and leave the rest of the configuration readable.
It works as a command-line tool and as a library inside a Node.js application. Both use the same encryption core. A developer can prepare a YAML file from the terminal, or transform a JavaScript object before starting an application.
One field changes. The file is still familiar.
A service needs a database password. The host, port and retry count should remain visible during review; only db.password is selected for encryption.
db:
host: db.internal
port: 5432
user: app
password: demo-password
retries: 3
db:
host: db.internal
port: 5432
user: app
password: yl|2|aes-256-gcm|…
retries: 3
yamlock encrypt app.yml \
--paths db.password \
--output app.locked.ymlSynthetic values; the encrypted payload is shortened for readability. The encryption key is supplied through YAMLOCK_KEY, separately from the file.
The source stays intact. The separate output contains an authenticated encrypted password; the unselected settings keep their values and types.
From one password to repeated fields
Exact paths such as db.password select individual values. Structural patterns such as users[*].token cover tokens in an array, while services.** selects a subtree. The selection can grow with the configuration without listing every array index by hand.
The field location matters
The current format binds the encrypted value to its canonical field path. Copying a password payload into api.token does not turn it into a valid API token: decryption fails with ERR_AUTHENTICATION_FAILED. A wrong key or modified ciphertext also fails verification.
Review before replacing
A dry run previews the operation; a separate output preserves the source. YAML processing preserves parsed data, not the original document layout: comments, anchors and quoting can be normalised. That distinction is part of the documented behaviour.