Skip to content

chore(teak): backport security patch - #853

Merged
kaustavb12 merged 3 commits into
opencraft/teakfrom
kaustav/bb-11021-security-patches-teak
Jul 20, 2026
Merged

chore(teak): backport security patch#853
kaustavb12 merged 3 commits into
opencraft/teakfrom
kaustav/bb-11021-security-patches-teak

Conversation

@kaustavb12

@kaustavb12 kaustavb12 commented Jul 20, 2026

Copy link
Copy Markdown
Member

This backports fixes for GHSA-rv5w-f4r5-h77g and GHSA-6cmm-8875-5pcw to the common Teak branch.

Private-ref: BB-11021

feanil and others added 3 commits July 20, 2026 14:49
Discussion thread titles (and other user-controlled context fields —
replier_name, author_name, username) were interpolated raw into
notification.content via `str.format(**context)`. That output is
rendered with Django's `|safe` filter in digest_content.html, which
is included by both the email_digest and batched_email body
templates, so a `<style>` block in a thread title survived into
recipient inboxes as executable CSS on email open — enabling
open-tracking, content spoofing, and phishing.

Escape at the source: in `get_notification_content`, wrap every
context value with `django.utils.html.escape` before
`template.format(**context)`, exempting the two structural keys
(`p`, `strong`) that content_templates use as HTML tag names. This
defends every renderer of `notification.content` in one place.

This is the incomplete-patch companion of GHSA-4xv3-5j4x-q8g4
(CVE-2026-42857), which sanitized the post body via
`clean_thread_html_body()` but did not cover the title path.
Fixes GHSA-rv5w-f4r5-h77g.

(cherry picked from commit 08b719ce41bb369fa0cabbe8d0547124e64c8566)
(cherry picked from commit 52f2b3b)
`startswith` is the wrong primitive for "is target inside directory base":
once a trailing separator drops anywhere along the way, sibling directories
whose names extend base match. We could spot-fix by re-appending the
separator before the check, but `commonpath` makes the directory-boundary
intent explicit and removes the failure mode entirely.

Fixes GHSA-6cmm-8875-5pcw.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 97de058)
(cherry picked from commit 7017593)

@Agrendalath Agrendalath 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.

The failing pylint checks seem to be unrelated.

@kaustavb12
kaustavb12 merged commit 671e9f4 into opencraft/teak Jul 20, 2026
45 of 47 checks passed
@kaustavb12
kaustavb12 deleted the kaustav/bb-11021-security-patches-teak branch July 20, 2026 13:59
Cup0fCoffee pushed a commit that referenced this pull request Jul 22, 2026
…ches-teak

chore(teak): backport security patch

(cherry picked from commit 671e9f4)
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.

3 participants