Skip to content

Refs CVE-2026-48587 -- Added helper to properly split header values. - #21438

Merged
nessita merged 1 commit into
django:mainfrom
nessita:follow-up-CVE-2026-48587
Jun 8, 2026
Merged

nessita merged 1 commit into
django:mainfrom
nessita:follow-up-CVE-2026-48587

Conversation

@nessita

@nessita nessita commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Trac ticket number

CVE-2026-48587

Branch description

Extracted the repeated split(",") + per-token .strip() pattern into a split_header_value() generator in django/utils/http.py. The previous cc_delim_re regex only stripped whitespace adjacent to the comma delimiter, leaving leading or trailing whitespace on the first and last tokens. Now, split_header_value() strips every token fully, matching RFC 9110's optional-whitespace rules.

AI Assistance Disclosure (REQUIRED)

  • No AI tools were used in preparing this PR.
  • If AI tools were used, I have disclosed which ones, and fully reviewed and verified their output.

Claude code was used to review the changes as a whole to ensure consistency and no missing spots.

Checklist

  • This PR follows the contribution guidelines.
  • This PR does not disclose a security vulnerability (see vulnerability reporting).
  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period (see guidelines).
  • I have not requested, and will not request, an automated AI review for this PR.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

@github-actions github-actions Bot added the no ticket Based on PR title, no linked Trac ticket label Jun 8, 2026
@nessita
nessita requested a review from jacobtylerwalls June 8, 2026 19:05

@jacobtylerwalls jacobtylerwalls left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this looks great.

Comment thread django/utils/http.py Resolved
Extracted the repeated `split(",")` + per-token `.strip()` pattern into
a `split_header_value()` generator in django/utils/http.py. The previous
`cc_delim_re` regex only stripped whitespace adjacent to the comma
delimiter, leaving leading or trailing whitespace on the first and last
tokens. Now, `split_header_value()` strips every token fully, matching
RFC 9110's optional-whitespace rules.

Thanks to Shai Berger, Jacob Walls, and Sarah Boyce for reviews.
@nessita
nessita force-pushed the follow-up-CVE-2026-48587 branch from 2642bb0 to 5a19927 Compare June 8, 2026 20:34
@nessita
nessita merged commit 526b1b4 into django:main Jun 8, 2026
19 checks passed
@nessita
nessita deleted the follow-up-CVE-2026-48587 branch June 8, 2026 23:07
Comment thread django/utils/cache.py
from django.utils.timezone import get_current_timezone_name
from django.utils.translation import get_language

cc_delim_re = _lazy_re_compile(r"\s*,\s*")

@laymonage laymonage Jun 9, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @nessita @jacobtylerwalls, just a heads-up. The removal of this expression might warrant a mention in the release notes. It's used by DRF at the moment, which would break until they fix it.

https://github.com/encode/django-rest-framework/blob/2a910c8c2b31b857db7695c83d27ef3cf70a4054/rest_framework/views.py#L10

@nessita nessita Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you @laymonage for raising this, but Django does not guarantee backwards compatibility for private symbols, and cc_delim_re was a private, undocumented implementation detail. It was never part of the public API and did not appear in the documentation. Third-party code relying on private internals should expect breakage across releases, we can't possibly document every internal refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no ticket Based on PR title, no linked Trac ticket

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants