-
Notifications
You must be signed in to change notification settings - Fork 1.8k
JS: Model JSON schema validation and 'ajv' #5301
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
Conversation
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.
Looks pretty good, I just have some minor comments.
Do we flag CVE-2020-8192 with the new query?
javascript/ql/src/semmle/javascript/security/dataflow/DeepObjectResourceExhaustion.qll
Outdated
Show resolved
Hide resolved
javascript/ql/src/semmle/javascript/security/dataflow/DeepObjectResourceExhaustion.qll
Outdated
Show resolved
Hide resolved
...pt/ql/src/semmle/javascript/security/dataflow/DeepObjectResourceExhaustionCustomizations.qll
Outdated
Show resolved
Hide resolved
...pt/ql/src/semmle/javascript/security/dataflow/DeepObjectResourceExhaustionCustomizations.qll
Outdated
Show resolved
Hide resolved
...pt/ql/src/semmle/javascript/security/dataflow/DeepObjectResourceExhaustionCustomizations.qll
Outdated
Show resolved
Hide resolved
...pt/ql/src/semmle/javascript/security/dataflow/DeepObjectResourceExhaustionCustomizations.qll
Outdated
Show resolved
Hide resolved
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
…ctResourceExhaustionCustomizations.qll Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
Thanks @erik-krogh! Addressed review comments. I also noticed I forgot to add the tests for the new query, so there's a new commit with tests as well.
Ah, forgot to mention this, we don't flag this yet. |
Adds a model of
ajv
along with some general concepts for JSON schema validation.It has the following impact on our security queries:
TaintedObject
label, preventing FPs from queries like prototype pollution and NoSQL injection.allErrors: true
is flagged as potential a denial-of-service attack. For this I introduced the somewhat generically-named query 'Resource exhaustion from deep object traversal'. It's only used forajv
at the moment, but I avoided usingajv
or JSON schema validation as part of its name, so it's easier to extend in the future.ajv
is treated as a source for ExceptionXss. This query has been rephrased to include errors in a more broad sense, which have not necessarily been through athrow/catch
.Evaluations (internal links):
getAType
fixed it.