Skip to main content

KeePassXC runner

Project description

PyPI PythonVersions LICENSE CI

keepassxc-run

Pass secrets in KeePassXC databases as environment variables to an application or script. This project is inspired by op run command.

usage: keepassxc-run.py [options] -- [command ...]

positional arguments:
  command              command to execute. prepend "--" if you specify command option like "--version"

options:
  --help               show this help message
  --debug              Enable debug log
  --env-file ENV_FILE  Enable Dotenv integration with specific Dotenv files to parse. For example: --env-file=.env
  --no-masking         Disable masking of secrets on stdout and stderr.  

keepassxc-run depends on git-credential-keepassxc to fetch secrets from KeePassXC databases. Ensure that git-credential-keepassxc is installed and configured.

Usage

keepassxc-run scans environment variables for secret references, loads the corresponding secrets from KeePassXC databases, then runs the provided command in a subprocess with the secrets made available as environment variables for the duration of the subprocess.

If the same environment variable name exists in both the shell and the environment file, the environment file takes precedence. If the same environment variable name exists in multiple environment files, the last environment file takes precedence.

Examples

Suppose the KeePassXC database contains an entry like a image below.

images/example_com_entry.png

Assume that TEST_PASSWORD environment variable is configured as below.

export TEST_PASSWORD="keepassxc://example.com/password"

If an environment variable starts with keepassxc://, keepassxc-run searches an entry matching URL in KeePassXC databases and pass a secret to subprocess as an environment variable value. keepassxc-run masks secret values in stdout and stderr by default as below.

$ keepassxc-run -- printenv TEST_PASSWORD
<concealed by keepassxc-run>

keepassxc-run turns off masking with --no-masking option.

$ keepassxc-run --no-masking -- printenv TEST_PASSWORD
testuser*p@ssw0rd

You can fetch additional attributes which start KPH: like below.

images/example_com_advanced_field.png

$ export TEST_PASSWORD="keepassxc://example.com/api_key"
$ keepassxc-run --no-masking -- printenv TEST_PASSWORD
my*api*key

Specify an environment file and use it:

echo "TEST_PASSWORD=keepassxc://example.com/password" > .env
$ keepassxc-run --no-masking --env-file .env -- printenv TEST_PASSWORD
testuser*p@ssw0rd

License

MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keepassxc_run-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keepassxc_run-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file keepassxc_run-0.1.0.tar.gz.

File metadata

  • Download URL: keepassxc_run-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for keepassxc_run-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2c51d34d890515c7bc90bee62f4b05d7701194d3d7f3c6f3b06c725ce73266f5
MD5 dd4b7fa3f0758a13d6c984cca8a7bc0b
BLAKE2b-256 1f5652ad6a3e95bd2a64cca8671c17ddd828ba3f6ba2c61eed887fa09ff191fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for keepassxc_run-0.1.0.tar.gz:

Publisher: release.yml on kai2nenobu/keepassxc-run

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file keepassxc_run-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: keepassxc_run-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for keepassxc_run-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6400d19b3c318ec6ea507335ac6fc4785f8e4d8d81327a07114451ce8e8a7aae
MD5 51fcd55efc6694ee5f834f4684fd7fe4
BLAKE2b-256 bc842be45398cafdc9775b8e9e53f4de8646148d7d60b7db52fc2e38195753d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for keepassxc_run-0.1.0-py3-none-any.whl:

Publisher: release.yml on kai2nenobu/keepassxc-run

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page