Skip to content

Commit 341de24

Browse files
committed
v1.2.0: Default configurations, whitelisting and blacklisting for :antipiracy scans, dependency updates and maintenance
1 parent f1d292f commit 341de24

File tree

17 files changed

+167
-51
lines changed

17 files changed

+167
-51
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ For stricter scenarios where higher fidelity and accuracy are required, you shou
123123

124124
```gradle
125125
dependencies {
126-
implementation 'com.github.kevlar-kt:antipiracy:1.1.1'
126+
implementation 'com.github.kevlar-kt:antipiracy:1.2.0'
127127
}
128128
```
129129

@@ -132,7 +132,7 @@ dependencies {
132132

133133
```gradle
134134
dependencies {
135-
implementation 'com.github.kevlar-kt:rooting:1.1.1'
135+
implementation 'com.github.kevlar-kt:rooting:1.2.0'
136136
}
137137
```
138138

@@ -142,7 +142,7 @@ dependencies {
142142

143143
```gradle
144144
dependencies {
145-
implementation 'com.github.kevlar-kt:integrity:1.1.1'
145+
implementation 'com.github.kevlar-kt:integrity:1.2.0'
146146
}
147147
```
148148

antipiracy/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates(
4343
"antipiracy",
4444

4545
// PUBLISH_VERSION
46-
"1.1.1",
46+
"1.2.0",
4747

4848
// PUBLISH_ARTIFACT_DESC
4949
"Kevlar Antipiracy",
@@ -61,8 +61,8 @@ apply from: rootProject.file("scripts/commons/library_config.gradle")
6161
* */
6262
android {
6363
defaultConfig {
64-
versionName "1.1.1-kevlar-antipiracy"
65-
versionCode 1
64+
versionName "1.2.0-kevlar-antipiracy"
65+
versionCode 2
6666
}
6767
namespace 'com.kevlar.antipiracy'
6868
}
@@ -81,7 +81,7 @@ dependencies {
8181
testImplementation "junit:junit:4.13.2"
8282
testImplementation "androidx.test:core:1.5.0"
8383
testImplementation "org.mockito:mockito-core:5.9.0"
84-
testImplementation "com.google.truth:truth:1.2.0"
84+
testImplementation "com.google.truth:truth:1.3.0"
8585
testImplementation "org.robolectric:robolectric:4.11.1"
8686
}
8787

assemble_all.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# Designed and developed by Kevlar Contributors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
#
17+
18+
# if this fails with a warning about java version incompatibility, add a parameter after ./gradlew to change the java home, to a version that works: -Dorg.gradle.java.home=/Library/Java/...
19+
20+
./gradlew antipiracy:assembleRelease --warning-mode all
21+
./gradlew rooting:assembleRelease --warning-mode all
22+
./gradlew integrity:assembleRelease --warning-mode all

assemble_and_publish_all.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# Designed and developed by Kevlar Contributors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
#
17+
18+
# if this fails with a warning about java version incompatibility, add a parameter after ./gradlew to change the java home, to a version that works: -Dorg.gradle.java.home=/Library/Java/...
19+
20+
./gradlew antipiracy:assembleRelease --warning-mode all && ./gradlew antipiracy:publishReleasePublicationToSonatypeRepository
21+
./gradlew rooting:assembleRelease --warning-mode all && ./gradlew rooting:publishReleasePublicationToSonatypeRepository
22+
./gradlew integrity:assembleRelease --warning-mode all && ./gradlew integrity:publishReleasePublicationToSonatypeRepository

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ buildscript {
1818
dependencies {
1919
classpath 'com.android.tools.build:gradle:8.2.1'
2020
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
21-
classpath "com.github.ben-manes:gradle-versions-plugin:0.50.0"
21+
classpath "com.github.ben-manes:gradle-versions-plugin:0.51.0"
2222
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.50'
2323
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
2424
}

docs/pages/modules/antipiracy/implementation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ A working example for the antipiracy module can be found in the github repositor
88

99
``` java
1010
dependencies {
11-
implementation "io.github.kevlar-kt:antipiracy:1.1.1"
11+
implementation "io.github.kevlar-kt:antipiracy:1.2.0"
1212
}
1313
```
1414

1515
??? gradle "Kotlin DSL"
1616

1717
``` kotlin
1818
dependencies {
19-
implementation("io.github.kevlar-kt:antipiracy:1.1.1")
19+
implementation("io.github.kevlar-kt:antipiracy:1.2.0")
2020
}
2121
```
2222

@@ -26,7 +26,7 @@ A working example for the antipiracy module can be found in the github repositor
2626
<dependency>
2727
<groupId>io.github.kevlar-kt</groupId>
2828
<artifactId>antipiracy</artifactId>
29-
<version>1.1.1</version>
29+
<version>1.2.0</version>
3030
<type>pom</type>
3131
</dependency>
3232
```

docs/pages/modules/antipiracy/reference.md

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ withContext(externalDispatcher) {
4040

4141
You can find all the details about what software is regarded as pirate in the [database](database.md) page.
4242

43+
## Reference
44+
Here is a list of all the flags and their specification:
4345

4446
### Pirate Apps
4547
The `pirate()` function tells kevlar to scan the application list, and match it against the local dataset for pirate applications.

docs/pages/modules/integrity/implementation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ the `:showcase` module.
2525

2626
``` java
2727
dependencies {
28-
implementation "io.github.kevlar-kt:integrity:1.1.1"
28+
implementation "io.github.kevlar-kt:integrity:1.2.0"
2929
}
3030
```
3131

3232
??? gradle "Kotlin DSL"
3333

3434
``` kotlin
3535
dependencies {
36-
implementation("io.github.kevlar-kt:integrity:1.1.1")
36+
implementation("io.github.kevlar-kt:integrity:1.2.0")
3737
}
3838
```
3939

@@ -43,7 +43,7 @@ the `:showcase` module.
4343
<dependency>
4444
<groupId>io.github.kevlar-kt</groupId>
4545
<artifactId>integrity</artifactId>
46-
<version>1.1.1</version>
46+
<version>1.2.0</version>
4747
<type>pom</type>
4848
</dependency>
4949
```

docs/pages/modules/rooting/implementation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ A working example for the rooting module can be found in the github repository u
88

99
``` java
1010
dependencies {
11-
implementation "io.github.kevlar-kt:rooting:1.1.1"
11+
implementation "io.github.kevlar-kt:rooting:1.2.0"
1212
}
1313
```
1414

1515
??? gradle "Kotlin DSL"
1616

1717
``` kotlin
1818
dependencies {
19-
implementation("io.github.kevlar-kt:rooting:1.1.1")
19+
implementation("io.github.kevlar-kt:rooting:1.2.0")
2020
}
2121
```
2222

@@ -26,7 +26,7 @@ A working example for the rooting module can be found in the github repository u
2626
<dependency>
2727
<groupId>io.github.kevlar-kt</groupId>
2828
<artifactId>rooting</artifactId>
29-
<version>1.1.1</version>
29+
<version>1.2.0</version>
3030
<type>pom</type>
3131
</dependency>
3232
```

docs/pages/modules/rooting/reference.md

+74-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Reference
22

3+
## Configurations
4+
35
The complete rooting configuration is as follows.
46

57
```kotlin title="Complete Rooting settings"
@@ -23,20 +25,87 @@ private val rooting = KevlarRooting {
2325
}
2426
```
2527

26-
2728
!!! warning
2829
Bear in mind, this kind of configuration is exhaustive and should be used just in a few cases where you *really* need to detect all of those conditions.
29-
Only including what your application's security environment requires is a key step in properly configuring the library.
30+
Only including what your application's security environment requires is a key step in properly configuring the library and having an efficient detection mechanism.
31+
32+
33+
You can also use the pre-configured scan settings if your configuration is common:
34+
35+
```kotlin title="Automatic settings"
36+
private val antipiracy = KevlarRooting.Defaults.Standard()
37+
```
38+
39+
The defaults configurations are:
40+
41+
- `KevlarRooting.Defaults.Standard`: Complete scan, no explicit root access request:
42+
- Targets: `root()`, `magisk()`;
43+
- Status: `emulator()`, `testKeys()` and standard `selinux()`.
44+
- `KevlarRooting.Defaults.JustRooting`: Only targets `root()` and `magisk()`, no explicit root access request;
45+
- `KevlarRooting.Defaults.JustRootingExplicit`: Only targets `root()` and `magisk()`, with explicit root access request;
46+
- `KevlarRooting.Defaults.JustEmulator`: Only `emulator()` and `testKeys()`;
47+
- `KevlarRooting.Defaults.Empty`: No scan;
48+
3049

50+
## Attestation types
3151

32-
Unlike other Kevlar modules, here you can actually require two different types of attestation: you have `attestateTargets` and `attestateRooting`.
52+
Unlike other Kevlar modules, here you can actually request two different types of attestation: you have `attestateTargets` and `attestateRooting`.
3353
Once you require the attestation through any of those two methods, any discrepancies between your expected configuration (w.r.t. the invoked attestation type) and the actual device status will be reported back to you.
3454

3555
```kotlin
3656
withContext(externalDispatcher) {
37-
val targetAttestation = rooting.attestateTargets(context)
38-
val statusAttestation = rooting.attestateStatus()
57+
val targetAttestation: TargetRootingAttestation = rooting.attestateTargets(context)
58+
val statusAttestation: StatusRootingAttestation = rooting.attestateStatus()
59+
}
60+
```
61+
62+
This is done because the checks are completely independent, and so they can be run independently (basing on your needs), or together and in parallel.
63+
64+
They return their own attestation, each containing the security environment discrepancies it was instructed to scan for. (e.g. root access will be included in `TargetRootingAttestation`, while emulator will be in `StatusRootingAttestation`; granted they have been included in the kevlar configuration and they appear in the runtime systems)
65+
66+
??? example "Asynchronous scans"
67+
```kotlin
68+
withContext(externalDispatcher) {
69+
val targetAttestation = rooting.attestateTargets(context)
70+
}
71+
72+
withContext(externalDispatcher) {
73+
val statusAttestation = rooting.attestateStatus()
74+
}
75+
```
76+
77+
78+
## Reference
79+
Here is a list of all the flags and their specification:
80+
81+
⚠️ Work In Progress, you can find the code responsible for executing the system checks [here](https://github.com/kevlar-kt/kevlar/blob/master/rooting/src/main/kotlin/com/kevlar/rooting/attestator/TargetsAttestator.kt)
82+
83+
### Targets
84+
85+
All of the following flags constitute the targets configuration, which can be requested through `rooting.attestateTargets(context)`, returning a `TargetRootingAttestation`, which can be either `Clear`, `Blank`, `Failed`. In the latter, you have access to the list of targets that you specified in your configuration and that have actually been detected on the host system.
86+
87+
#### Root Access
88+
89+
Root access checks are enabled through the following flag:
90+
91+
```kotlin title="Complete Rooting settings" hl_lines="3"
92+
private val rooting = KevlarRooting {
93+
targets {
94+
root()
95+
}
3996
}
4097
```
4198

99+
This will run a series of checks to determine whether the `su` binary is present on the host system, without calling `su` directly (as that would imply that your application actively asks for root access as a form of detection, which is a very aggressive technique)
100+
101+
If you need to do so, you can enable this additional check by telling kevlar it is allowed to invoke the `su` binary directly, via `allowExplicitRootCheck()`.
42102

103+
```kotlin title="Complete Rooting settings" hl_lines="6"
104+
private val rooting = KevlarRooting {
105+
targets {
106+
root()
107+
}
108+
109+
allowExplicitRootCheck()
110+
}
111+
```

docs/pages/overview/dependencies_integration.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ repositories {
2626

2727
``` java
2828
dependencies {
29-
implementation "io.github.kevlar-kt:antipiracy:1.1.1"
29+
implementation "io.github.kevlar-kt:antipiracy:1.2.0"
3030
}
3131
```
3232

3333
??? gradle "Kotlin DSL"
3434

3535
``` kotlin
3636
dependencies {
37-
implementation("io.github.kevlar-kt:antipiracy:1.1.1")
37+
implementation("io.github.kevlar-kt:antipiracy:1.2.0")
3838
}
3939
```
4040

@@ -44,7 +44,7 @@ repositories {
4444
<dependency>
4545
<groupId>io.github.kevlar-kt</groupId>
4646
<artifactId>antipiracy</artifactId>
47-
<version>1.1.1</version>
47+
<version>1.2.0</version>
4848
<type>pom</type>
4949
</dependency>
5050
```
@@ -55,15 +55,15 @@ repositories {
5555

5656
``` java
5757
dependencies {
58-
implementation "io.github.kevlar-kt:rooting:1.1.1"
58+
implementation "io.github.kevlar-kt:rooting:1.2.0"
5959
}
6060
```
6161

6262
??? gradle "Kotlin DSL"
6363

6464
``` kotlin
6565
dependencies {
66-
implementation("io.github.kevlar-kt:rooting:1.1.1")
66+
implementation("io.github.kevlar-kt:rooting:1.2.0")
6767
}
6868
```
6969

@@ -73,7 +73,7 @@ repositories {
7373
<dependency>
7474
<groupId>io.github.kevlar-kt</groupId>
7575
<artifactId>rooting</artifactId>
76-
<version>1.1.1</version>
76+
<version>1.2.0</version>
7777
<type>pom</type>
7878
</dependency>
7979
```
@@ -85,15 +85,15 @@ repositories {
8585

8686
``` java
8787
dependencies {
88-
implementation "io.github.kevlar-kt:integrity:1.1.1"
88+
implementation "io.github.kevlar-kt:integrity:1.2.0"
8989
}
9090
```
9191

9292
??? gradle "Kotlin DSL"
9393

9494
``` kotlin
9595
dependencies {
96-
implementation("io.github.kevlar-kt:integrity:1.1.1")
96+
implementation("io.github.kevlar-kt:integrity:1.2.0")
9797
}
9898
```
9999

@@ -103,7 +103,7 @@ repositories {
103103
<dependency>
104104
<groupId>io.github.kevlar-kt</groupId>
105105
<artifactId>integrity</artifactId>
106-
<version>1.1.1</version>
106+
<version>1.2.0</version>
107107
<type>pom</type>
108108
</dependency>
109109
```

0 commit comments

Comments
 (0)