Language: Python
Label: vulnerable
CWE: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

Code:
    def test_invalid_encoding_request(self):
        """Test request failure when invalid encoded file is provided."""

        with mock.patch("streamlit.components.v1.components.os.path.isdir"):
            declare_component("test", path=PATH)

        with mock.patch("streamlit.components.v1.components.open") as m:
            m.side_effect = UnicodeDecodeError(
                "utf-8", b"", 9, 11, "unexpected end of data"
            )
            response = self._request_component("components_test.test")

        self.assertEqual(404, response.code)
        self.assertEqual(
            b"components_test.test read error: 'utf-8' codec can't decode bytes in position 9-10: unexpected end of data",
            response.body,
        )