it-dgc-verificaC19-android icon indicating copy to clipboard operation
it-dgc-verificaC19-android copied to clipboard

The app after a scan report an invalid Green Pass even if the certificate is not expired or tampered

Open gdotta opened this issue 3 years ago • 14 comments

Describe the bug

On some Green passes the scan of the QR code with "Verifica C19" report an invalid certificate. Scanning the same QR code with another device report a valid certificate and the certificate is confirmed valid by manual verification.

Expected behaviour

The app "VerificaC19" is expected to not report an invalid reading when the Greep Pass certificate is still in its validity period.

Steps to reproduce the issue

  1. Get a valid pass that can not be read by the app but it's valid for sure
  2. Open the app
  3. Scan the QR code
  4. Verify that the reading is not valid

Technical details

Device: Google Pixel 4a OS Version: Android 11 App Version: 1.1.0

Possible Fix

The issue was resolved by just deleting the android app data from System Settings. An alternative is to uninstall and install again the app from the Play Store. The issue could be related to a migration bug from an older version to a new version of the app.

Additional context

The app was installed on the device before the update of the 9 of August then updated through the Play Store.

gdotta avatar Aug 19 '21 09:08 gdotta

Same behavior found in two different devices, one running Android version 9 and one with Android 10. As the user above I was prompted to update the app to version 1.1.0; after the update every DGC certificate/ Green Pass I scanned was considered invalid on both devices (schermata rossa), as the user above I was able to fix by cleaning the stored "data" used by the application manually. I've also noticed it didn't update the "dati e regole"/ certificates before resetting the app, it may be related to the issue.

Valeri0p avatar Aug 19 '21 20:08 Valeri0p

I've also noticed it didn't update the "dati e regole"/ certificates before resetting the app, it may be related to the issue.

If this will be identified as the issue then would be a nice enhancement to add a manual button to clean/force the update by the user

gdotta avatar Aug 20 '21 07:08 gdotta

I agree, or maybe it might be safer to wipe the archives after every major update or to force update them on the server-side if possible.

Valeri0p avatar Aug 20 '21 07:08 Valeri0p

Same bug showed on my android 10 device after upgrading to version 1.1.0 I installed the app through Google Play Store, but i do not remember the starting version. All QR scanned (tested with other devices) were listed as not valid: neither the valid ones nor the ones which aren't valid yet, but that will become valid in a few days (they should be checked as not valid yet and not only not valid). I solved the problem by unistalling and reinstalling the app.

LorenzoBrilli avatar Aug 20 '21 08:08 LorenzoBrilli

I can confirm the presence of the bug. My green pass is from the UK NHS that until recently wasn't correctly verify by the app. The latest update can verify correctly my green pass but only if the app has been clean installed in a new device... Unfortunately is not easy to ask the verifier to clean the system data cache so definitely we should have an update that automatically clean the cache data so that the new verification key got updated correctly.

dgrilli avatar Oct 10 '21 06:10 dgrilli

So to notice that since last week now the app installed on my phone doesn't work anymore despite no new version... Uninstall and reinstall doesn't work anymore

dgrilli avatar Oct 15 '21 13:10 dgrilli

Il problema da stamattina si è ripresentato. Android 11, Samsung S20+, applicazione disinstallata e reinstallata. Tutti i certificati risultano non validi

fransyk avatar Oct 22 '21 09:10 fransyk

Anche su altri dispositivi / telefoni, tutti invalidi Sia Android ma anche IOS Su IOS non scarica nemmeno i certificati, tutto ciò in produzione !!

lpomi avatar Oct 22 '21 10:10 lpomi

Appena provato e per quello che mi riguarda sta funzionando correnttamente..

Ho riaperto l'applicazione NHS (dopo parecchi giorni) e scaricato il pdf quindi ho scansionato quest'ultimo con verificac19 che era gia' installata sul mio telefono e che l'ultima volta dava il certificato invalido.

@Ipomi: @fransyk: puoi provare a scaricare il pdf e scansionare quello? inoltre puoi riportare la data di scadenza del certificato nel file pdf?

dgrilli avatar Oct 22 '21 12:10 dgrilli

VerificaC19 non scarica più da oggi correttamente i certificati. Se la eliminate e la reistallate dallo store vedete che non valida più Se l'avete istallata i giorni scorsi non si sta aggiornando, ma mantiene i vecchi codici / regole scaricate l'ultima volta (e quindi sembra a posto anche se non aggiornata)

lpomi avatar Oct 22 '21 12:10 lpomi

@lpomi Hai ragione, non avevo pensato di provare... quindi essenzialmente l'applicazione si aggiorna in background senza un vero proprio aggiornamento di versione?

Questo secondo me e' un ulteriore bug o per lo meno ci vorrebbe un codice versione che mostri le regole scaricate... inoltre qualcuno puo' indicare quali dati vengono effettivamente aggiornati in background e da dove?

dgrilli avatar Oct 22 '21 12:10 dgrilli

E' che è in produzione, su tutte le device !! NON si stanno aggiornando e tutti quelli che la vogliano istallare adesso non ci riescono più, non possono fare i controlli con relative sanzioni e obblighi. E' da stamani; io ho visto alle 9 circa La notizia è anche già su alcuni giornali on-line da qualche ora

lpomi avatar Oct 22 '21 12:10 lpomi

@lpomi Se può essere di aiuto noi abbiamo risolto il problema dalla funzione SDK.

Classe VerifierRepositoryImpl all'interno della funzione fetchCertificate, abbiamo aggiunto un semplice contatore esterno ed un controllo su HTTP_BAD_GATEWAY.

        var chek = 0.toLong()
        private suspend fun fetchCertificate(resumeToken: Long) {
        val tokenFormatted = if (resumeToken == -1L) "" else resumeToken.toString()
        val response = apiService.getCertUpdate(tokenFormatted)
        if (response.isSuccessful && response.code() == HttpURLConnection.HTTP_OK) {
        val headers = response.headers()
        val responseKid = headers[HEADER_KID]
        val newResumeToken = headers[HEADER_RESUME_TOKEN]
        val responseStr = response.body()?.stringSuspending(dispatcherProvider) ?: return

        if (validCertList.contains(responseKid)) {
            Log.i(VerifierRepositoryImpl::class.java.simpleName, "Cert KID verified")
            val key = Key(kid = responseKid!!, key = keyStoreCryptor.encrypt(responseStr)!!)
            db.keyDao().insert(key)

            preferences.resumeToken = resumeToken

            newResumeToken?.let {
                var newToken = it.toLong()
                chek = it.toLong()
                fetchCertificate(newToken)
            }
        }
    }else if (response.code() == HttpURLConnection.HTTP_BAD_GATEWAY) {
        chek = chek+1.toLong();
        var newToken = chek;

        fetchCertificate(newToken)
    }
}

Ovviamente è una forzatura ma almeno permette di scaricare la maggiorn parte dei certificati.

VincenzoCanfora avatar Oct 22 '21 13:10 VincenzoCanfora

Anche se tutto tace, sembra abbiamo risolto. Verifica19 con aggiornamento delle regole dopo le 17 di oggi hanno ripresto a validare correttamente (con aggiornamento oggi ma prima delle 17 non validano nessun certificato)

lpomi avatar Oct 22 '21 15:10 lpomi

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 22 '23 13:03 stale[bot]