nh3 icon indicating copy to clipboard operation
nh3 copied to clipboard

Python binding to Ammonia HTML sanitizer Rust crate

Results 17 nh3 issues
Sort by recently updated
recently updated
newest added

``` html = "google.com" nh3.clean(html, tags={'a'}, attributes={'a': {'href', 'rel'}}) ``` ``` pyo3_runtime.PanicException: assertion failed: self.tag_attributes.get("a").and_then(|a| a.get("rel")).is_none() ```

It would be nice if the Python package could also expose ammonia’s default whitelisted URL schemes. If I understand the code correctly, this could easily be done by adding `m.add("ALLOWED_URL_SCHEMES",...

Now it's `dict[str, set[str]]`, and attempt to use `frozenset` will return ``` TypeError: argument 'attributes': 'frozenset' object cannot be converted to 'PySet' ``` but IMO using `frozenset` is a good...

While using nh3 library, we came across a use case, where HTML content is expected for a field, but we need to remove the content that can cause XSS attack....

upstream

Like if i have normal output removes it, but how can i make like it <asfjiasfj></asfjiasfj>?

Sorry if I misunderstand something, but for me looks like `clean_text` function doesn't clean html or text, but do escape for html. I understand that it's just mirroring API of...

Discussions are not enabled so opening it here, sorry 'bout it. With the recent [deprecation of bleach](https://github.com/mozilla/bleach/issues/698) (mostly on grounds of html5lib being unmaintained), unless someone has the time to...

Either I am misunderstanding what `clean_content_tags` does or it is not working correctly. I cannot get the `clean_content_tags` attribute to work on anything other than the two tags `` and...

Hi, When I use `nh3.clean()`, line endings `\r\n` are converted to `\n`. This behavior can cause issues for applications that rely on `\r\n` as their newline format, for example in...

Hi, I think I've found a memory leak. This example reproduces it: ```python import requests import nh3 html = requests.get("https://search.brave.com/").text for _ in range(30_000): nh3.clean(html) ``` If you run that...