Aevann 2024-04-20 18:26:20 +02:00
parent a1935497db
commit 90e9087118
2 changed files with 4 additions and 2 deletions

View File

@ -3,7 +3,7 @@ from bleach.css_sanitizer import CSSSanitizer
from bleach.linkifier import LinkifyFilter
import functools
from files.helpers.regex import sanitize_url_regex
from files.helpers.regex import sanitize_url_regex, excessive_css_scale_regex
from files.helpers.config.const import *
allowed_tags = ('a','alpha','audio','b','big','blink','blockquote','br','center','code','del','details','em','g','gl','h1','h2','h3','h4','h5','h6','hr','i','img','li','lite-youtube','marquee','ol','p','pre','rp','rt','ruby','small','span','spoiler','strike','strong','sub','summary','sup','table','tbody','td','th','thead','tr','u','ul','video')
@ -13,7 +13,7 @@ allowed_css_properties = ('background-color', 'color', 'filter', 'font-weight',
def allowed_attributes(tag, name, value):
if name == 'style':
value = value.lower()
if 'transform' in value and 'scale' in value and ('rotate' in value or 'skew' in value):
if 'transform' in value and 'scale' in value and excessive_css_scale_regex.search(value):
return False
return True

View File

@ -159,6 +159,8 @@ pronouns_regex = re.compile("(\w{1,7})\/\w{1,7}(\/\w{1,7})?", flags=re.A)
html_title_regex = re.compile("<title>(.{1,200})</title>", flags=re.I)
excessive_css_scale_regex = re.compile("scale\(.*?(\d{3})", flags=re.A)
commands = {
"fortune": FORTUNE_REPLIES,
"factcheck": FACTCHECK_REPLIES,