Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Bring back upstream code for release APK check #190

Merged

Conversation

gilbsgilbs
Copy link

@gilbsgilbs gilbsgilbs commented May 1, 2022

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

Upstream code checks whether the current APK was signed with the release
key for various reasons:

  • in order to show/hide the "Updates" settings menu
  • in order to make the "Updates" settings menu searchable or not
  • in order to check/not check for updates at the application start

This behavior was removed in NewPipe SponsorBlock fork, but it probably
shouldn't have been:

  • the newer APK installation won't work if the locally installed APK
    wasn't signed with the same key
  • isReleaseApk function was still invoked in NewPipe SponsorBlock to
    allow searching "Updates" settings from settings menu. But as the
    fingerprint wasn't correct, the update settings would not be searchable
    which is a bug
  • this is a requirement for F-Droid inclusion as they sign their APKs
    with their own keys (so the updater wouldn't work) and they explicitly
    forbid auto-updaters by policy (see also f-droid #8)

This PR brings back all these checks (byte-by-byte with upstream to
make maintaining the fork easier). For this to work properly, it is
obviously needed to use NewPipe Sponsorblock's release key fingerprint
(instead of the upstream one). Therefore, this PR also updates it. It can be
retrieved using the following command:

  $ keytool -printcert -file CERT.RSA | grep SHA1

Or if you own the keystore, directly:

  $ keytool -v -list -keystore my-release-key.keystore -alias <alias_name> | grep SHA1

(setting the expected value for <alias_name>)

Before/After Screenshots/Screen Record

  • N/A

Fixes the following issue(s)

  • Required by f-droid #8 (I don't think there is any other blocker for F-Droid inclusion, so I let you decide if you want to close this issue or not)
  • Fixes a bug where the Check updates settings weren't searchable in this fork.

APK testing

Not relevant here as I obviously don't have enough money to spend to find a SHA-1 collision yet. Though I tested with a self-signed APK and I can attest that it does what's expected.

Due diligence

gilbsgilbs added 2 commits May 1, 2022 08:26
It can be retrived by running the following command:

  $ keytool -printcert -file CERT.RSA | grep 'SHA1'

The fingerprint was still set to the one from the official NewPipe app.
Upstream code checks whether the current APK was signed with the release
key for various reasons:
- in order to show/hide the "Updates" settings menu
- in order to make the "Updates" settings menu searchable or not
- in order to check/not check for updates at the application start

This behavior was removed in NewPipe SponsorBlock fork, but it probably
shouldn't have been:

- the newer APK installation won't work if the locally installed APK
  wasn't signed with the same key
- `isReleaseApk` function was still invoked in NewPipe SponsorBlock to
  allow searching "Updates" settings from settings menu. But as the
  fingerprint wasn't correct (see 25575ea), the update settings
  would not be searchable which is a bug
- this is a requirement for F-Droid inclusion as they sign their APKs
  with their own keys (so the updater wouldn't work) and they explicitly
  forbid auto-updaters by policy (see also
  polymorphicshade#8)
@polymorphicshade polymorphicshade merged commit 2f5fca6 into polymorphicshade:sponsorblock Jul 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants