
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@varlock/pass-plugin
Advanced tools
Varlock plugin to load secrets from pass (the standard unix password manager)
This package is a Varlock plugin that enables loading secrets from pass (the standard unix password manager) into your configuration.
passBulk() via @setValuesBulk to load all entries under a pathnamePrefix option for scoped entry accessstorePath option (overrides PASSWORD_STORE_DIR)allowMissing option for graceful handling of optional secretsIf you are in a JavaScript based project and have a package.json file, you can either install the plugin explicitly:
npm install @varlock/pass-plugin
And then register the plugin without any version number:
# @plugin(@varlock/pass-plugin)
Otherwise just set the explicit version number when you register it:
# @plugin(@varlock/pass-plugin@0.0.1)
See our Plugin Guide for more details.
You must have pass installed on your system:
# macOS
brew install pass
# Ubuntu/Debian
sudo apt-get install pass
# Fedora/RHEL
sudo yum install pass
# Arch
pacman -S pass
Your password store must be initialized (pass init "Your GPG Key ID"). See the pass documentation for setup details.
The plugin does not fail at load time if pass is not installed - it only fails when you actually try to access a secret.
After registering the plugin, initialize it with the @initPass root decorator.
For most use cases, no configuration is needed:
# @plugin(@varlock/pass-plugin)
# @initPass()
This uses the default ~/.password-store directory and your existing GPG configuration.
If your password store is in a non-standard location:
# @plugin(@varlock/pass-plugin)
# @initPass(storePath=/path/to/custom/store)
Use namePrefix to automatically prepend a path prefix to all entry lookups:
# @plugin(@varlock/pass-plugin)
# @initPass(namePrefix=production/app/)
# ---
# Fetches "production/app/DATABASE_PASSWORD"
DATABASE_PASSWORD=pass()
Access multiple password stores:
# @plugin(@varlock/pass-plugin)
# @initPass(id=personal)
# @initPass(id=team, storePath=/shared/team-store)
# ---
MY_TOKEN=pass(personal, "tokens/github")
SHARED_KEY=pass(team, "api-keys/stripe")
Once initialized, use the pass() resolver function to fetch secrets.
# @plugin(@varlock/pass-plugin)
# @initPass()
# ---
# Auto-infer entry path from variable name
DATABASE_PASSWORD=pass()
# Explicit entry path
STRIPE_KEY=pass("services/stripe/live-key")
# Nested entries
DB_CREDS=pass("production/database/credentials")
When called without arguments, pass() uses the config item key as the entry path in the pass store.
Use allowMissing when a secret may not exist in the store:
# Won't error if the entry doesn't exist - returns empty string instead
OPTIONAL_KEY=pass("monitoring/datadog-key", allowMissing=true)
By default, pass() returns only the first line of the entry (the password), matching pass's own convention where the password lives on line 1 and metadata follows on subsequent lines. This is the same behavior as pass -c (copy to clipboard).
To retrieve the full multiline content, use multiline=true:
# Only returns the first line (the password)
DB_PASSWORD=pass("production/database")
# Returns all lines (password + metadata)
DB_FULL_ENTRY=pass("production/database", multiline=true)
Example entry (pass show production/database):
mysecretpassword
URL: https://db.example.com
Username: admin
Port: 5432
pass("production/database") returns mysecretpasswordpass("production/database", multiline=true) returns the full contentUse passBulk() with @setValuesBulk to fetch all entries under a directory in your pass store in one go:
# @plugin(@varlock/pass-plugin)
# @initPass()
# @setValuesBulk(passBulk("services"))
# ---
# These will be populated from entries under services/ in the pass store
# e.g., services/STRIPE_KEY, services/DATABASE_URL
STRIPE_KEY=
DATABASE_URL=
passBulk() lists all entries under the given path prefix, fetches each one (first line only, matching the pass() default), and returns a JSON map of { "entryPath": "password", ... }.
# Load everything from the store root
# @setValuesBulk(passBulk())
# Load from a specific subdirectory
# @setValuesBulk(passBulk("production/api"))
# With a named instance
# @setValuesBulk(passBulk(team, "shared"))
@initPass()Initialize a pass plugin instance.
Parameters:
storePath?: string - Custom password store path (overrides PASSWORD_STORE_DIR, defaults to ~/.password-store)namePrefix?: string - Prefix automatically prepended to all entry pathsid?: string - Instance identifier for multiple instances (defaults to _default)pass()Fetch a secret from the pass store.
Signatures:
pass() - Auto-infers entry path from variable namepass(entryPath) - Fetch by explicit entry pathpass(instanceId, entryPath) - Fetch from a specific instancepass(entryPath, allowMissing=true) - Fetch with graceful missing handlingpass(entryPath, multiline=true) - Fetch the full multiline contentReturns: The first line (password) of the pass entry by default, or the full content if multiline=true.
passBulk()Fetch all entries under a directory in the pass store at once. Intended for use with @setValuesBulk.
Lists entries via pass ls, then fetches each one in parallel. Each entry returns the first line only (matching the pass() default).
Signatures:
passBulk() - Load all entries from the store rootpassBulk(pathPrefix) - Load entries under a specific path prefixpassBulk(instanceId, pathPrefix) - Load from a named instance with prefixReturns: JSON string of { "entryPath": "firstLineValue", ... } pairs.
Under the hood, the plugin:
pass show <path> as a subprocess for each secretpass ls and fetches them in parallelSince the plugin delegates entirely to the pass CLI, it respects all of your existing GPG and pass configuration, including:
PASSWORD_STORE_DIR settingspass command not foundpass is in your PATHpass show <path>pass lsnamePrefix, remember it's prepended automaticallygpg --list-keysgpgconf --launch gpg-agentpass init "Your GPG Key ID" to initialize the storepass init --help for detailsFAQs
Varlock plugin to load secrets from pass (the standard unix password manager)
The npm package @varlock/pass-plugin receives a total of 213 weekly downloads. As such, @varlock/pass-plugin popularity was classified as not popular.
We found that @varlock/pass-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.