0
0
Vueframework~10 mins

Why security matters in Vue - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Av-text
Bv-html
CuserInput
DrawHtml
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html to display user input directly, which can cause XSS vulnerabilities.
2fill in blank
medium

Complete 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'
AuserComment
BrawHtml
Cv-html
DdangerousContent
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html to render untrusted user content.
3fill in blank
hard

Fix 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'
Av-text
Bv-html
Cv-bind
Dv-show
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html which renders raw HTML and can be unsafe.
4fill in blank
hard

Fill 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'
Av-text
BuserMessage
Cv-html
DrawInput
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html which can cause security issues.
5fill in blank
hard

Fill 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'
Atitle
Bv-text
Cdescription
Dv-html
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-html for description which can cause security risks.