Skip to content

Error on sanitizing resource url #26782

@armaserg

Description

@armaserg

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ X] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

Error is throwing when I'm trying to sanitize unsafe resource url (for iframe src)

Expected behavior

unsafe resource url should be sanitized to safe string

Minimal reproduction of the problem with instructions

this.sanitizer.sanitize(SecurityContext.RESOURCE_URL, 'data:text/html,<script>alert(1)</script>') throws error
https://stackblitz.com/edit/angular-9zjuc7

What is the motivation / use case for changing the behavior?

URL provided by user should be used as src for iframe

Environment


Angular version: 7.0.1

 

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