WeblateOrg / weblate

Audit required: Use of mark_safe detected BAN-B308
Security
Major
a month ago5 years old
Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
1731    @property
1732    def totp_svg(self):
1733        image = qrcode.make(self.totp_url, image_factory=qrcode.image.svg.SvgPathImage)
1734        return mark_safe(image.to_string(encoding="unicode"))  # noqa: S3081735
1736    def get_context_data(self, **kwargs):
1737        """Create context for rendering page."""
Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
 284                    name,
 285                    format_html(
 286                        'data-value="{}" tabindex="-1"',
 287                        mark_safe(  # noqa: S308 288                            value.encode("ascii", "xmlcharrefreplace").decode("ascii") 289                        ), 290                    ),
 291                    char,
 292                )
Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
 263            GROUP_TEMPLATE,
 264            [
 265                (
 266                    mark_safe('data-toggle="buttons"'),  # noqa: S308 267                    rtl_switch,
 268                )
 269            ],  # Only one group.
Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
 245                    gettext("Toggle text direction"),
 246                    rtl_name,
 247                    "rtl",
 248                    mark_safe('checked="checked"'),  # noqa: S308 249                    "RTL",
 250                ),
 251                (
Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
 212                    name,
 213                    format_html(
 214                        'data-value="{}"',
 215                        mark_safe(  # noqa: S308 216                            value.encode("ascii", "xmlcharrefreplace").decode("ascii") 217                        ), 218                    ),
 219                    char,
 220                )