-
Notifications
You must be signed in to change notification settings - Fork 71
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
feat: adding sarif file extension validation support #217
base: main
Are you sure you want to change the base?
Conversation
return false, errors.New("error - schema isn't a string") | ||
} | ||
|
||
loadedSchema := gojsonschema.NewReferenceLoader(schemaURL.(string)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail in airgapped environments or corporate networks without a proxy. I think we need a separate error if it can't download the schema from the URL. The current error is error: error - schema isn't valid: https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json
which is confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great point.
What do you think if we add an additional function that will verify that the schema's hostname is resolvable and try to establish a TCP connection prior to loading it?
If it's not resolvable or the connection can't be established, we might return with an error that indicates that schema couldn't be loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think if we add an additional function that will verify that the schema's hostname is resolvable and try to establish a TCP connection prior to loading it? If it's not resolvable or the connection can't be established, we might return with an error that indicates that schema couldn't be loaded.
I like that approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arthurflame Looks good! Please take care of the golint-ci findings and resolve conflicts from the dependency changes in main
As discussed in this PR #183:
schema
is specifiedContent of .sarif files was taken from these samples.