Skip to content

feat(secrets): Phase 1 — Core Secrets Tool + Redaction Hardening #3627

@vulcan-artivus

Description

@vulcan-artivus

Parent Issue

Sub-issue of #410 (Secure Secrets Management Tool). This is Phase 1 of the phased rollout.

Scope

A new agent-facing secrets tool that provides secure secret lifecycle management, plus hardening of existing redaction coverage.

1. New secrets tool (tools/secrets_tool.py)

Action Description
list Show configured secret names (never values) + cross-reference skills with requires_secrets frontmatter
check Verify which specific keys are configured vs missing
request Secure input via getpass() (CLI) or gateway DM+delete flow. Value never enters agent context.
delete Remove a secret from storage
inject Register keys for env_passthrough so the terminal tool includes them in the next subprocess call

Key security property: secret values never enter LLM context. The request action handles the entire input flow internally and only returns {"stored": true} to the agent.

2. Platform-specific secure ingestion

  • CLI: getpass.getpass() — input not echoed, not in readline history
  • Telegram: DM the user, accept reply, immediately delete the message containing the key
  • Discord: Same DM+delete pattern
  • Other platforms: Best-effort (WhatsApp has limited deletion support)

3. Skill requires_secrets frontmatter

Skills can declare required secrets in SKILL.md:

---
name: twilio
requires_secrets:
  - key: TWILIO_ACCOUNT_SID
    description: "Twilio Account SID"
    instructions: "Find at https://console.twilio.com/"
  - key: TWILIO_AUTH_TOKEN
    description: "Twilio Auth Token"
---

When loading a skill, the agent checks for missing secrets and prompts via secrets(action="request").

4. Redaction hardening (relates to #363)

  • Apply redact_sensitive_text() to read_file, search_files, patch, and execute_code tool outputs
  • Expand agent/redact.py patterns: add Twilio SIDs/tokens, AWS AKIA*, Stripe keys, JWTs, PEM private key blocks
  • File permissions: chmod 600 on ~/.hermes/.env

5. Storage

Phase 1 continues using ~/.hermes/.env for storage. Encrypted storage comes in Phase 3.

Files to Create/Modify

  • New: tools/secrets_tool.py (~400 lines)
  • New: tests/tools/test_secrets_tool.py
  • Modify: agent/redact.py — expanded patterns
  • Modify: tools/file_tools.py — apply redaction to read/search output
  • Modify: tools/code_execution_tool.py — apply redaction to script output
  • Modify: model_tools.py — add to discovery
  • Modify: toolsets.py — add to _HERMES_CORE_TOOLS
  • Modify: agent/skill_commands.py — parse requires_secrets frontmatter

Acceptance Criteria

  • secrets(action="list") returns secret names, never values
  • secrets(action="request") uses getpass() in CLI, DM+delete in gateway
  • Secret values never appear in conversation history or LLM context
  • requires_secrets parsed from skill frontmatter
  • read_file / search_files / execute_code output is redacted
  • New redaction patterns cover Twilio, AWS, Stripe, JWT, PEM
  • Tests cover all tool actions + edge cases

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havearea/authAuthentication, OAuth, credential poolscomp/toolsTool registry, model_tools, toolsetstype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions