Skip to content

Escape untrusted strings in LNURL-auth logs - #1184

Open
benthecarman wants to merge 2 commits into
lightningdevkit:mainfrom
benthecarman:sanitize-lnurl-auth-logs
Open

benthecarman wants to merge 2 commits into
lightningdevkit:mainfrom
benthecarman:sanitize-lnurl-auth-logs

Conversation

@benthecarman

Copy link
Copy Markdown
Contributor

The LNURL-auth flow logged the decoded callback URL, its tag query parameter, and the server-supplied failure reason verbatim. All three are controlled by whoever produced the LNURL or runs the auth server, so embedded newlines or terminal escape sequences could forge log lines or tamper with an operator's terminal.

Render these values through PrintableString, which replaces control characters, as is already done for other untrusted strings.

This was found by Project Loupe.

The LNURL-auth flow logged the decoded callback URL, its tag query
parameter, and the server-supplied failure reason verbatim. All three
are controlled by whoever produced the LNURL or runs the auth server,
so embedded newlines or terminal escape sequences could forge log
lines or tamper with an operator's terminal.

Render these values through PrintableString, which replaces control
characters, as is already done for other untrusted strings.

This was found by Project Loupe.

This change was made with the help of Claude Code.
@ldk-reviews-bot

ldk-reviews-bot commented Oct 20, 2026 •

Copy link
Copy Markdown

I've assigned @tnull 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.

The full LNURL-auth callback URL was written to the debug log. It
carries the k1 challenge and may also include userinfo credentials or
service-specific session parameters, which then end up in log files or
custom log sinks.

Log just the domain instead, which is all that's needed to tell which
service the node is authenticating with.

This was found by Project Loupe.

This change was made with the help of Claude Code.
@ldk-reviews-bot
ldk-reviews-bot requested a review from tnull October 20, 2026 19:20
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