Skip to content

Display name using v-pre in auth scaffolding#21659

Closed
suth wants to merge 1 commit into
laravel:5.5from
suth:patch-1
Closed

Display name using v-pre in auth scaffolding#21659
suth wants to merge 1 commit into
laravel:5.5from
suth:patch-1

Conversation

@suth
Copy link
Copy Markdown

@suth suth commented Oct 13, 2017

Issue

The default auth scaffolding displays the user's name HTML escaped, but if the user has used curly braces the default Vue setup will try to interpolate it. This could lead to the user executing javascript or breaking the page rendering entirely. I don't believe this is a security vulnerability since it will only happen to the currently authenticated user, but a good example should be set for users.

Steps to Reproduce

  1. Create a new Laravel project
  2. Run php artisan auth:make
  3. Register a user named {{ breaksPage }} or {{ alert('Hello World') }}

Solution

Use the v-pre Vue directive on the element displaying the name.

@taylorotwell
Copy link
Copy Markdown
Member

I don't really understand what you're talking about. Why would we put a v-pre directive on a page that doesn't even use Vue at all?

@suth
Copy link
Copy Markdown
Author

suth commented Oct 13, 2017

Out of the box Laravel includes a compiled JS file that mounts Vue to #app, so even if it's not intended, the page does use Vue.

This video follows those three steps exactly: https://streamable.com/k2uc5

suth referenced this pull request Mar 16, 2018
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.

2 participants