Dodge nasty HTML in data content more aggressively #269
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is somewhat scary stuff, but appears to all be working correctly. 🏴☠️
This PR does not guarantee thorough sanitization of content sourced from data files, but it does running into unexpected issues hopefully much less common of an occurrence.
Notable changes:
formatString
(akalanguage.$
) now HTML-escapes all string arguments provided.formatString
now returns its results wrapped in a nameless, attributeless tag, indicating that its results are "sanitized" and shouldn't be sanitized by later calls toformatString
.#sanitizeStringArg
and#wrapSanitized
do the heavy lifting).Template
now accepts HTML in{type: 'string'}
arguments. These are automatically stringified (.toString()
) before being exposed to the description'scontent(slots)
function (orgenerate(slots)
). This is so that these can still accept "strings" returned fromformatString
(which are wrapped in tags now).formatString
, the new utilitylanguage.sanitize()
will escape HTML in non-formatted strings (and return the results wrapped in a tag).generateCoverGrid
at the moment, but there are potentially more cases that would benefit.