This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1110 from corona-warn-app/RC/1.3.0
RC/1.3.0 to Master
- Loading branch information
Showing
68 changed files
with
1,636 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/playbook/BackgroundNoise.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package de.rki.coronawarnapp.http.playbook | ||
|
||
import de.rki.coronawarnapp.http.WebRequestBuilder | ||
import de.rki.coronawarnapp.service.submission.SubmissionConstants | ||
import de.rki.coronawarnapp.storage.LocalData | ||
import de.rki.coronawarnapp.worker.BackgroundConstants | ||
import de.rki.coronawarnapp.worker.BackgroundWorkScheduler | ||
import kotlin.random.Random | ||
|
||
class BackgroundNoise { | ||
companion object { | ||
@Volatile | ||
private var instance: BackgroundNoise? = null | ||
|
||
fun getInstance(): BackgroundNoise { | ||
return instance ?: synchronized(this) { | ||
instance ?: BackgroundNoise().also { | ||
instance = it | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun scheduleDummyPattern() { | ||
if (BackgroundConstants.NUMBER_OF_DAYS_TO_RUN_PLAYBOOK > 0) | ||
BackgroundWorkScheduler.scheduleBackgroundNoisePeriodicWork() | ||
} | ||
|
||
suspend fun foregroundScheduleCheck() { | ||
if (LocalData.isAllowedToSubmitDiagnosisKeys() == true) { | ||
val chance = Random.nextFloat() * 100 | ||
if (chance < SubmissionConstants.probabilityToExecutePlaybookWhenOpenApp) { | ||
PlaybookImpl(WebRequestBuilder.getInstance()) | ||
.dummy() | ||
} | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/playbook/Playbook.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.rki.coronawarnapp.http.playbook | ||
|
||
import KeyExportFormat | ||
import de.rki.coronawarnapp.service.submission.KeyType | ||
import de.rki.coronawarnapp.util.formatter.TestResult | ||
|
||
/** | ||
* The concept of Plausible Deniability aims to hide the existence of a positive test result by always using a defined “playbook pattern” of requests to the Verification Server and CWA Backend so it is impossible for an attacker to identify which communication was done. | ||
* The “playbook pattern” represents a well-defined communication pattern consisting of dummy requests and real requests. | ||
* To hide that a real request was done, the device does multiple of these requests over a longer period of time according to the previously defined communication pattern statistically similar to all apps so it is not possible to infer by observing the traffic if the requests under concern are real or the fake ones. | ||
*/ | ||
interface Playbook { | ||
|
||
suspend fun initialRegistration( | ||
key: String, | ||
keyType: KeyType | ||
): String /* registration token */ | ||
|
||
suspend fun testResult( | ||
registrationToken: String | ||
): TestResult | ||
|
||
suspend fun submission( | ||
registrationToken: String, | ||
keys: List<KeyExportFormat.TemporaryExposureKey> | ||
) | ||
|
||
suspend fun dummy() | ||
} |
Oops, something went wrong.