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_content_request(self):
        """Test request failure when invalid content (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 = OSError("Invalid content")
            response = self._request_component("components_test.test")

        self.assertEqual(404, response.code)
        self.assertEqual(
            b"components_test.test read error: Invalid content",
            response.body,
        )