Skip to content

agent_init.py prints credential prefix/suffix previews to stdout #60319

Description

@chessplusmedia

Affected version

Hermes Agent v2026.7.1 (0.18.0), commit e2fa509bfagent/agent_init.py.

Issue

Two "configured credential" status banners print partial key/token material to
stdout instead of a fully redacted status message:

# ~line 721 (token banner)
print(f"🔑 Using token: {effective_key[:8]}...{effective_key[-4:]}")

# ~line 998 (API key banner)
print(f"🔑 Using API key: {key_used[:8]}...{key_used[-4:]}")

Both sites print the first 8 and last 4 characters of the active credential.

Risk

stdout from agent_init.py is routinely captured into orchestrator logs, run
transcripts, and monitoring pipelines in any deployment that wraps Hermes as a
subprocess (e.g. Paperclip's adapter model). A partial key/token preview in
that captured output is exposure surface that a fully redacted banner would
avoid entirely — the preview conveys no operational value the fully-redacted
form doesn't also convey ("a credential is configured"), while carrying real
disclosure risk if that output path is ever less trusted than assumed (shared
logs, third-party log aggregation, screen-shared debugging sessions, etc).

Proposed fix

Replace both partial-preview banners with a fixed [configured] marker:

print("🔑 Using token: [configured]")
print("🔑 Using API key: [configured]")

Preserve the existing Microsoft Entra ID credential-type banner and the
invalid/missing-API-key warning unchanged — only the two partial-preview
prints need to change.

Production experience

We've carried a redaction patch for both sites in production since 2026-07-02,
covered by 4 focused unit tests (fully-redacted output for both banners; the
Entra ID banner still fires correctly without invoking the credential
provider; the invalid/missing-key warning still fires correctly). No
regression observed since. Happy to share the patch/tests directly if useful
— omitted from this issue body to avoid pasting the full diff into a public
thread unprompted, and because no real secret material should appear in
either the issue or the fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havearea/authAuthentication, OAuth, credential poolscomp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpointsweeper:risk-security-boundarySweeper risk: may affect sandboxing, auth, credentials, or sensitive datatype/securitySecurity vulnerability or hardening

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions