Skip to main content

WSL wrapper for 1Password CLI with stdout/stderr secret redaction

Project description

wslop

A drop-in replacement for the 1Password CLI's op in WSL (Windows Subsystem for Linux), backed by the analogous Windows op.exe and the 1Password desktop app — no separate Linux sign-in required. Inspired by oprun.sh.

wslop's op run resolves secrets by invoking Windows' op.exe inject via WSL's interop layer and then runs your command normally as a Linux process with secrets injected and redacted from stdout/stderr. All other subcommands transparently pass through to op.exe with WSL-to-Windows path translation.

Installation

uv tool install wslop  # or
pipx install wslop     # or
pip install wslop

Usually uv/pipx installs op to ~/.local/bin. Ensure that op appears before any op.exe entry in your PATH (it typically will by default in WSL).

Usage

# op run — secrets resolved, injected into executed Linux process, redacted from output
op run --env-file .env -- python script.py
op run --no-masking --env-file .env -- python script.py   # disable redaction
op run --debug --env-file .env -- python script.py        # show debug output

# op:// references already in the environment are resolved automatically
DATABASE_URL=op://vault/item/field op run -- python script.py

# Everything else passes through to op.exe transparently
op whoami
op item get "My Secret"
op document get "secret.pdf" --out-file /mnt/c/Downloads/secret.pdf
op inject -i /mnt/c/template.txt -o /mnt/c/output.txt

op run Flags

Flag Description
--env-file <path> / -e <path> Load secret references from a file (repeatable; later files override earlier)
--account <account> Target a specific 1Password account for secret resolution
--no-masking Disable secret redaction from output
--debug Show debug output from both wslop and op.exe

op:// references already set in the environment are also resolved automatically, matching native op run behaviour. --env-file overrides the same key from the process environment.

Flags accept both space-separated (--env-file .env) and equals (--env-file=.env) forms.

Note that any unrecognized flags cause the full invocation to fall back to op.exe run, which spawns a Windows process rather than a Linux one.

Path Translation

File path arguments are automatically translated from WSL paths to Windows paths for op.exe passthrough subcommands. Translation is command-aware and only the specific flags and positional positions that take file paths are translated, not arbitrary arguments. Paths don't need to exist and translation is purely string-based.

Subcommand Translated arguments
inject -i/--in-file, -o/--out-file
read -o/--out-file
document get -o/--out-file
document create positional file argument
document edit positional file argument (second positional, after item name)
item create --template
item edit --template
item template get -o/--out-file
update --directory

Path translation is handled by wslpath -w.

Note that wslop doesn't do anything special with line-endings so behavior will depend on underlying op.exe behavior. wslop supports --env-file files with either line-endings.

Env File Format

# Comments are supported
DATABASE_URL=op://vault-name/item-name/field-name
API_KEY="op://vault-name/item-name/field-name"
PLAIN_VAR=some-non-secret-value

Development

uv sync --group dev
uv run poe test                # unit tests
uv run poe test-live           # + integration tests (requires op.exe and 1Password session)
                               #   create op://Automation/wslop-test/password = wslop-s3cr3t-v@lue-42
uv run poe lint
uv run poe typecheck
uv run poe release             # tag, GitHub release, and PyPI publish

uv tool install .              # install from local source

Requirements

  • WSL (Windows Subsystem for Linux)
  • 1Password CLI (op.exe) installed on Windows and signed in via the desktop app
  • Python 3.10+

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

wslop-0.1.0.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

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

wslop-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wslop-0.1.0.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for wslop-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d9270fd5e2e70c4b3e9b32313d391952b9cbcf153c3fc8e53c69b9ee2e5af5ba
MD5 9158dc89bcce653e320ac9f974681e62
BLAKE2b-256 afadafb322ba9442fdc3377a686d4c1fd586c9ab31b93bfecaacb7b5cfa33c56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wslop-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for wslop-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 327fc43469bc72960d29e25ab4da66a7de4a903b958f331f090e3f5ef6b0439a
MD5 f93d8d0c40c490a9d2b1c1d60a51105a
BLAKE2b-256 76cf8e0868f1ae002112c93a9fc84a501002342101fbe1417fb959e7af58fb50

See more details on using hashes here.

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