Skip to content

feat(secrets): Secrets Management Tool (Phase 1)#3245

Closed
zaycruz wants to merge 1 commit into
NousResearch:mainfrom
zaycruz:feat/secrets-management-phase1
Closed

feat(secrets): Secrets Management Tool (Phase 1)#3245
zaycruz wants to merge 1 commit into
NousResearch:mainfrom
zaycruz:feat/secrets-management-phase1

Conversation

@zaycruz

@zaycruz zaycruz commented Mar 26, 2026

Copy link
Copy Markdown

Summary

Implements Phase 1 of #410 — a first-class secrets tool providing secure secret lifecycle management.

What's New

New tool: secrets (🔐)

Action Description
list Shows configured secret names (never values) + missing secrets for skills with requires_secrets frontmatter
check Verifies which keys are configured vs missing
request Secure input via getpass() (CLI) or gateway_secret_prompt (messaging). Value never enters agent context
delete Clears a secret from ~/.hermes/.env
inject Registers keys for env_passthrough so the terminal tool includes them in the next subprocess call

Key Security Properties

  • Secret values never enter LLM context — the request action uses getpass() for CLI input or returns a structured gateway_secret_prompt dict for DM-based platforms
  • List action returns only key names — no values ever exposed
  • Inject action uses scoped env passthrough — keys are registered via env_passthrough so only explicitly requested secrets reach subprocesses
  • Skills can declare requires_secrets in SKILL.md frontmatter for automatic missing-secret detection

Files Changed

  • tools/secrets_tool.py — New tool implementation (374 lines)
  • model_tools.py — Added to tool discovery list
  • toolsets.py — Added to _HERMES_CORE_TOOLS
  • tests/tools/test_secrets_tool.py — 10 test cases covering all actions + edge cases

Test Results

146 passed in 3.92s (secrets-related tests)
10/10 new tests passing

Existing Protections Found

During investigation, I found the codebase already has significant hardening (Issue #363 appears resolved):

  • file_tools.py already applies redact_sensitive_text() to read/search output
  • tools/environments/local.py blocks 50+ secret env vars from subprocesses
  • tools/skills_guard.py blocks cat ~/.hermes/.env, os.environ access, credential files
  • tools/env_passthrough.py provides opt-in injection mechanism

This PR builds on top of those existing protections by adding the missing user-facing tool interface.

Phase 2 Roadmap

  • Environment scoping for terminal tool (explicit env_keys parameter)
  • Shannon entropy-based secret detection in output
  • Expanded redaction patterns (Twilio SIDs, JWTs)

Relates to #410

Adds a first-class secrets tool providing secure secret lifecycle
management: list, check, request, delete, and inject.

- secrets(action='list'): Shows configured secret names (never values)
  and cross-references skills with requires_secrets frontmatter
- secrets(action='check'): Verifies which keys are configured/missing
- secrets(action='request'): Secure input via getpass (CLI) or
  gateway_secret_prompt (messaging platforms). Value never enters
  agent context or conversation history.
- secrets(action='delete'): Clears a secret from ~/.hermes/.env
- secrets(action='inject'): Registers keys for env_passthrough so
  the terminal tool includes them in the next subprocess call

Also supports requires_secrets field in SKILL.md frontmatter for
automatic missing-secret detection on skill load.

Relates to NousResearch#410
@zaycruz

zaycruz commented Mar 26, 2026

Copy link
Copy Markdown
Author

Closing in favor of cleaned-up PR #3246 with minimal diff (525 lines vs 785 lines of reformatting noise).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant