fingerprintjs / fingerprintjs-android

Swiss army knife for identifying and fingerprinting Android devices. MIT license, no restrictions on usage in production.
https://fingerprint.com/github/
MIT License
572 stars 83 forks source link

Fix getSignalsMatching when passed V1 as version + minor refactor #86

Closed Sergey-Makarov closed 1 year ago

Sergey-Makarov commented 1 year ago

Problem: getSignalsMatching(V1, Stable/Optimal) returned a wrong list of signals, because this method did not take into account that when using V1 version, some signals should be treated as Stable even if their stability level is Optimal/Unique.

What is affected The problem did not affect our backward compatibility with older fingerprints, because the method Fingerprinter.getFingerprint(..) internally did not use getSignalsMatching for versions representing legacy fingerprint scheme (v1..v4) and already respected the rule described above.

Therefore, the only way to experience the problem was to use getSignalsMatching(V1, Stable/Optimal) directly, and I highly doubt that someone uses V1 for this purpose nowadays :) However, one could observe this bug when trying our demo app if the following steps were made:

  1. Change fingerprint version to V1
  2. Switch between optimal and unique stability levels

One could see that the fingerprint remains the same, even though the list of signals actually does change. After the fix, during the same steps the list of signals will remain the same as it should.