Validate if the URL link is allowed in output. This validator can prohibit more than really needed to prevent XSS. It's a tradeoff to keep code simple and to be secure by default. Note: the url should be normalized at this point, and existing entities decoded.
(self, url: str)
| 321 | # link methods |
| 322 | |
| 323 | def validateLink(self, url: str) -> bool: |
| 324 | """Validate if the URL link is allowed in output. |
| 325 | |
| 326 | This validator can prohibit more than really needed to prevent XSS. |
| 327 | It's a tradeoff to keep code simple and to be secure by default. |
| 328 | |
| 329 | Note: the url should be normalized at this point, and existing entities decoded. |
| 330 | """ |
| 331 | return normalize_url.validateLink(url) |
| 332 | |
| 333 | def normalizeLink(self, url: str) -> str: |
| 334 | """Normalize destination URLs in links |