Skip to content

Commit

Permalink
Merge pull request #114 from creative-commoners/pulls/4.11/shortcode-…
Browse files Browse the repository at this point in the history
…docs

DOC Warn about possible XSS in custom shortcodes
  • Loading branch information
GuySartorelli authored Nov 21, 2022
2 parents 7839c47 + 02075f3 commit 144ab74
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
Original file line number Diff line number Diff line change
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 144ab74

Please sign in to comment.