Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

WIP: plausible deniability #946

Merged
merged 32 commits into from
Aug 7, 2020
Merged

Conversation

Fabian-K
Copy link
Member

🏗

@harambasicluka harambasicluka added the maintainers Tag pull requests created by maintainers label Jul 29, 2020
Fabian-K and others added 19 commits July 30, 2020 15:47
- ensure request pattern for playbooks is always the same

VerificationService
- apply padding to ensure equal request size (header & body)

SecurityHelper
- extract hash256 to HashHelper. This simplifies tests that use only the hash function (and therefore don´t need to initialize SecurityHelper and its dependencies)
Signed-off-by: Kolya Opahle <k.opahle@sap.com>
- ignore exceptions for fake requests

SubmissionService
- add padding header to fake request for same header size

WebRequestBuilder
- include fake keys in upload (🏗)
SubmissionService & SubmitDiagnosisKeysTransaction
- inline playbook & backgroundNoise property to prevent issues during testing

DiagnosisKeyConstantsTest, SubmissionServiceTest, SubmitDiagnosisKeysTransactionTest & SubmissionViewModelTest
- adjusted to changes
Signed-off-by: Kolya Opahle <k.opahle@sap.com>
…rona-warn-app/cwa-app-android into feature/plausible-deniability

� Conflicts:
�	Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainActivity.kt
Signed-off-by: Kolya Opahle <k.opahle@sap.com>
Signed-off-by: Kolya Opahle <k.opahle@sap.com>
Signed-off-by: Kolya Opahle <k.opahle@sap.com>
Signed-off-by: Kolya Opahle <k.opahle@sap.com>
…ability

# Conflicts:
#	Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainActivity.kt
- ensure that fake requests are executed when real requests fail

SubmissionService & VerificationService
- adjust header name for padding

WebRequestBuilder
- add padding to dummy submission
PlaybookImpl
- include follow-up executions after every playbook
- logging

SubmissionViewModel.kt, SubmissionService.kt, SubmitDiagnosisKeysTransaction.kt, MainActivity.kt, BackgroundNoisePeriodicWorker.kt, DiagnosisTestResultRetrievalPeriodicWorker.kt
- propagate context for coroutine

VerificationService
- ensure body size of 1000
- adjust fake key generation

PlaybookImplTest.kt
- remove unused server.enqueue

SubmissionService.kt 6 SubmitDiagnosisKeysTransaction.kt
- remove commented out code
Signed-off-by: Kolya Opahle <k.opahle@sap.com>
- remove temporary comment
@Fabian-K Fabian-K marked this pull request as ready for review August 4, 2020 12:09
@Fabian-K Fabian-K requested a review from a team August 4, 2020 12:09
Signed-off-by: Kolya Opahle <k.opahle@sap.com>
@@ -244,11 +244,13 @@ dependencies {
// TESTING
testImplementation 'junit:junit:4.13'
testImplementation "android.arch.core:core-testing:1.1.1"
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.7'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still experimental and could cause issues. TBD

@Body request: RegistrationRequest
): TestResultResponse

