nodeca / pica

Resize image in browser with high quality and high speed
http://nodeca.github.io/pica/demo/
MIT License
3.76k stars 245 forks source link

Fingerprinting behaviour #229

Closed yuccai closed 2 years ago

yuccai commented 2 years ago

Hello,

Currently, when pica detects that fingerprinting protection is enabled, it throws an error. Could it be possible to only throw a warning instead of blocking whole process ?

yvele commented 2 years ago

Why is randomization so problematic for Pica? And is it possible to have a workaround? Such as a warning, a non strict mode or a degraded result?

Because we don't control the browser the user is using 🤔

This is the function that detects anti fingerprinting randomization:

https://github.com/nodeca/pica/blob/34e82a5ddd0519ac7eb118889ae4f36360618d98/lib/utils.js#L139-L162

When anti fingerprinting randomization is detected by Pica, an error is thrown:

https://github.com/nodeca/pica/blob/34e82a5ddd0519ac7eb118889ae4f36360618d98/index.js#L653-L658

More about anti fingerprinting:

puzrin commented 2 years ago

Here is nothing to fix. If FF fingerprint protection enabled, pica become completely unusable. And throws error as expected. It's programmer's responsibility to check for success of resize call, and decide what to do without resize.

We do the best of possible - provided descriptive error of failure.

capc0 commented 2 years ago

We experienced a possible false positive of the fingerprinting detection. It was reported by a user on iOS with WKWebView.

However I dont see how that could happen based on the code above when not using fingerprinting detection.