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.
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.
$ 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.
Metadata
Release files for keepassxc-run 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| keepassxc_run-0.1.0.tar.gz | 8.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| keepassxc_run-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.7 kB
Release files / keepassxc_run-0.1.0.tar.gz
| Download URL | keepassxc_run-0.1.0.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c51d34d890515c7bc90bee62f4b05d7701194d3d7f3c6f3b06c725ce73266f5
|
|
BLAKE2b-256 checksum How to use checksums |
1f5652ad6a3e95bd2a64cca8671c17ddd828ba3f6ba2c61eed887fa09ff191fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 25, 2024.
Transparency logRelease files / keepassxc_run-0.1.0-py3-none-any.whl
| Download URL | keepassxc_run-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6400d19b3c318ec6ea507335ac6fc4785f8e4d8d81327a07114451ce8e8a7aae
|
|
BLAKE2b-256 checksum How to use checksums |
bc842be45398cafdc9775b8e9e53f4de8646148d7d60b7db52fc2e38195753d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 25, 2024.
Transparency log