First commit

This commit is contained in:
Johan
2025-12-18 15:18:51 +01:00
commit 8438829832
11 changed files with 2279 additions and 0 deletions

6
views/error.pug Normal file
View File

@@ -0,0 +1,6 @@
extends layout
block content
h1= message
h2= error.status
pre #{error.stack}

48
views/index.pug Normal file
View 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
View File

@@ -0,0 +1,7 @@
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content