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

Conversation

@AndroidMedaGalaxy
Copy link
Member

@AndroidMedaGalaxy AndroidMedaGalaxy commented Sep 8, 2020

Description

This PR implements the Stricter QR code validations

Earlier only the presence of GUID was checked, now the URL format will be checked as well

@AndroidMedaGalaxy AndroidMedaGalaxy requested a review from a team September 8, 2020 11:11
@harambasicluka harambasicluka added the maintainers Tag pull requests created by maintainers label Sep 8, 2020
chris-cwa
chris-cwa previously approved these changes Sep 9, 2020
Copy link
Contributor

@chris-cwa chris-cwa left a comment

Choose a reason for hiding this comment

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

I like it!

Copy link
Member

@mlenkeit mlenkeit left a comment

Choose a reason for hiding this comment

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

The regexp should check for https://localhost?GUID (with a valid GUID being 3D6D08-3567F3F2-4DCF-43A3-8737-4CD1F87D6FDA). Anything else should be rejected. Please add corresponding unit tests to cover scenarios such as

@AndroidMedaGalaxy
Copy link
Member Author

The regexp should check for https://localhost?GUID (with a valid GUID being 3D6D08-3567F3F2-4DCF-43A3-8737-4CD1F87D6FDA). Anything else should be rejected. Please add corresponding unit tests to cover scenarios such as

These tests have been added. Existing test cases were failing, they're amended as well

Copy link
Member

@d4rken d4rken left a comment

Choose a reason for hiding this comment

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

Please check whether all the scanresult validation could be made part of a neat little data class, i.e.

data class ScanResult(val rawResult: String) {
    val isValid by lazy {
        // do checks here.
    }
    val guid: String? by lazy {
        if(isValid) ... else null
    }
   companion object {
     // related const stuff  
    }
}

fun validateAndStoreTestGUID(rawResult: String) {
        val scanResult = ScanResult(rawResult)
        if (scanResult.isValid) {
            SubmissionService.storeTestGUID(scanResult.guid)
            _scanStatus.value = Event(ScanStatus.SUCCESS)
        } else {
            _scanStatus.value = Event(ScanStatus.INVALID)
        }
    }

mlenkeit
mlenkeit previously approved these changes Sep 10, 2020
Copy link
Member

@mlenkeit mlenkeit left a comment

Choose a reason for hiding this comment

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

LGTM from a requirement's perspective 👍 But I think it's worth having a fellow Engineer reviewing the code, too.

@AndroidMedaGalaxy
Copy link
Member Author

SubmissionService.storeTestGUID(scanResult.guid)

@d4rken Please check out the new logic. I have tried to make it easier and keep it simple at the same time.
let me know what you think.

@d4rken d4rken self-assigned this Sep 14, 2020
Copy link
Member

@d4rken d4rken left a comment

Choose a reason for hiding this comment

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

lgtm

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

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

84.4% 84.4% Coverage
0.0% 0.0% Duplication

@d4rken d4rken merged commit 0ab2b01 into dev Sep 14, 2020
@d4rken d4rken deleted the fix/qr-code-stricter-validation-EXPOSUREAPP-2570 branch September 14, 2020 15:29
@d4rken d4rken added this to the 1.4.0 milestone Oct 7, 2020
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.

6 participants