Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML entities in plain text notification #19290

Closed
tillkruss opened this issue May 20, 2017 · 1 comment
Closed

HTML entities in plain text notification #19290

tillkruss opened this issue May 20, 2017 · 1 comment

Comments

@tillkruss
Copy link
Contributor

tillkruss commented May 20, 2017

  • Laravel Version: 5.4.23
  • PHP Version: 7.1.4

Description:

I've got object names that contains single or double quotes that are being mentioned in notifications:

$message = (new MailMessage)
    ->line('This line "contains" double quotes.')

The HTML source part of the notifications ends up containing un-encoded double quotes, however the plain-text part contains HTML entities:

This line "contains" double quotes.

Which obviously shouldn't happen and doesn't read well.

I'm not sure if this a bug, or if I should just run html_entity_decode() in my /markdown templates.

@yassine-kessal
Copy link

yassine-kessal commented Jun 1, 2017

This is a security prevention!

The simplest solution is to edit {{ $line }} by this following syntax : {!! $line !!} in resources/views/vendor/notifications/email.blade.php After having done php artisan vendor:publish --tag=laravel-notifications, because the {{ }} statements are automatically sent through PHP's htmlspecialchars function to prevent XSS attacks.

Be sure of what you are doing because you are open to attack XSS if you receive the data of the user and you send them directly to the notification

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

No branches or pull requests

2 participants