Skip to content

Reject non-UTF-8 MCP credential env vars - #304

Open
benthecarman wants to merge 1 commit into
lightningdevkit:mainfrom
benthecarman:fix-mcp-config-hardening
Open

benthecarman wants to merge 1 commit into
lightningdevkit:mainfrom
benthecarman:fix-mcp-config-hardening

Conversation

@benthecarman

@benthecarman benthecarman commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

LDK_MACAROON, LDK_BASE_URL, and LDK_TLS_CERT_PATH were read with
std::env::var(..).ok(). A value that was set but not valid UTF-8 was
treated as unset. A malformed LDK_MACAROON therefore silently fell
back to the on-disk admin macaroon. These now return an error naming
the variable.

Found by Project Loupe.

A set but non-UTF-8 LDK_MACAROON was treated as unset, so the bridge
silently loaded the admin macaroon from disk instead. LDK_BASE_URL and
LDK_TLS_CERT_PATH fell back to the config in the same way.

Return an error that names the variable so a malformed override fails
rather than selecting a different credential or endpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ldk-reviews-bot

ldk-reviews-bot commented Oct 7, 2026 •

Copy link
Copy Markdown

I've assigned @tankyleo as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

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.

2 participants