why is this toDataURL line a security error?

前端 未结 1 433
梦谈多话
梦谈多话 2021-01-15 18:48

If an image from another site, is loaded to a page, and then written to canvas as a partial ingredient in a composite, using:

context.drawImage(image, 0, 0,          


        
1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-15 19:13

    As per the spec, information leakage can occur if scripts from one origin can access information (e.g. read pixels) from images on another origin. The worry is that a malicious app could deduce information that it otherwise wouldn't have access to by loading in an image from another domain/origin (easily done with images) and reading the pixel content. XHR has protections built in place to prevent XD leakage. Images do not.

    0 讨论(0)
提交回复
热议问题