Skip to content

caddyauth: preserve unknown placeholders in credentials - #8021

Closed
zzz-yu wants to merge 1 commit into
caddyserver:masterfrom
zzz-yu:fix/basic-auth-literal-placeholders
Closed

zzz-yu wants to merge 1 commit into
caddyserver:masterfrom
zzz-yu:fix/basic-auth-literal-placeholders

Conversation

@zzz-yu

@zzz-yu zzz-yu commented Sep 14, 2026

Copy link
Copy Markdown

Summary

Fixes #8016.

Basic-auth account usernames and passwords were passed through repl.ReplaceAll, which silently removed unknown {...} sequences. This changed literal usernames and could turn a malformed password hash into a different, silently accepted value.

Use ReplaceKnown so configured credentials preserve unknown placeholders while supported placeholders such as {env.*} continue to expand. This matches the behavior already used by response headers and keeps configuration errors visible to operators.

Testing

The issue's regression tests cover literal braces in usernames and passwords and real placeholder expansion. The change is limited to the two credential replacement calls.

Assistance disclosure

OpenAI Codex (GPT-5) assisted with issue investigation, patch drafting, and test design. I reviewed the complete diff and verified that only the two credential replacement calls changed.

Signed-off-by: Yu Zhou <66656208+zzz-yu@users.noreply.github.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mohammed90

Copy link
Copy Markdown
Member

and test design

Where are they?

@steadytao

Copy link
Copy Markdown
Member

kekw no test. also sign the CLA please.

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.

basic auth blanks literal braces in usernames and passwords (unknown placeholders)

4 participants