Skip to content

HtmlAnchor.HRef is not html attribute encoded causing XSS issues. #230

@ToreOlavKristiansen

Description

@ToreOlavKristiansen

HtmlAnchor.RenderAttributes renders the HRef attribute by calling HtmlControl.PreProcessRelativeReferenceAttribute. This method renders the attribute without html attribute encoding and removes it from the Attributes collection. All the other attributes of HtmlAnchor are rendered with html attribute encoding making HRef the only attribute that is XSS unsafe.

This is quite a gotcha that should be addressed at least by improving the documentation.

internal void PreProcessRelativeReferenceAttribute(HtmlTextWriter writer,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions