Skip to content

Commit 773f43c

Browse files
committed
fix xss on helloasso iframe
1 parent 058600b commit 773f43c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

public/class-hello-asso-public.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,27 @@ function ha_shortcode($atts)
110110
$type = $atts['type'];
111111
$allowed_styles = array(
112112
'style' => array(
113+
'width' => array(),
113114
'height' => array(),
114115
'border' => array(),
115116
),
116117
);
117118

119+
$pattern = '/^\d+px$/';
120+
118121
if($type == "widget-bouton")
119122
{
120-
$height = $atts['height'] ?? "70px";
123+
$height = preg_match($pattern, $atts['height'] ?? 0) ? $atts['height'] : "70px";
121124
$styleIframe = 'style="width:200px; height:'. $height . '; border:none;"';
122125
}
123126
else if($type == "widget")
124127
{
125-
$height = $atts['height'] ?? "750px";
128+
$height = preg_match($pattern, $atts['height'] ?? 0) ? $atts['height'] : "750px";
126129
$styleIframe = 'style="width:100%; height:'. $height . '; border:none;"';
127130
}
128131
else if($type == "widget-vignette")
129132
{
130-
$height = $atts['height'] ?? "450px";
133+
$height = preg_match($pattern, $atts['height'] ?? 0) ? $atts['height'] : "450px";
131134
$styleIframe = 'style="width:350px; height:'. $height . '; border:none;"';
132135
}
133136

0 commit comments

Comments
 (0)