fix(security): zone data is suspectible to XSS #101
Merged
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.
Problem
If a record contains string data, it will be rendered as HTML, not escaped as expected. This means that zone data is susceptible to XSS attacks.
Example with
zonetransfer.me:The record in question:
xss 300 IN TXT "'><script>alert('Boo')</script>"Background
When Flask configures a Jinja environment, it provides a list of file types that should be "autoescaped". Since the templates used in this project end with
.j2, they are not escaped.Fix
Now by default for this project, all Flask templates will be rendered with the autoescape functionality.