-
Notifications
You must be signed in to change notification settings - Fork 24
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
Schema validation seems to ignore formats #474
Comments
Turns out that the Schema Compiler from the validation library we use has a flag to check the formats. PR #475 turns this flag on. Without the PR:
With the PR:
I'm not totally sure what the overall consequences of always turning on this flag are but I think we should go with it. |
This seem not to be resolved for the following file:
|
Saved as
|
@s-l-teichmann Thanks for adding the output. To be precise: I would expect that the file also fails the Go schema validation. |
Checked out
Run
So the |
As this essentially call https://go.dev/play/p/VPCRVKC9olw
Which results in:
So the |
From here are more than one way to proceed:
Side note: Using |
BTW: Even Node and Java think this correct:
If i have tracked it correctly the validator service gets its idea of a valid URI from here: https://github.com/ajv-validator/ajv-formats/blob/4dd65447575b35d0187c6b125383366969e6267e/src/formats.ts#L116 |
Well, I did a quick read through the JSON Validation Specification. The Resource Identifiers section which includes the format Also: If you look at node: They do percent encoding (and that is the correct way). The issue is that the JSON value should be percent encoded but it is not. |
So the function |
The problematic part is obviously the '®'. This character is captured by the last PR #517 emulates the behavior of the validator service.
@tschmidtb51 you may discuss this with maintainers of https://github.com/santhosh-tekuri/jsonschema I'm not convinced that the behavior of the validator service is right ... anyway with the PR
|
We believe it should be changed upstream and we will split the issue up and summarize. |
It looks like the current version (3.0.0-beta1; but it might have existed in previous version), does not evaluated the format contraints. This was discovered when checking https://github.com/cisagov/CSAF/blob/971b6976d1ce52a710025aef920dba72d3a0675e/csaf_files/OT/white/2023/icsa-23-159-02.json#L269 resulted in a different amoung of errors while using the
csaf_validator
with thecsaf_validator-service
preset ofmandatory
(0) vsbasic
(1).We need to find out, why the
uri
wasn't checked for the format.The text was updated successfully, but these errors were encountered: