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

Check for `Engine` attribute missing

mlenkeit opened this issue · 2 comments

Describe the bug

There is currently no check for the value of the Engine attribute of a rule:

return if (rules.isNotEmpty()) {
val validationResults = mutableListOf<ValidationResult>()
val dataJsonNode = prepareData(externalParameter, payload)
val hcertVersion = hcertVersionString.toVersion()
rules.forEach { rule ->
val ruleVersion = rule.version.toVersion()
val res = when {
hcertVersion == null || ruleVersion == null || hcertVersion.first != ruleVersion.first -> Result.OPEN
hcertVersion.isGreaterOrEqualThan(ruleVersion) &&
jsonLogicValidator.isDataValid(
rule.logic,
dataJsonNode
) -> Result.PASSED
else -> Result.FAIL
}
val cur: String = affectedFieldsDataRetriever.getAffectedFieldsData(
rule,
dataJsonNode,
certificateType
)
validationResults.add(
ValidationResult(
rule,
res,
cur,
null
)
)
}
validationResults
} else {
emptyList()
}

Expected behaviour

If a rule has the attribute Engine with a value other than CERTLOGIC, the rule is not evaluated but reported as open.

Steps to reproduce the issue

see code

Technical details

n/a

Possible Fix

add if statement

Additional context

related to eu-digital-green-certificates/dgc-certlogic-ios#26

LGTM!