Skip to content

Commit f481462

Browse files
committed
feat: Add signature and build provenance verification
1 parent 1fd8471 commit f481462

File tree

8 files changed

+424
-192
lines changed

8 files changed

+424
-192
lines changed

build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2-
31
plugins {
42
alias(libs.plugins.kotlin)
53
alias(libs.plugins.shadow)
@@ -53,6 +51,7 @@ tasks {
5351
minimize {
5452
exclude(dependency("org.bouncycastle:.*"))
5553
exclude(dependency("app.revanced:patcher"))
54+
exclude(dependency("commons-logging:commons-logging"))
5655
}
5756
}
5857

docs/1_usage.md

Lines changed: 75 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Learn how to use ReVanced CLI.
44
The following examples will show you how to perform basic operations.
55
You can list patches, patch an app, uninstall, and install an app.
66

7+
> [!NOTE]
8+
> For demonstrative purposes, `-b` is used to
9+
> bypass patches signature and build provenance verification for some commands.
10+
711
## 🚀 Show all commands
812

913
```bash
@@ -13,54 +17,55 @@ java -jar revanced-cli.jar -h
1317
## 📃 List patches
1418

1519
```bash
16-
java -jar revanced-cli.jar list-patches --with-packages --with-versions --with-options patches.rvp
20+
java -jar revanced-cli.jar list-patches --packages --versions --options -bp patches.rvp
1721
```
1822

1923
## 💉 Patch an app
2024

21-
To patch an app using the default list of patches, use the `patch` command:
25+
To patch an app using the default list of patches, use the `patch` command.
2226

2327
```bash
24-
java -jar revanced-cli.jar patch -p patches.rvp input.apk
28+
java -jar revanced-cli.jar patch -bp patches.rvp input.apk
2529
```
2630

2731
You can also use multiple RVP files:
2832

2933
```bash
30-
java -jar revanced-cli.jar patch -p patches.rvp -p another-patches.rvp input.apk
34+
java -jar revanced-cli.jar patch -bp patches.rvp -bp another-patches.rvp input.apk
3135
```
3236

33-
To change the default set of enabled or disabled patches, use the option `-e` or `-d` to enable or disable specific patches.
37+
To change the default set of enabled or disabled patches, use the option `-e` or `-d` to enable or
38+
disable specific patches.
3439
You can use the `list-patches` command to see which patches are enabled by default.
3540

3641
To only enable specific patches, you can use the option `--exclusive` combined with `-e`.
3742
Remember that the options `-e` and `-d` match the patch's name exactly. Here is an example:
3843

3944
```bash
40-
java -jar revanced-cli.jar patch -p patches.rvp --exclusive -e "Patch name" -e "Another patch name" input.apk
45+
java -jar revanced-cli.jar patch -bp patches.rvp --exclusive -e "Patch name" -e "Another patch name" input.apk
4146
```
4247

4348
You can also use the options `--ei` or `--di` to enable or disable patches by their index.
44-
This is useful, if two patches happen to have the same name, or if typing the names is too cumbersome.
49+
This is useful, if two patches happen to have the same name, or if typing the names is too
50+
cumbersome.
4551
To know the indices of patches, use the command `list-patches`:
4652

4753
```bash
48-
java -jar revanced-cli.jar list-patches patches.rvp
54+
java -jar revanced-cli.jar list-patches -bp patches.rvp
4955
```
5056

5157
Then you can use the indices to enable or disable patches:
5258

5359
```bash
54-
java -jar revanced-cli.jar patch -p patches.rvp --ei 123 --di 456 input.apk
60+
java -jar revanced-cli.jar patch -bp patches.rvp --ei 123 --di 456 input.apk
5561
```
5662

5763
You can combine the option `-e`, `-d`, `--ei`, `--di` and `--exclusive`. Here is an example:
5864

5965
```bash
60-
java -jar revanced-cli.jar patch -p patches.rvp --exclusive -e "Patch name" --ei 123 input.apk
66+
java -jar revanced-cli.jar patch -bp patches.rvp --exclusive -e "Patch name" --ei 123 input.apk
6167
```
6268

63-
6469
> [!TIP]
6570
> You can use the option `-i` to automatically install the patched app after patching.
6671
> Make sure ADB is working:
@@ -72,38 +77,40 @@ java -jar revanced-cli.jar patch -p patches.rvp --exclusive -e "Patch name" --ei
7277
7378
> [!TIP]
7479
> You can use the option `--mount` to mount the patched app on top of the un-patched app.
75-
> Make sure you have root permissions and the same app you are patching and mounting over is installed on your device:
80+
> Make sure you have root permissions and the same app you are patching and mounting over is
81+
> installed on your device:
7682
>
7783
> ```bash
7884
> adb shell su -c exit
7985
> adb install input.apk
8086
> ```
8187
82-
Patches can have options you can set using the option `-O` alongside the option to include the patch by name or index.
83-
To know the options of a patch, use the option `--with-options` when listing patches:
88+
Patches can have options you can set using the option `-O` alongside the option to include the patch
89+
by name or index.
90+
To know the options of a patch, use the option `--options` when listing patches:
8491
8592
```bash
86-
java -jar revanced-cli.jar list-patches --with-options patches.rvp
93+
java -jar revanced-cli.jar list-patches --options -bp patches.rvp
8794
```
8895
8996
Each patch can have multiple options. You can set them using the option `-O`.
9097
For example, to set the options for the patch with the name `Patch name`
9198
with the key `key1` and `key2` to `value1` and `value2` respectively, use the following command:
9299

93100
```bash
94-
java -jar revanced-cli.jar patch -p patches.rvp -e "Patch name" -Okey1=value1 -Okey2=value2 input.apk
101+
java -jar revanced-cli.jar patch -bp patches.rvp -e "Patch name" -Okey1=value1 -Okey2=value2 input.apk
95102
```
96103

97104
If you want to set the option value to `null`, you can omit the value:
98105

99106
```bash
100-
java -jar revanced-cli.jar patch -p patches.rvp -i "Patch name" -Okey1 input.apk
107+
java -jar revanced-cli.jar patch -bp patches.rvp -i "Patch name" -Okey1 input.apk
101108
```
102109

103110
> [!WARNING]
104111
> Option values are usually typed. If you set a value with the wrong type, the patch can fail.
105-
> The value types can be seen when listing patches with the option `--with-options`.
106-
>
112+
> The value types can be seen when listing patches with the option `--options`.
113+
>
107114
> Example option values:
108115
>
109116
> - String: `string`
@@ -121,27 +128,30 @@ java -jar revanced-cli.jar patch -p patches.rvp -i "Patch name" -Okey1 input.apk
121128
>
122129
> Quotes and commas escaped in strings (`\"`, `\'`, `\,`) are parsed as part of the string.
123130
> List items are recursively parsed, so you can escape values in lists:
124-
>
131+
>
125132
> - Escaped integer as a string: `[\'123\']`
126133
> - Escaped boolean as a string: `[\'true\']`
127134
> - Escaped list as a string: `[\'[item1,item2]\']`
128135
> - Escaped null value as a string: `[\'null\']`
129-
> - List with an integer, an integer as a string and a string with a comma, and an escaped list: [`123,\'123\',str\,ing`,`\'[]\'`]
130-
>
136+
> - List with an integer, an integer as a string and a string with a comma, and an escaped list: [
137+
`123,\'123\',str\,ing`,`\'[]\'`]
138+
>
131139
> Example command with an escaped integer as a string:
132-
>
140+
>
133141
> ```bash
134-
> java -jar revanced-cli.jar -p patches.rvp -e "Patch name" -OstringKey=\'1\' input.apk
142+
> java -jar revanced-cli.jar -bp patches.rvp -e "Patch name" -OstringKey=\'1\' input.apk
135143
> ```
136-
## 📦 Install an app manually
144+
145+
## 📦 Install an app manually
137146
138147
```bash
139148
java -jar revanced-cli.jar utility install -a input.apk
140149
```
141150
142151
> [!TIP]
143152
> You can use the option `--mount` to mount the patched app on top of the un-patched app.
144-
> Make sure you have root permissions and the same app you are patching and mounting over is installed on your device:
153+
> Make sure you have root permissions and the same app you are patching and mounting over is
154+
> installed on your device:
145155
>
146156
> ```bash
147157
> adb shell su -c exit
@@ -164,8 +174,46 @@ java -jar revanced-cli.jar utility uninstall --package-name <package-name> --unm
164174

165175
> [!TIP]
166176
> By default, the app is installed or uninstalled to the first connected device.
167-
> You can append one or more devices by their serial to install or uninstall an app on your selected choice of devices:
177+
> You can append one or more devices by their serial to install or uninstall an app on your selected
178+
> choice of devices:
168179
>
169180
> ```bash
170181
> java -jar revanced-cli.jar utility uninstall --package-name <package-name> [<device-serial> ...]
171182
> ```
183+
184+
## 🔐 Signature and build provenance verification
185+
186+
To increase confidence and security that the patches you are applying are from a trusted source
187+
and have not been tampered with, artifacts such as the patches files
188+
are signed with PGP by the respective author
189+
and their provenance attested by the platform in which they are built.
190+
191+
ReVanced CLI currently supports build provenance verification for these platforms:
192+
193+
- GitHub
194+
195+
By default, ReVanced CLI requires additional inputs to verify the signature and provenance,
196+
but to bypass these verifications, you can use the option `--bypass-verification` or `-b`
197+
for each input of patches.
198+
199+
```bash
200+
java -jar revanced-cli.jar patch -bp patches.rvp input.apk
201+
```
202+
203+
To verify the signature and provenance, you need to provide the following options
204+
for each input of patches:
205+
206+
- `--public-key-ring` or `-k`: Path to the PGP public key ring
207+
containing the public key of the author who signed the patches file
208+
- `--signature` or `-s`: Path to the PGP signature file
209+
- `--attestation` or `-a`: Path to the build provenance attestation file
210+
- Additional verification options for the respective platform which produced the patches file:
211+
- GitHub:
212+
- `--repository` or `-r`: GitHub repository in the format 'owner/repo'
213+
214+
For example, to verify the signature and provenance of a patches file from GitHub
215+
when using the `list-patches` command, use the following command:
216+
217+
```bash
218+
java -jar revanced-cli.jar list-patches -p patches.rvp -k public-key-ring.gpg -s patches.rvp.asc -a patches.rvp.sigstore.json -r owner/repo
219+
```

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[versions]
2-
bcpg-jdk18on = "1.83"
2+
bouncy-castle = "1.83"
33
shadow = "9.3.1"
44
kotlin = "2.3.10"
55
kotlinx = "1.10.2"
66
picocli = "4.7.7"
77
revanced-patcher = "22.0.0"
8-
revanced-library = "4.0.0"
8+
revanced-library = "4.0.1"
99
sigstore = "2.0.0"
1010

1111
[libraries]
12-
bcpg-jdk18on = { module = "org.bouncycastle:bcpg-jdk18on", version.ref = "bcpg-jdk18on" }
12+
bcpg-jdk18on = { module = "org.bouncycastle:bcpg-jdk18on", version.ref = "bouncy-castle" }
1313
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
1414
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx" }
1515
picocli = { module = "info.picocli:picocli", version.ref = "picocli" }

0 commit comments

Comments
 (0)