Skip to content

LastPass Provider

The LastPass provider integrates with LastPass password manager for secure cloud-based secret storage.

Providerlastpass
URIlastpass://[item_template]
AccessRead and write
Best forTeams already using LastPass
AuthenticationAn authenticated lpass CLI session
Default storagemonosecret/{project}/{profile}/{key}
Terminal window
# Set a secret
$ monosecret set DATABASE_URL --provider lastpass
Enter value for DATABASE_URL: postgresql://localhost/mydb
# Get a secret
$ monosecret get DATABASE_URL --provider lastpass
# Run with secrets
$ monosecret run --provider lastpass -- npm start

Install LastPass CLI:

Terminal window
# macOS
$ brew install lastpass-cli
# Linux (apt)
$ sudo apt install lastpass-cli
# NixOS
$ nix-env -iA nixpkgs.lastpass-cli
Terminal window
# Standard login
$ lpass login your-email@example.com
# Trust device (reduces MFA prompts)
$ lpass login --trust your-email@example.com
lastpass://[item_template]

item_template is optional and replaces the default monosecret/{project}/{profile}/{key} layout. It supports the {project}, {profile}, and {key} placeholders. Include {key} unless every Monosecret key should resolve to the same LastPass item.

# Default Monosecret layout
lastpass
# Keep Monosecret items in a team folder
lastpass://Work/Monosecret/{project}/{profile}/{key}
monosecret.toml
[providers]
team = "lastpass://"
[profiles.production]
DATABASE_URL = { description = "Database URL", providers = ["team"] }

By default, each secret maps to an item named monosecret/{project}/{profile}/{key}. A custom item_template replaces that layout; include all placeholders needed to keep secrets distinct.

A secret’s ref field names an existing item instead: item is the full item name, including any folder (field is not supported). Reads and writes target that item in place.

[profiles.production]
DATABASE_URL = { description = "DB", ref = { item = "Shared-Infra/Production DB" }, providers = [
"lastpass",
] }
Terminal window
# Disable interactive pinentry and authenticate with a CI-managed password
$ export LPASS_DISABLE_PINENTRY=1
$ echo "$LASTPASS_PASSWORD" | lpass login --trust your-email@example.com
$ monosecret run --provider lastpass -- deploy