First commit
This commit is contained in:
6
views/error.pug
Normal file
6
views/error.pug
Normal file
@@ -0,0 +1,6 @@
|
||||
extends layout
|
||||
|
||||
block content
|
||||
h1= message
|
||||
h2= error.status
|
||||
pre #{error.stack}
|
||||
48
views/index.pug
Normal file
48
views/index.pug
Normal file
@@ -0,0 +1,48 @@
|
||||
extends layout
|
||||
|
||||
block content
|
||||
h1= title
|
||||
p Bienvenue sur la page de démonstration XSS.
|
||||
|
||||
hr
|
||||
|
||||
h2 Formulaire de test
|
||||
p Entrez un texte normal (ex: "chats") ou un script (ex:
|
||||
code <script>alert('XSS !')</script>
|
||||
| )
|
||||
|
||||
form(method="GET" action="/" style="margin-top: 10px;")
|
||||
label(for="search-input") Votre recherche :
|
||||
input(type="text" name="search" id="search-input" style="width: 300px;" placeholder="<script>alert('XSS !')</script>")
|
||||
button(type="submit") Lancer la recherche
|
||||
|
||||
hr
|
||||
|
||||
// On n'affiche les résultats que si un terme de recherche est présent
|
||||
if searchTerm
|
||||
h2 1. Rendu SÉCURISÉ (par défaut avec Pug)
|
||||
p
|
||||
| Le template utilise
|
||||
code #{searchTerm}
|
||||
| . Pug "échappe" les caractères HTML.
|
||||
p
|
||||
strong Résultat :
|
||||
//- C'est la syntaxe SÉCURISÉE
|
||||
span(style="background-color: #e0fde0; padding: 5px; border-radius: 4px;") #{searchTerm}
|
||||
|
||||
hr
|
||||
|
||||
h2 2. Rendu VULNÉRABLE (Faille XSS)
|
||||
p
|
||||
| Le template utilise
|
||||
code !{searchTerm}
|
||||
| . Le
|
||||
code !
|
||||
| désactive l'échappement.
|
||||
p
|
||||
strong Résultat :
|
||||
//- C'est la syntaxe VULNÉRABLE. Le script sera inséré tel quel, car l'échappement est désactivé (!).
|
||||
span(style="background-color: #fde0e0; padding: 5px; border-radius: 4px;") !{searchTerm}
|
||||
|
||||
else
|
||||
p (Aucune recherche effectuée)
|
||||
7
views/layout.pug
Normal file
7
views/layout.pug
Normal file
@@ -0,0 +1,7 @@
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
title= title
|
||||
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||
body
|
||||
block content
|
||||
Reference in New Issue
Block a user