Skip to content

Commit 774d527

Browse files
committed
Merge branch 'release/6.2.2'
2 parents f1d8774 + 403747a commit 774d527

14 files changed

Lines changed: 44 additions & 18 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v6.2.2
2+
## 07/02/2026
3+
4+
1. [](#bugfix)
5+
* [security] Shortcode parameters that set an element's color, size, id, class or style are now escaped when written into the page, closing a stored cross-site scripting hole where a crafted value could break out of the attribute and run script in a visitor's or an administrator's browser ([GHSA-q5fw-vpqc-fgph](https://github.com/getgrav/grav/security/advisories/GHSA-q5fw-vpqc-fgph)).
6+
17
# v6.2.1
28
## 06/29/2026
39

blueprints.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Shortcode Core
22
slug: shortcode-core
33
type: plugin
4-
version: 6.2.1
4+
version: 6.2.2
55
description: "This plugin provides the core functionality for shortcode plugins"
66
icon: code
77
author:

classes/shortcodes/ColorShortcode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ColorShortcode extends Shortcode
88
public function init()
99
{
1010
$this->shortcode->getHandlers()->add('color', function(ShortcodeInterface $sc) {
11-
$color = $sc->getParameter('color', $this->getBbCode($sc));
11+
$color = self::escAttr($sc->getParameter('color', $this->getBbCode($sc)));
1212

1313
return '<span style="color: ' . $color . ';">' . $sc->getContent() . '</span>';
1414
});

classes/shortcodes/ColumnsShortcode.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ public function init()
99
{
1010
$this->shortcode->getHandlers()->add('columns', static function(ShortcodeInterface $sc) {
1111
$column_count = (int)$sc->getParameter('count', 2);
12-
$column_width = $sc->getParameter('width', 'auto');
13-
$column_gap = $sc->getParameter('gap', 'normal');
12+
$column_width = self::escAttr($sc->getParameter('width', 'auto'));
13+
$column_gap = self::escAttr($sc->getParameter('gap', 'normal'));
1414
$column_rule = $sc->getParameter('rule', false);
15+
$column_rule = $column_rule ? self::escAttr($column_rule) : $column_rule;
1516

1617
$css_style = 'columns:' . $column_count . ' ' . $column_width . ';-moz-columns:' . $column_count . ' ' . $column_width . ';';
1718
$css_style .= 'column-gap:' . $column_gap . ';-moz-column-gap:' . $column_gap . ';';

classes/shortcodes/DetailsShortcode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function init()
1414

1515
// Get classes for details
1616
$class = $sc->getParameter('class', $this->getBbCode($sc));
17-
$classHTML = (isset($class) and $class !== $summary) ? 'class="' . $class . '"' : '';
17+
$classHTML = (isset($class) and $class !== $summary) ? 'class="' . self::escAttr($class) . '"' : '';
1818

1919
// Get content
2020
$content = $sc->getContent();

classes/shortcodes/DivShortcode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ class DivShortcode extends Shortcode
88
public function init()
99
{
1010
$this->shortcode->getHandlers()->add('div', static function(ShortcodeInterface $sc) {
11-
$id = $sc->getParameter('id');
12-
$class = $sc->getParameter('class');
13-
$style = $sc->getParameter('style');
11+
$id = self::escAttr($sc->getParameter('id'));
12+
$class = self::escAttr($sc->getParameter('class'));
13+
$style = self::escAttr($sc->getParameter('style'));
1414

1515
$id_output = $id ? ' id="' . $id . '" ': '';
1616
$class_output = $class ? ' class="' . $class . '"' : '';

classes/shortcodes/FigureShortcode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class FigureShortcode extends Shortcode
99
public function init()
1010
{
1111
$this->shortcode->getHandlers()->add('figure', function(ShortcodeInterface $sc) {
12-
$id = $sc->getParameter('id');
13-
$class = $sc->getParameter('class');
12+
$id = self::escAttr($sc->getParameter('id'));
13+
$class = self::escAttr($sc->getParameter('class'));
1414
$caption = $sc->getParameter('caption');
1515
$page = $this->grav['page'];
1616

classes/shortcodes/FontAwesomeShortcode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function init()
4444
}
4545
}
4646

47-
return '<i class="' . $fa_class . ' ' . $icon . '">' . $str . '</i>';
47+
return '<i class="' . self::escAttr($fa_class . ' ' . $icon) . '">' . $str . '</i>';
4848
}
4949

5050
return '';

classes/shortcodes/HShortcode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public function init()
3636

3737
protected function header($level, ShortcodeInterface $sc)
3838
{
39-
$id = $sc->getParameter('id');
40-
$class = $sc->getParameter('class');
39+
$id = self::escAttr($sc->getParameter('id'));
40+
$class = self::escAttr($sc->getParameter('class'));
4141
$tag = 'h' . $level;
4242

4343
$id_output = $id ? ' id="' . $id . '" ': '';

classes/shortcodes/MarkShortcode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function init()
99
{
1010
$this->shortcode->getHandlers()->add('mark', function(ShortcodeInterface $sc) {
1111
$style = $sc->getParameter('style', $this->getBbCode($sc));
12-
$class = $sc->getParameter('class', 'default');
12+
$class = self::escAttr($sc->getParameter('class', 'default'));
1313

1414
$css_class = 'class="mark-class-' . $class . '"';
1515

0 commit comments

Comments
 (0)