All plugins

hermes-dpapi-secrets

Resolve Hermes environment variables at startup from a single secret file encrypted with the Windows Data Protection API, instead of keeping provider keys in plaintext in .env or auth.json. Config is secrets.dpapi.map, an ENV_VAR -> store-name mapping (bare names or dpapi:// names) plus an optional file path (default <HERMES_HOME>/secrets.dpapi). The file is one DPAPI blob keyed by the current Windows user profile, so it is unreadable by another Windows account and worthless off the machine; it is written by the bundled CLI (python -m hermes_dpapi_secrets set NAME, value read from a prompt or stdin, never from argv) and only read at runtime. Mapped names that are missing or empty are skipped with a warning; a file that is not ours, a blob this user cannot decrypt, or a payload that is not a flat string map is reported as an error with nothing injected. Disclosure - this source decrypts a file for every Hermes process that enables it: resolved values become environment variables of the Hermes process and its children, exactly like .env entries, so anything that can read that environment can see them. User-scope encryption only (the machine-wide flag is never used and is not exposed), and the at-rest protection is a bar for backups, cloud sync and dotfiles, not a boundary against code already running as the same user. Stdlib-only (ctypes): no Python dependencies, no subprocesses, no network calls, no self-update. Windows only. Applying fetched values stays the orchestrator's job; the plugin never writes os.environ itself. Disclosure — decrypts a DPAPI-encrypted secret file (default <HERMES_HOME>/secrets.dpapi) at startup for every Hermes process that enables it, and the resolved values become environment variables of Hermes and its child processes like `.env` entries; the encryption is per Windows user and protects backups, cloud sync and copied files, not against other code running as the same user. Local only: no network calls, no subprocesses.

Yicheng-MarkToolsv0.1.0Updated 13 days ago

About

Resolve Hermes environment variables at startup from a single secret file encrypted with the Windows Data Protection API, instead of keeping provider keys in plaintext in .env or auth.json. Config is secrets.dpapi.map, an ENV_VAR -> store-name mapping (bare names or dpapi:// names) plus an optional file path (default <HERMES_HOME>/secrets.dpapi). The file is one DPAPI blob keyed by the current Windows user profile, so it is unreadable by another Windows account and worthless off the machine; it is written by the bundled CLI (python -m hermes_dpapi_secrets set NAME, value read from a prompt or stdin, never from argv) and only read at runtime. Mapped names that are missing or empty are skipped with a warning; a file that is not ours, a blob this user cannot decrypt, or a payload that is not a flat string map is reported as an error with nothing injected. Disclosure - this source decrypts a file for every Hermes process that enables it: resolved values become environment variables of the Hermes process and its children, exactly like .env entries, so anything that can read that environment can see them. User-scope encryption only (the machine-wide flag is never used and is not exposed), and the at-rest protection is a bar for backups, cloud sync and dotfiles, not a boundary against code already running as the same user. Stdlib-only (ctypes): no Python dependencies, no subprocesses, no network calls, no self-update. Windows only. Applying fetched values stays the orchestrator's job; the plugin never writes os.environ itself. Disclosure — decrypts a DPAPI-encrypted secret file (default <HERMES_HOME>/secrets.dpapi) at startup for every Hermes process that enables it, and the resolved values become environment variables of Hermes and its child processes like `.env` entries; the encryption is per Windows user and protects backups, cloud sync and copied files, not against other code running as the same user. Local only: no network calls, no subprocesses.

hermes-dpapi-secrets

Resolve Hermes provider keys from a DPAPI-encrypted secret file at startup, instead of
keeping them in plaintext in ~/.hermes/.env or auth.json.

# config.yaml
secrets:
  dpapi:
    enabled: true
    map:
      ZAI_API_KEY: zai
      OPENAI_API_KEY: dpapi://openai

The file holds one blob encrypted with the Windows Data Protection API, keyed by the
current user profile. Hermes decrypts it once per process, applies the mapped values to the
environment with its normal precedence and provenance, and never writes the secret anywhere.

Why this exists

Hermes ships Bitwarden, 1Password and a generic command helper, and the catalog already has
vault backends. None of them answers the small case: one machine, no vault service, and a
provider key that should not sit in a dotfile.
On Windows the OS already has the primitive —
DPAPI derives a key from your Windows profile, so a file encrypted with it is readable by
that user on that machine and by nothing else.

The alternative on this platform is hermes-wincred,
which reads individual items from Credential Manager. The difference is where the secret
lives:

| | dpapi (this plugin) | wincred |
|---|---|---|
| Storage | one encrypted file you can back up, move or delete | one Credential Manager item per secret |
| Visible in the Windows UI | no | yes, in Credential Manager → Windows Credentials |
| Size per secret | whatever the file holds | capped by the credential blob (2,560 bytes) |
| Provisioning | python -m hermes_dpapi_secrets set NAME | Credential Manager UI or cmdkey |

Both are DPAPI-backed and user-scoped; pick the one whose storage model you want to live
with. auth.json can then keep an env:ZAI_API_KEY reference rather than the key itself.

Requirements

  • Windows 10 or 11.
  • Hermes 0.21.4 or newer.
  • Nothing else: stdlib only (ctypes), no Python dependencies, no child processes, no
    network calls.

Install

hermes plugins install Yicheng-Mark/hermes-dpapi-secrets
hermes plugins enable hermes-dpapi-secrets

Then add the mapping to config.yaml:

secrets:
  dpapi:
    enabled: true
    file: secrets.dpapi          # optional; relative to the Hermes home
    map:
      ZAI_API_KEY: zai
      OPENAI_API_KEY: dpapi://openai

Creating the store

The runtime side is read-only. Provision the store with the bundled CLI, as the same
Windows user that runs Hermes
— the encryption key belongs to that profile:

python -m hermes_dpapi_secrets set ZAI_API_KEY      # prompts; the value is not echoed
printf 'sk-...' | python -m hermes_dpapi_secrets set ZAI_API_KEY   # piped form
python -m hermes_dpapi_secrets list                 # names only, never values
python -m hermes_dpapi_secrets unset ZAI_API_KEY
python -m hermes_dpapi_secrets path                 # where the store lives

--file overrides the store path; by default it is <HERMES_HOME or ~/.hermes>/secrets.dpapi.
Values are never accepted on the command line (where they would reach the shell history and
the process table), never printed, and never written in plaintext.

What it does at startup

For every entry in map, it decrypts the store once and hands the requested values to the
secret-source orchestrator, which applies them like any other source:

  • mapped sources beat bulk sources; within a shape, secrets.sources order decides;
  • override_existing follows the standard secrets.dpapi config key;
  • provenance is reported as (from Windows DPAPI secret file).

A name that is missing from the store, or that holds an empty value, is skipped with a
warning naming it; the other mappings still resolve. If nothing resolves, the source reports
an error and injects nothing. The plugin never writes os.environ, never caches values, and
never calls back into Hermes outside the plugin API.

Security model

  • User scope only. Blobs are protected with CRYPTPROTECT_UI_FORBIDDEN and not with
    the machine-wide flag. Machine scope would let any local account on the box decrypt the
    file; that is the wrong default for a secret store, so the option does not exist.
  • No prompt on the startup path. CRYPTPROTECT_UI_FORBIDDEN means a locked or
    changed profile fails with an error rather than popping a dialog in a service context.
  • Fail closed. A file without this plugin's header, a blob this user cannot decrypt, a
    decrypted payload that is not a flat string map — each is an error, never a partial guess.
  • Atomic writes. The CLI writes a temporary file in the same directory and renames it
    into place, so an interrupted write cannot leave a truncated store.

Disclosure

  • Decrypts a file for every Hermes process that enables the source. The plaintext lives
    in the process environment of Hermes and its children exactly like a .env entry, for as
    long as the process runs.
  • Protects the file at rest, not a running session. DPAPI raises the bar for backups,
    cloud sync, a stolen disk image or a dotfiles repo — the file is useless off this
    machine or to another Windows account. It is not a boundary against code already running
    as you: anything running in your session can call CryptUnprotectData on the same file.
  • The CLI writes; the runtime does not. python -m hermes_dpapi_secrets set creates or
    updates the store on explicit user action. The installed plugin's fetch() only reads.
  • No network, no subprocesses, no self-update. Updates arrive only through the catalog
    pin and hermes plugins update.

Limitations

  • Windows only; on other platforms the source reports BINARY_MISSING and resolves nothing.
  • One store per Hermes home. Use file: to point a profile at a different store, or the
    unset/set commands to curate a single one.
  • The store is not portable: copying it to another machine or another Windows account makes
    it unreadable by design. Re-create it there instead.
  • No caching: the store is read once per process at startup, in-process only.

Development

python -m pytest tests/test_config.py tests/test_store.py -q      # any platform
PYTHONPATH=/path/to/hermes-agent python -m pytest tests -q        # adds the contract suite
PYTHONPATH=/path/to/hermes-agent HERMES_DPAPI_LIVE=1 \
    python -m pytest tests/test_live_dpapi.py -q                  # writes real DPAPI blobs

tests/test_source.py and the live test import agent.secret_sources.base from a Hermes
checkout; tests/test_conformance.py runs the repository's own SecretSourceConformance
kit against this backend. The catalog validator exercises the same contract against the
pinned tree. See VALIDATION.md for the measurements behind the format and
failure-mode choices.

README from the reviewed commit 5bad3fb; it updates when the author re-pins.

More by Yicheng-Mark

18 plugins by Yicheng-Mark in the catalog.

Yicheng-Markhermes-wincredResolve Hermes environment variables from the current user's Windows Credential Manager at startup, instead of keeping provider keys in plaintext in .env or auth.json. Config is secrets.wincred.map, an ENV_VAR -> generic-credential-target mapping (bare names or wincred:// names); each value is read with CredReadW in the current user's vault and handed to the secret-source orchestrator, which applies it with the usual precedence, provenance and conflict rules. Values may be UTF-8 or UTF-16LE (cmdkey and the Credential UI write UTF-16); anything that does not decode to text, or that contains interior NULs, is skipped with a warning instead of being injected as a mangled key. Disclosure - this source reads your Windows Credential Manager: only the generic credentials named in the map, with no enumeration of the vault. Resolved values become environment variables of the Hermes process and its children, exactly like .env entries, so anything that can read that environment can see them. The package is read-only and stdlib-only (ctypes): it never creates, updates or deletes credentials, writes no files, starts no subprocesses, makes no network calls and does not self-update. Windows only. Credential Manager is user-scoped, so this raises the at-rest bar for backups, cloud sync and dotfiles; it is not a boundary against code already running as the same user. Applying fetched values stays the orchestrator's job; the plugin never writes os.environ itself. Disclosure — when enabled, reads only the Windows Credential Manager generic credentials named in secrets.wincred.map (no vault enumeration) and injects them as environment variables of the Hermes process and its children, exactly like .env entries; read-only, stdlib ctypes, no subprocesses, no network, no file writes; user-scoped at-rest protection, not a boundary against code already running as the same user.CommunitytoolsYicheng-Markhermes-windows-appsAnswer "what is installed on this Windows machine": the software inventory behind Apps & Features, swept straight from the four Uninstall registry keys (the machine's 64-bit and 32-bit views plus the user's), so a program is found even when the Settings page hides it - a per-user install that never shows on the machine page came from the user view on the writing machine. Each row carries version, publisher, size in MB, install date and which view it lives in; the same DisplayName in two views is a 32/64-bit dual install, marked instead of listed twice. Entries the publisher asked to hide (runtime packages, update rollups) are filtered out unless asked for. Details one program with every field its publisher wrote and a reading of the uninstall command (MSI product code, setup executable, appx, script) so the next step is known before anything is run; the install folder is checked against disk. Use it for "what did that installer actually register", for inventory before a cleanup, and for "which of the two installs does uninstalling remove". Read-only: registry keys are enumerated and uninstall strings are reported, never run; no network, no file writes, no elevation. The sweep is pure registry - 102 entries in seven milliseconds on the writing machine, the whole table in ten, no PowerShell, no WMI. The plugin declares no Python dependencies. Windows only. Disclosure - the tools report program names, versions, publishers, sizes, install folders and uninstall commands, and what is hidden from Apps & Features, to the model; treat the output like the machine's own Apps & Features page.CommunitytoolsYicheng-Markhermes-windows-certificatesAnswer "which certificate on this Windows machine expired, and what am I actually trusting": walks the user's and the machine's certificate stores (MY, Root, CA) in-process through crypt32 - no certutil, no PowerShell - and lists every certificate with subject, issuer, validity window, self-signed or not, SHA-1 thumbprint and the store it lives in; the expiry arrives in words ("expired 45 days ago", "expires in 12 days") and the list is sorted with the expired and soon-expiring first. One certificate in full adds the serial number, certificate version, the signature algorithm in words, the public key's algorithm, named curve and size in bits (2048-bit RSA, P-256), and the purposes it is valid for (server authentication, code signing...; no EKU extension is reported as "does not restrict its purposes", which is what its absence means). Find it by thumbprint or by a subject substring, across the user's and the machine's copies. Use it for "why does TLS keep failing on this box", "is the root store healthy", and "which personal certificate ran out". Read-only: stores are opened read-only and only enumerated - nothing is added, removed or changed; no network, no file writes, no elevation, no child processes; 121 certificates across both contexts and all three stores walk in about 8 ms on the writing machine. Windows only. Disclosure - the tools report certificate subjects, issuers, validity windows and thumbprints, to the model; treat the output like the machine's own certificate manager page.CommunitytoolsYicheng-Markhermes-windows-devicesAnswer "which device on this Windows machine is unhappy, and what does it need" on Windows: win_device_table lists every present PnP device with its class (System, Net, HIDClass, Display), its status, its manufacturer, its stable device id, and its problem code in words - 28 is one with no driver installed, 10 one that cannot start, 43 one Windows stopped after it reported a failure, 22 one the person switched off on purpose and is not broken - filtering by name or id substring, by class, or to the devices that need attention; devices no longer plugged in are history, left out unless asked for. win_device_detail takes one device by id or name substring and adds the driver behind it from the signed-driver table - name, version, date, provider, signer, INF file, signed or not - or the absence of one, which for code 28 is the same fact said twice; a disabled device gets a note saying it is on purpose, not an alarm. Use it for the Device Manager yellow-mark question without opening Device Manager, for finding what an uninstalled program left behind, and for what changed after an update. Read-only: nothing is enabled, disabled, updated or reinstalled. Both answers come from CIM (Win32_PnPEntity and Win32_PnPSignedDriver, joined by device id), whose property names, enum values and ids do not change with the display language; the human-facing device names localize and are carried through as data, never parsed. The plugin declares no Python dependencies; there is no network call and no file write. Windows only. Disclosure — the tools report device names, manufacturers, device ids and driver versions to the model, and those reveal the machine's hardware inventory and what is plugged into it; treat the output like a Device Manager window opened on their machine.Communitytools

Developer Mode

Explore built-in Hermes toolsets and actions.

HermesAgent

Developer?

Create a Hermes extension for Desktop or agent workflows.

Developer Section