Skip to content

Fix/auth secret hygiene#14

Merged
Skobeltsyn merged 2 commits into
mainfrom
fix/auth-secret-hygiene
May 3, 2026
Merged

Fix/auth secret hygiene#14
Skobeltsyn merged 2 commits into
mainfrom
fix/auth-secret-hygiene

Conversation

@Skobeltsyn
Copy link
Copy Markdown
Contributor

No description provided.

Skobeltsyn and others added 2 commits May 3, 2026 11:48
The agentic loop previously auto-injected memory_read/write/search into
the authorized set of EVERY skill on an agent that had a memoryBank
configured. A jailbroken read-only summarizer skill could persist
arbitrary content via memory_write that the developer never granted it.

Now Skill exposes useMemory() (private setter for the field). AgenticLoop
detects whether ANY skill on the agent has opted in:
- If yes: only opted-in skills get memory_* tools.
- If no: legacy default-on behavior (every skill gets memory if memoryBank
  is set) is preserved so existing single-skill agents keep working.

This is the security fix without breaking backward compatibility. A
follow-up ticket should flip the default to off in a major release.

New MemoryToolPerSkillOptInTest covers:
- Legacy single-skill auto-inject (regression).
- Two-skill agent: one opts in, the other does NOT — non-opted skill's
  tool set must NOT include memory_*.
- Opted-in skill receives memory tools.
- Agent without memoryBank ignores useMemory() entirely.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Default data-class toString() printed the raw token. Any println(auth),
Throwable.message capturing the auth instance, or default-formatted log
line leaked the credential.

Override toString() to render "Bearer(token=<redacted>)". data-class
semantics (equals, hashCode, .token property) are preserved — only the
log/debug surface is hardened.

Future work (out of scope): store token as CharArray and expose close()
that wipes it. That requires the transport to know its lifetime and is
better tackled in a separate ticket.

New McpAuthRedactionTest covers the redaction, the interpolation case,
and confirms equals/hashCode/.token property still work.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Skobeltsyn Skobeltsyn merged commit b99643b into main May 3, 2026
4 checks passed
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