Merge pull request #30583 from nickhudkins/feat/uri-allowlist

feat(sanitizer): add support for allowlisting additional URI protocols
This commit is contained in:
Andre Wanlin
2025-07-23 10:58:35 -05:00
committed by GitHub
5 changed files with 87 additions and 0 deletions
+19
View File
@@ -606,6 +606,25 @@ techdocs:
This way, custom element like `<backstage-element attribute1="value"></backstage-element>` will be allowed in the result HTML.
## How to allow additional URI protocols in TechDocs
TechDocs uses the [DOMPurify](https://github.com/cure53/DOMPurify) library to
sanitize HTML and prevent XSS attacks.
It's possible to allow additional URI protocols based on a list of protocols. To do
this, add the allowed protocols in the `techdocs.sanitizer.additionalAllowedURIProtocols`
and `additionalAllowedURIProtocols` configuration of your `app-config.yaml`.
For example:
```yaml
techdocs:
sanitizer:
additionalAllowedURIProtocols: ["vscode"],
```
This way, links like `<a href="vscode://settings/">VSCode Settings<a>` will be allowed in the result HTML
## How to render PlantUML diagram in TechDocs
PlantUML allows you to create diagrams from plain text language. Each diagram description begins with the keyword - (@startXYZ and @endXYZ, depending on the kind of diagram). For UML Diagrams, Keywords @startuml & @enduml should be used. Further details for all types of diagrams can be found at [PlantUML Language Reference Guide](https://plantuml.com/guide).