Skip to content

Keep users' email addresses out of templates - #414

Open
mraible wants to merge 2 commits into
masterfrom
template-user-email
Open

mraible wants to merge 2 commits into
masterfrom
template-user-email

Conversation

@mraible

@mraible mraible commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Templates can reach any user through the site model, entry creators and the logged-in visitor. With custom themes on, a weblog admin writes templates, so a template could print other users' email addresses.

  • UserWrapper no longer provides an email address, matching 6.1.8 (ae8bf7d). Bundled themes don't use it, and the template guide no longer lists it. A custom theme that uses it shows the reference itself, such as $user.emailAddress, unless it's written $!user.emailAddress or inside an #if.
  • This covers user objects only. The weblog's own contact address and commenter details are unchanged.
  • UserWrapperTest checks that the wrapper has no email accessor.

Templates can reach any user through the site model, entry creators and the logged-in visitor, and with custom themes on a weblog admin writes templates, so UserWrapper no longer provides an email address. This matches 6.1.8 (ae8bf7d). Bundled themes don't use it, and the template guide no longer lists it.

UserWrapperTest checks that the wrapper has no email accessor.
@mraible mraible added the 7.0.0 label Dec 3, 2026

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR-Review: 1 inline comment posted.

Comment thread CHANGES.md Outdated
- **Templates no longer get users' email addresses.** `$user.emailAddress`
and the other user objects in templates, including the logged-in visitor,
no longer provide one, as in 6.1.8. Bundled themes don't use it; a custom
theme that does prints nothing there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🐞Gemini Issue: Important: In Velocity (with runtime.references.strict unset in velocity.properties), a non-quiet reference to a removed property like $user.emailAddress or $entry.creator.emailAddress renders literally as $user.emailAddress rather than printing nothing—only $!user.emailAddress (quiet notation) or an #if guard prints nothing. Consider updating this upgrade note (and the PR description) to say it prints the reference as text unless written with $!, matching the earlier macro notes in CHANGES.md.

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.

Good catch, thanks. Velocity prints a reference it can't resolve as written, so the page shows $user.emailAddress; only $!user.emailAddress or an #if prints nothing. I fixed the CHANGES note and the PR description to say that.

Velocity prints a reference it can't resolve as written, so a custom theme that still uses $user.emailAddress shows that text. Only the quiet form or an #if guard prints nothing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants