Skip to content

digest: escape control codes too#21915

Closed
bagder wants to merge 4 commits into
masterfrom
bagder/digest-escape
Closed

digest: escape control codes too#21915
bagder wants to merge 4 commits into
masterfrom
bagder/digest-escape

Conversation

@bagder

@bagder bagder commented Jun 8, 2026

Copy link
Copy Markdown
Member

Since the username is decoded when used and control codes are accepted in HTTP usernames in general, the username encoding for the Digest auth needs to percent encode such bytes.

Verified by test 3221

Reported-by: Trail of Bits

Since the username is decoded when used and control codes are accepted
in HTTP usernames in general, the username encoding for the Digest auth
needs to percent encode such bytes.

Verified by test 3221

Reported-by: Trail of Bits
@bagder bagder marked this pull request as ready for review June 8, 2026 21:32
@bagder bagder requested a review from Copilot June 9, 2026 06:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens HTTP Digest authentication header construction by ensuring decoded usernames containing control bytes are safely re-encoded when emitted in the Authorization: Digest ... header, preventing raw control characters from being placed into quoted-string fields.

Changes:

  • Add percent-encoding for non-printable bytes when quoting Digest auth fields.
  • Add new regression test covering CRLF in the URL username for Digest auth (test3221).
  • Register the new test case in the test suite makefile.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
lib/vauth/digest.c Extends Digest quoted-string escaping to percent-encode additional bytes when building Authorization parameters.
tests/data/test3221 New test verifying CRLF in decoded username is percent-encoded in Digest Authorization header.
tests/data/Makefile.am Adds test3221 to the test case list so it runs in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/vauth/digest.c
Comment thread lib/vauth/digest.c
@bagder bagder closed this in a2b943b Jun 9, 2026
@bagder bagder deleted the bagder/digest-escape branch June 9, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants