-
Notifications
You must be signed in to change notification settings - Fork 533
Unscaped html for error msg #370
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
Unscaped html for error msg #370
Conversation
Is it important to create a new field property? Can we use always |
I think you are right. But I've no idea whether this always v-html will result in some XSS attack? |
I think XSS is not relevant here because we don't render user input texts, just error messages what comes from the developer. |
Yep, I agree with you. So I'll remove the field property and add |
Ok 👍 |
src/formGenerator.vue
Outdated
@@ -14,8 +14,7 @@ div.vue-form-generator(v-if='schema != null') | |||
button(v-for='btn in field.buttons', @click='buttonClickHandler(btn, field, $event)', :class='btn.classes') {{ btn.label }} | |||
.hint(v-if='field.hint') {{ fieldHint(field) }} | |||
.errors.help-block(v-if='fieldErrors(field).length > 0') | |||
span(v-for='(error, index) in fieldErrors(field)', v-if='field.errorUnescaped', v-html="error", track-by='index') | |||
span(v-for='(error, index) in fieldErrors(field)', v-if='!field.errorUnescaped', track-by='index') {{ error }} | |||
span(v-for='(error, index) in fieldErrors(field)', v-html="error", track-by='index') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add indent
Thanks! |
With pleasure. |
Adding a schema property named errorUnescaped to fulfill the situation that the severside return a string with unescaped html.
see: https://jsfiddle.net/7of916d4/2/