eu-digital-green-certificates / dgc-certlogic-android

This repository contains the source code of the EU Digital COVID Certificate Certlogic for Android.
Apache License 2.0
6 stars 34 forks source link

Recovery Rules validation for Switzerland #60

Closed pucherd closed 2 years ago

pucherd commented 2 years ago

Describe the bug

During the Recovery certificate validation we received an OPEN result for the following rules of Switzerland. The results are OPEN because the CertLogic throws an exception.

RR-CH-0001 com.fasterxml.jackson.databind.node.TextNode cannot be cast to com.fasterxml.jackson.databind.node.BooleanNode

RR-CH-0002 date argument of "plusTime" must be a string

RR-CH-0003 date argument of "plusTime" must be a string

Expected behaviour

Recovery rules for Switzerland should be validated as PASSED or FAIL.

Screenshot 2021-10-07 o 22 35 38
MykhailoNester commented 2 years ago

Issue inside of the rules.

RR-CH-0001 - has missing part of comparison as a result cannot be converted to Boolean RR-CH-0002/RR-CH-00023 - has external.validationClockAtStartOfDay instead of external.validationClock

App behaviour is correct, when rule validation failed because of the exception, rule will contain OPEN state. So user will see Limited Validity UI with rule OPEN state.

Correct example of DE rule:

{"if":[{"var":"payload.r.0"},{"not-before":[{"plusTime":[{"var":"external.validationClock"},0,"day"]},{"plusTime":[{"var":"payload.r.0.fr"},28,"day"]}]},true]}

And CH rules:

RR-CH-0001:
{"if":[{"var":"payload.r.0"},{"var":"payload.r.0.fr"},true]}

RR-CH-0002:
{"if":[{"var":"payload.r.0"},{"not-before":[{"plusTime":[{"var":"external.validationClockAtStartOfDay"},0,"day"]},{"plusTime":[{"var":"payload.r.0.fr"},10,"day"]}]},true]}

RR-CH-0003:
{"if":[{"var":"payload.r.0"},{"not-after":[{"plusTime":[{"var":"external.validationClockAtStartOfDay"},0,"day"]},{"plusTime":[{"var":"payload.r.0.fr"},179,"day"]}]},true]}
External:
{"validationClock":"2021-10-11T15:18:55.275Z","valueSets":{"country-2-codes":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],"covid-19-lab-result":["260415000","260373001"],"covid-19-lab-test-manufacturer-and-name":["1341","1065","1581","2031","1180","1216","2029","1215","1457","1456","1610","1333","2147","1574","1331","1739","1618","1736","1218","1190","1197","1501","1468","1225","1466","1465","1223","1343","1906","768","1747","1919","1363","1242","1484","1481","1360","2052","770","1357","1236","1599","1114","1199","2200","1870","1232","1495","1253","2067","1494","1097","1490","2183","1767","1800","1920","1489","1764","1884","1763","1365","1244","1243","1485","308","1769","1768","2078","1263","2074","2072","2108","2228","2107","1775","1654","2104","1257","1773","2103","1375","2101","1815","1934","2109","2243","1271","1392","1822","1304","1820","2116","1268","1267","1420","1266","1144","2079","2090","2012","2098","2010","1162","2130","1437","1833","2128","2006","1278","1957","1319","1296","1295","1173","1844","2139","2017","344","1324","345","1443","1201","1606","1967","1604","2350","2247","1286","2035","2013","1989","2242","1855","2317","1759","2241","1762","2290","1178"],"covid-19-lab-test-type":["LP6464-4","LP217198-3"],"disease-agent-targeted":["840539006"],"sct-vaccines-covid-19":["1119349007","1119305005","J07BX03"],"vaccines-covid-19-auth-holders":["ORG-100001699","ORG-100030215","ORG-100001417","ORG-100031184","ORG-100006270","ORG-100013793","ORG-100020693","ORG-100010771","ORG-100024420","ORG-100032020","Gamaleya-Research-Institute","Vector-Institute","Sinovac-Biotech","Bharat-Biotech","ORG-100001981","Fiocruz","ORG-100007893"],"vaccines-covid-19-names":["EU/1/20/1528","EU/1/20/1507","EU/1/21/1529","EU/1/20/1525","CVnCoV","Sputnik-V","Convidecia","EpiVacCorona","BBIBP-CorV","Inactivated-SARS-CoV-2-Vero-Cell","CoronaVac","Covaxin","Covishield","Covid-19-recombinant","R-COVI"]},"countryCode":"ch","exp":"2022-03-30T14:04:16Z","iat":"2021-10-01T14:04:16Z","issuerCountryCode":"de","kid":"lc9a97MWFhs=","region":""}
Payload:
"{"r":[{"du":"2022-04-08","co":"DE","ci":"01DE/84503/1633097056/DXSGWLWL40SU8ZFKIYIBK30A4#S","is":"Bundesministerium für Gesundheit","tg":"840539006","fr":"2021-10-10","df":"2021-11-07"}],"nam":{"fnt":"CERTIFICATE","fn":"Certificate","gnt":"RECOVERY","gn":"Recovery"},"dob":"1999-01-01","ver":"1.0.0"}"
pucherd commented 2 years ago

@MykhailoNester Thank you for the update ;)