revanced-patcher icon indicating copy to clipboard operation
revanced-patcher copied to clipboard

feat: duplicates scanning for fingerprints

Open ghost opened this issue 1 year ago • 1 comments

🐞 Issue

Currently fingerprints resolve to the first thing found that matches. This can be unsafe, for example if a fingerprint matches multiple places -> wrong stuff is getting patched -> app crashes at runtime.

❗ Solution

Patcher should have the ability to make sure fingerprints are unique and only find exactly one specific thing.

❓ Motivation

Make sure fingerprints find one thing and warn devs in case something is not unique anymore.

⚠ Additional context

Initial discussion because of fingerprints "safety": https://github.com/revanced/revanced-patches/pull/239


Performance + CLI

For performance reasons the duplicates checking should be disabled by default (when patching known to work versions).

The CLI should not scan for duplicates for patching supported versions. However when --experimental flag is enabled it could make use of duplicate checking.

ghost avatar Jul 26 '22 16:07 ghost

This behavior could also be applied to patches with no version constrain, since it's possible for newly released app targets to have multiple matches.

All existing apps with no version constraint have only a few patches and the extra time to patch will likely be under a few seconds. The performance penalty won't be noticable to the end user and it better guarantees patching is correct.

LisoUseInAIKyrios avatar Sep 18 '23 15:09 LisoUseInAIKyrios