Zum Inhalt springen

Cross-site scripting (ARCH319)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key dotnet.security.xss · Severity error · Category security · CWE CWE-79

Rendering user-controlled content without encoding lets an attacker inject script (XSS). Let Razor encode by default.

@Html.Raw(Model.UserComment)
@Model.UserComment @* Razor HTML-encodes by default *@

Remove Html.Raw/HtmlString and rely on default encoding; if raw HTML is truly required, run the input through an HTML sanitizer first.