Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for Engine attribute missing #26

Closed
mlenkeit opened this issue Jul 6, 2021 · 3 comments
Closed

Check for Engine attribute missing #26

mlenkeit opened this issue Jul 6, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@mlenkeit
Copy link
Collaborator

mlenkeit commented Jul 6, 2021

Describe the bug

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

rulesItems.forEach { rule in
if !checkSchemeVersion(for: rule, qrCodeSchemeVersion: qrCodeSchemeVersion) {
result.append(ValidationResult(rule: rule, result: .open, validationErrors: [CertLogicError.openState]))
} else {
do {
let jsonlogic = try JsonLogic(rule.logic.description)
let results: Any = try jsonlogic.applyRule(to: getJSONStringForValidation(external: external, payload: payload))
if results is Bool {
if results as! Bool {
result.append(ValidationResult(rule: rule, result: .passed, validationErrors: nil))
} else {
result.append(ValidationResult(rule: rule, result: .fail, validationErrors: nil))
}
}
} catch {
result.append(ValidationResult(rule: rule, result: .open, validationErrors: [error]))
}
}
}
return result

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

n/a

@SchulzeStTSI
Copy link
Collaborator

@mlenkeit @alexchornyi please check #33

@alexchornyi
Copy link
Contributor

@SchulzeStTSI I approved your PR please merge
@mlenkeit please review and close If all ok

@mlenkeit
Copy link
Collaborator Author

We're still waiting for the PR to be merged...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants