Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/dominikmifkovic/detoxss is gone (deleted or private); Software Heritage has not archived the repo; no fork with the same repo name found; no cached copy. Use another version.
Whitelist configuration for controlled HTML sanitization.
A whitelist defines which tags, attributes, URL attributes, and URL schemes may
be preserved by DetoXSS.Sanitize.sanitizeWithWhitelist.
The whitelist is intended for allowing a small, explicit set of safe formatting features. It is not meant to allow arbitrary active HTML content. Some dangerous tags, attributes, and schemes are blocked regardless of the custom whitelist.
Whitelist configuration used by sanitizeWithWhitelist.
The configuration contains four lists:
tags are HTML tag names that may be preserved.attributes are attribute names that may be preserved.urlAttributes are attributes whose values should be treated as URLs.allowedSchemes are URL schemes accepted in URL-like attributes.The configuration is normalized when it is created through helper functions such
as fromLists, fromAll, or fromAllFull.
Default whitelist configuration.
It allows a small set of common formatting tags, link and image attributes, and
common URL schemes such as http:, https:, mailto:, and tel:.
Initial whitelist state.
The default configuration is loaded, but whitelist mode is disabled.
Use enable to activate whitelist-based sanitization.
Enable whitelist-based sanitization.
When enabled, sanitizeWithWhitelist may preserve allowed tags and attributes.
Disable whitelist-based sanitization.
When disabled, sanitizeWithWhitelist treats the whole input as text.
Check whether whitelist mode is enabled.
Replace the current whitelist configuration.
The configuration is normalized before being stored. Blocked tags, blocked attributes, and blocked schemes are removed during normalization.
Get allowed tags and attributes from the current state.
Create a whitelist from allowed tags and attributes.
The URL-like attributes default to href and src. The allowed URL schemes
default to defaultConfig.allowedSchemes.
fromLists [ "p", "strong", "a" ] [ "href", "title" ]Create a whitelist from allowed tags, attributes, and URL schemes.
The URL-like attributes default to href and src.
fromAll
[ "p", "a" ]
[ "href" ]
[ "http:", "https:" ]Create a full whitelist configuration.
This variant allows configuring allowed tags, allowed attributes, URL-like attributes, and allowed URL schemes explicitly.
fromAllFull
[ "p", "a", "img" ]
[ "href", "src", "alt" ]
[ "href", "src" ]
[ "http:", "https:" ]Check whether a tag is allowed by the current whitelist configuration.
Check whether an attribute is allowed by the current whitelist configuration.
Check whether an attribute should be treated as URL-like.
URL-like attributes are validated against the allowed URL schemes during sanitization.
Get allowed tags, attributes, and URL schemes from the current state.
Get the full whitelist configuration from the current state.
This includes allowed tags, allowed attributes, URL-like attributes, and allowed URL schemes.
Get allowed URL schemes.
If whitelist mode is disabled, the default scheme list is returned.
Replace the allowed attributes in the current whitelist state.
Replace the URL-like attributes in the current whitelist state.
URL-like attributes are checked against allowed URL schemes during sanitization.
Replace the allowed URL schemes in the current whitelist state.
Schemes are normalized to lowercase and always end with :.
Tags that are blocked regardless of whitelist configuration.
These tags are considered too risky to preserve in sanitized HTML.
Attributes that are blocked regardless of whitelist configuration.
This includes style-related and document-embedding attributes. Inline event
handler attributes such as onclick and onerror are also blocked by
isBlockedAttribute.
URL schemes that are blocked regardless of whitelist configuration.
Check whether a tag is hard-blocked.
Check whether an attribute is hard-blocked.
This returns True for inline event handlers such as onclick, for attributes
listed in blockedAttributes, and for namespace declarations starting with
xmlns.
Check whether a URL scheme is hard-blocked.
Runtime state of whitelist sanitization.
The
activefield controls whether whitelist mode is enabled. When whitelist mode is disabled, sanitization treats the whole input as text instead of preserving HTML tags.