Skip to content

Commit

Permalink
DOC Warn about possible XSS in custom shortcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Sep 6, 2022
1 parent 1b3c49d commit 02075f3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions en/02_Developer_Guides/05_Extending/04_Shortcodes.md
Expand Up @@ -70,6 +70,16 @@ class Page extends SiteTree
}
```

[warning]
Note that the `$arguments` parameter potentially contains any arbitrary key/value pairs the user has chosen to include.
It is strongly recommended that you don't directly convert this array into a list of attributes for your final HTML markup
as that could lead to XSS vulnerabilities in your project.

If you want to use the `$arguments` parameter as a list of attributes for your final HTML markup, it is strongly recommended that you
pass the array through a filter of allowed arguments using [array_filter()](https://www.php.net/manual/en/function.array-filter.php)
or similar.
[/warning]

These parameters are passed to the `MyShortCodeMethod` callback:

- Any parameters attached to the shortcode as an associative array (keys are lower-case).
Expand Down

0 comments on commit 02075f3

Please sign in to comment.