Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to bind user input safely in Vue.
Vue
<template>
<div>{{ [1] }}</div>
</template> Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html to display user input directly, which can cause XSS vulnerabilities.
✗ Incorrect
Using {{ userInput }} safely displays user input as plain text, preventing security risks.
2fill in blank
mediumComplete the code to prevent XSS by escaping HTML in Vue template.
Vue
<template>
<p>{{ [1] }}</p>
</template> Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html to render untrusted user content.
✗ Incorrect
Binding userComment with double curly braces escapes HTML, preventing XSS.
3fill in blank
hardFix the error in the code that causes unsafe HTML rendering.
Vue
<template> <div [1]="userContent"></div> </template>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html which renders raw HTML and can be unsafe.
✗ Incorrect
Using v-text binds text safely, escaping HTML and preventing XSS.
4fill in blank
hardFill both blanks to safely bind user input and prevent XSS.
Vue
<template> <p [1]="[2]"></p> </template>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html which can cause security issues.
✗ Incorrect
Using v-text="userMessage" safely binds text and escapes HTML.
5fill in blank
hardFill all three blanks to create a safe Vue component that avoids XSS.
Vue
<template>
<div>
<h1>{{ [1] }}</h1>
<p [2]="[3]"></p>
</div>
</template> Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html for description which can cause security risks.
✗ Incorrect
Binding title and description safely with mustache and v-text prevents XSS.