@POST
suspend fun getTAN(
@Url url: String,
@Header("cwa-fake") fake: String,
@Header("cwa-header-padding") headerPadding: String?,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case where we do not have padding?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think currently you are right. The header can be omitted when the header of a request happens to be exactly as big as we need it.

@Fabian-K
Copy link
Member Author

Fabian-K commented Aug 5, 2020

Thank you for the review. Feedback is applied with 863b12d

jakobmoellerdev
jakobmoellerdev previously approved these changes Aug 6, 2020
- reduce request size from 1000 to 250 for the verification server
- include dummy registration token in fake request to fulfill verification on server side
- prepare for randomized count of submitted keys
- always include headers cwa-authorization & cwa-header-padding for submission server
@sonarcloud
Copy link

sonarcloud bot commented Aug 6, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 1 Code Smell

47.2% 47.2% Coverage
0.0% 0.0% Duplication

@jakobmoellerdev jakobmoellerdev merged commit f98ac2d into dev Aug 7, 2020
@jakobmoellerdev jakobmoellerdev deleted the feature/plausible-deniability branch August 7, 2020 12:31
jakobmoellerdev pushed a commit that referenced this pull request Aug 7, 2020
* Added requestPadding property to all VerficationService requests

* Added fake calls to the WebReqeustBuilder

* 🚧 initial draft to enable plausible deniability

* Switched from SubmissionConstants to KeyType enum everywhere

* basic playbook implementation with fake and real requests

* Playbook
- ensure request pattern for playbooks is always the same

VerificationService
- apply padding to ensure equal request size (header & body)

SecurityHelper
- extract hash256 to HashHelper. This simplifies tests that use only the hash function (and therefore don´t need to initialize SecurityHelper and its dependencies)

* Implemented random chance of dummy playbook execution on app open

Signed-off-by: Kolya Opahle <k.opahle@sap.com>

* Playbook
- ignore exceptions for fake requests

SubmissionService
- add padding header to fake request for same header size

WebRequestBuilder
- include fake keys in upload (🏗)

* DiagnosisKeyService: removed (low value & difficult to test)

SubmissionService & SubmitDiagnosisKeysTransaction
- inline playbook & backgroundNoise property to prevent issues during testing

DiagnosisKeyConstantsTest, SubmissionServiceTest, SubmitDiagnosisKeysTransactionTest & SubmissionViewModelTest
- adjusted to changes

* Dummy playbook will now be repeated and delayed randomly

Signed-off-by: Kolya Opahle <k.opahle@sap.com>

* Linting

Signed-off-by: Kolya Opahle <k.opahle@sap.com>

* Initial Code for background noise worker

Signed-off-by: Kolya Opahle <k.opahle@sap.com>

* First implementation of noise background worker

Signed-off-by: Kolya Opahle <k.opahle@sap.com>

* Linting

Signed-off-by: Kolya Opahle <k.opahle@sap.com>

* PlaybookImpl
- ensure that fake requests are executed when real requests fail

SubmissionService & VerificationService
- adjust header name for padding

WebRequestBuilder
- add padding to dummy submission

* BackgroundNoise is now trigger-only

PlaybookImpl
- include follow-up executions after every playbook
- logging

SubmissionViewModel.kt, SubmissionService.kt, SubmitDiagnosisKeysTransaction.kt, MainActivity.kt, BackgroundNoisePeriodicWorker.kt, DiagnosisTestResultRetrievalPeriodicWorker.kt
- propagate context for coroutine

VerificationService
- ensure body size of 1000

* WebRequestBuilder.kt
- adjust fake key generation

PlaybookImplTest.kt
- remove unused server.enqueue

SubmissionService.kt 6 SubmitDiagnosisKeysTransaction.kt
- remove commented out code

* revert temporary changes to SubmissionResultPositiveOtherWarningFragment.kt

* Background job scheduling implemented

Signed-off-by: Kolya Opahle <k.opahle@sap.com>

* - adjust fake key size
- remove temporary comment

* Moved build work calls to own file to fix linting

Signed-off-by: Kolya Opahle <k.opahle@sap.com>

* - initialize coroutine scope within the playbook, revert passing it from outside
- remove experimental test dependency for coroutines

* - use single endpoint per server for fake requests
- reduce request size from 1000 to 250 for the verification server
- include dummy registration token in fake request to fulfill verification on server side
- prepare for randomized count of submitted keys
- always include headers cwa-authorization & cwa-header-padding for submission server

* - simplify empty header using constant

Co-authored-by: Kolya Opahle <k.opahle@sap.com>
@Fabian42
Copy link

Fabian42 commented Sep 3, 2020

I'm interested: What does this change do? An emoji is not a very good description…

@vaubaehn
Copy link
Contributor

vaubaehn commented Sep 4, 2020

@Fabian42 : as far as I can interpret the code, a new function for data privacy is introduced. Randomly when opening the app, there is a fake TEK uploading to the server. It is to protect a COVID positive tested user, who uploads his keys to the server to warn the others, while his network traffic is under oberservation (e. g., by a hacker...) By this, he may deny (upon being confronted with 'his network behaviour') that he uploaded keys, because ALL CWA apps now uploading (fake) keys from time to time. So, network sniffing is not reliable anymore to identify positive tested users. (-> plausible deniability)

Dear devs, please correct me if I'm wrong.

@vaubaehn
Copy link
Contributor

vaubaehn commented Sep 4, 2020

@Fabian42 ... sorry, now realized that you most likely don't need any explanation about the code... Your original question had a different intention, I guess... ;)

@Fabian42
Copy link

Fabian42 commented Sep 4, 2020

No, that is actually exactly what I asked about. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
maintainers Tag pull requests created by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants