From 0b8aa84ddb2f6a90adb1640d2091ec87ac5787cb Mon Sep 17 00:00:00 2001 From: Rick Date: Sun, 27 Sep 2020 12:17:06 +0200 Subject: [PATCH] Patch de faille XSS et mise aux normes W3C --- app.py | 11 +++++++---- lite/index.html | 23 ++++------------------- templates/apropos.html | 7 ++----- 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/app.py b/app.py index ad3e10f..eb8521e 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, request, redirect, url_for +from flask import Flask, render_template, request, redirect, url_for, make_response from os import path from bs4 import BeautifulSoup @@ -7,7 +7,9 @@ app.config['TEMPLATES_AUTO_RELOAD'] = True @app.route('/') def slash(): - return render_template("index.html") + response = make_response(render_template("index.html")) + response.headers["Content-Security-Policy"] = "default-src 'self'" + return response @app.route("/ajout") def ajout(): @@ -25,15 +27,16 @@ def bizutage(): desc = request.values['desc'] nouvLien = "

{}

Lien


{}

".format(titre, lien, desc) nouvLienHtml = BeautifulSoup(nouvLien, "html.parser") + with open("templates/index.html", 'r') as file: soup = BeautifulSoup(file, 'html.parser') - soup.find("hr").append(nouvLienHtml) + soup.find("hr").insert_after("", nouvLienHtml) with open("templates/index.html", 'w') as file: file.write(soup.prettify()) with open("lite/index.html", 'r') as file: soup = BeautifulSoup(file, 'html.parser') - soup.find("hr").append(nouvLienHtml) + soup.find("hr").insert_after("", nouvLienHtml) with open("lite/index.html", 'w') as file: file.write(soup.prettify()) else: diff --git a/lite/index.html b/lite/index.html index b55215d..86b2cfe 100644 --- a/lite/index.html +++ b/lite/index.html @@ -4,36 +4,21 @@ - Document + Partage de liens
- -
-

Titre

-

Lien

+

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dui eros, molestie vitae dui in, porta volutpat augue. Donec fermentum efficitur ligula, ut facilisis metus ornare a. Vestibulum tempus tincidunt elit, in mattis tellus rutrum facilisis. Phasellus tempor tempus magna, quis vehicula libero commodo a. Nulla eget est euismod, aliquam est vitae, tempor enim. Etiam tincidunt cursus massa et rhoncus. Nunc ut justo mattis, dapibus diam et, viverra magna. Nulla commodo luctus lectus vitae elementum. Cras ullamcorper eu velit ut varius. Nam dictum ante ex, luctus tempor dolor scelerisque sed. Vestibulum malesuada sodales eros vel imperdiet. Cras placerat libero metus, sed mollis augue mattis vitae. Pellentesque sed quam et ligula vestibulum gravida vel vitae tortor. Proin iaculis libero a vulputate rutrum. Proin ornare bibendum tellus, sed fringilla ex posuere vitae. Ut sed lorem vel neque tempor placerat.

-

Tags:

-
    -
  • Opsec
  • -
  • Informatique
  • -
-
+ Version Alpha + diff --git a/templates/apropos.html b/templates/apropos.html index 103b5a2..377967c 100644 --- a/templates/apropos.html +++ b/templates/apropos.html @@ -15,15 +15,12 @@

-

- Site en alpha. Futurs ajouts : +

Site en alpha. Futurs ajouts :

- - Vous pouvez me proposer des ajouts en ouvrant un ticket sur le git ou en envoyant un mail à rick <AT> gnous <dot> eu. -

+

Vous pouvez me proposer des ajouts en ouvrant un ticket sur le git ou en envoyant un mail à rick <AT> gnous <dot> eu.

Ce site est conçu pour réunir des liens de manière efficace afin de retrouver ou de stocker facilement une url.