Security: fix XSS and path traversal in uicore templatetags#1510
Open
Security: fix XSS and path traversal in uicore templatetags#1510
Conversation
…iantgrid_private#3832 - escapejs on user.username in JS string context (menu_bar_main.html) - html.escape() on title attribute in severity_icon filter (ui_utils.py) - Validate page_id with whitelist regex in page_help tag (ui_help.py)
db139c5 to
7974224
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes items from security review SACGF/variantgrid_private#3832.
Changes
menu_bar_main.html—{{ user.username|escapejs }}in JS string context; prevents XSS if a username ever contains a single quoteui_utils.pyseverity_icon—html.escape(title)for thetitleHTML attribute; prevents attribute breakoutui_help.pypage_help— validatespage_idagainst[\w\-]+before using it in a file path; prevents path traversalItems not fixed (already safe or out of scope)
tabs.htmlopen redirect —resolved_urlis only set whencontent.startswith('/')(seeui_tabs_builder.py:222), so external URLs are already rejectedadmin_link.htmlinfo disclosure — the tag already returns{}for non-superusers beforeis_adminis ever set; the warning is superuser-onlyhelp.html| safe— intentional; content is from static files or rendered template nodelists (developer-controlled), not user input<script>blocks — CSP backlog item, no immediate security impact