fix(ticketing): render email templates without a permission check - #369
Merged
Conversation
Frappe's get_email_template() is whitelisted and reads the Email Template as the session user. Public bookings and sponsorship enquiries submit as Guest, who has no read permission on Email Template, so the render raised PermissionError. On tickets that error was swallowed by on_submit, leaving the attendee with a confirmed booking and no email. Route all three call sites through render_email_template(), which formats the template directly off the doc. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The guest ticket test leaned on a mock of frappe's whitelisted helper, which only bit because that import was function-local — the same mock is a no-op for the module-level imports in Event Booking and Sponsorship Enquiry. Assert the invariant on render_email_template() instead: a Website User with no read access on Email Template still gets a rendered subject and message. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Greptile SummaryThe PR replaces Frappe’s permission-checked email-template helper with an internal renderer so guest and Website User workflows can send configured emails.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified. The changed call sites retain their existing server-controlled template selection and email behavior while avoiding the permission-checked rendering path that prevented guest-facing emails.
|
| Filename | Overview |
|---|---|
| buzz/utils.py | Adds the permission-independent template renderer used by guest-facing email flows; no concrete defect was identified. |
| buzz/ticketing/doctype/event_ticket/event_ticket.py | Routes ticket-template rendering through the new helper while preserving template selection, message construction, and attachments. |
| buzz/ticketing/doctype/event_booking/event_booking.py | Routes booking-confirmation rendering through the new helper without changing fallback precedence or recipient handling. |
| buzz/proposals/doctype/sponsorship_enquiry/sponsorship_enquiry.py | Routes configured sponsorship pitch-deck templates through the new helper while retaining existing send behavior. |
| buzz/ticketing/doctype/event_ticket/test_event_ticket.py | Adds regression coverage for unprivileged template rendering and guest ticket-email delivery. |
Reviews (1): Last reviewed commit: "test(ticketing): pin email rendering to ..." | Re-trigger Greptile
Contributor
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin main
git worktree add -d .worktree/backport-369-to-main origin/main
cd .worktree/backport-369-to-main
git switch --create backport-369-to-main
git cherry-pick -x b724d9158102db2ce9301bf13ff465d2a158fa4e |
harshtandiya
added a commit
that referenced
this pull request
Aug 20, 2026
…ckport #369) (#370) fix(ticketing): render email templates without a permission check (#369) * fix(ticketing): render email templates without a permission check Frappe's get_email_template() is whitelisted and reads the Email Template as the session user. Public bookings and sponsorship enquiries submit as Guest, who has no read permission on Email Template, so the render raised PermissionError. On tickets that error was swallowed by on_submit, leaving the attendee with a confirmed booking and no email. Route all three call sites through render_email_template(), which formats the template directly off the doc. * test(ticketing): pin email rendering to run without Desk permissions The guest ticket test leaned on a mock of frappe's whitelisted helper, which only bit because that import was function-local — the same mock is a no-op for the module-level imports in Event Booking and Sponsorship Enquiry. Assert the invariant on render_email_template() instead: a Website User with no read access on Email Template still gets a rendered subject and message. --------- (cherry picked from commit b724d91) Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Ticket, booking-confirmation and sponsor pitch-deck emails all rendered their
Email Template through
frappe.email...get_email_template(), which iswhitelisted and reads the template as the session user. Read on Email Template
is granted to
Desk UserandSystem Manageronly, so every attendee-facingsend raised
PermissionError— guests booking publicly, logged-in WebsiteUsers booking for themselves, and Buzz Users raising a sponsorship enquiry.
Both
on_submithandlers swallow the exception, so the booking succeeded andthe email silently never went out;
str(PermissionError)is empty, which iswhy the Error Log entry had no message.
All three call sites now go through
buzz.utils.render_email_template(), whichformats the template off the doc directly.
Only shows up on a frappe carrying the
check_permission("read")insideget_email_template()— our local bench (develop@80d9c31) predates it,so this reproduces on CI and production, not necessarily on your machine.
Not touched: the blanket
except Exception+log_error(str(e))inEventTicket.on_submitthat hid this. Worth narrowing separately.Demo
No UI change.
skip-demo.Testing
TestRenderEmailTemplate— a Website User with no read access on EmailTemplate still gets a rendered subject and message. Goes red on any frappe
with the permission check if the whitelisted helper comes back.
TestGuestTicketEmail— guest ticket submit renders from the event template.bench run-tests: event_ticket 12, event_booking 40, booking API 33,sponsorship_enquiry 4 — all pass.