Skip to content

fix(dropdown): possible XSS through select option text#2705

Merged
lubber-de merged 2 commits intofomantic:developfrom
lubber-de:selectXSS
Feb 19, 2023
Merged

fix(dropdown): possible XSS through select option text#2705
lubber-de merged 2 commits intofomantic:developfrom
lubber-de:selectXSS

Conversation

@lubber-de
Copy link
Copy Markdown
Member

@lubber-de lubber-de commented Feb 19, 2023

Description

This PR fixes a possible XSS through an entity encoded select option text when converted into a FUI dropdown.
Even if preserveHTML: false would prevent this, a select tag cannot contain html at all and if it contains entity encoded HTML instead, it should not be reconverted into html.

The PR also fixes recreating the dropdown menu twice when no values are selected in a multiple dropdown

Thanks to @brian-codes for reporting

Testcase

  • Select the obvious evil dropdown entry

Broken

The alert message appears upon selection
https://jsfiddle.net/lubber/f5to49ew/3/

Fixed

All fine
https://jsfiddle.net/lubber/f5to49ew/5/

Closes

#2692 (reply in thread)
#2817

@lubber-de lubber-de added type/bug Any issue which is a bug or PR which fixes a bug lang/javascript Anything involving JavaScript state/awaiting-reviews Pull requests which are waiting for reviews type/security Anything related to security labels Feb 19, 2023
@lubber-de lubber-de added this to the 2.9.3 milestone Feb 19, 2023
@lubber-de
Copy link
Copy Markdown
Member Author

@all-contributors please add @brian-codes for security

@allcontributors
Copy link
Copy Markdown
Contributor

@lubber-de

I've put up a pull request to add @brian-codes! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang/javascript Anything involving JavaScript type/bug Any issue which is a bug or PR which fixes a bug type/security Anything related to security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant