Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Unsafe prefix for blob links #3889

@maxaon

Description

@maxaon

Links to blob images marked with prefix "unsafe:"

During linking of ngImg image link is set via $compile.$set which checks normalized value via regular expression:

  if (normalizedVal !== '') {
    if ((key === 'href' && !normalizedVal.match(aHrefSanitizationWhitelist)) ||
        (key === 'src' && !normalizedVal.match(imgSrcSanitizationWhitelist))) {
      this[key] = value = 'unsafe:' + normalizedVal;
    }
  }

where imgSrcSanitizationWhitelist equals to /^\s*(https?|ftp|file):|data:image\//
This RegExp doesn't allow blob link, which created using URL.createObjectURL
Created link using Chrome: blob:http%3A//127.0.0.1%3A8080/38272f8d-7435-4cfd-bb64-93c8ca8d92c4
Created by Firefox: blob:53210633-5257-4767-b862-34c3cc50013c

Related issue #2570 Affected versions till v1.2.0-rc.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions