techdocs(sanitizer): adds iframe support (#8237)

Signed-off-by: dnsaoki2 <dnsaoki@gmail.com>
This commit is contained in:
Denis Aoki
2021-12-27 08:01:22 -03:00
committed by GitHub
parent a85d9fe831
commit aa8f764a3e
6 changed files with 187 additions and 4 deletions
+21
View File
@@ -421,3 +421,24 @@ folder (/docs) or replace the content in this file.
> on how you have configured your `template.yaml`
Done! You now have support for TechDocs in your own software template!
## how to enable iframes in TechDocs
Techdocs uses the [DOMPurify](https://github.com/cure53/DOMPurify) to sanitizes
HTML and prevents XSS attacks
It's possible to allow some iframes based on a list of allowed hosts. To do
this, add the allowed hosts in the `techdocs.sanitizer.allowedIframeHosts`
configuration of your `app-config.yaml`
E.g.
```yaml
techdocs:
sanitizer:
allowedIframeHosts:
- drive.google.com
```
This way, all iframes where the host of src attribute is in the
`sanitizer.allowedIframeHosts` list will be displayed