Add OVAL parser for Ubuntu - #179
Merged
Merged
Conversation
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
Collaborator
Author
|
So the good news is, it's working for all Ubuntu OVAL files, I have few ideas which could greatly improve the |
…formance Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
sbs2001
force-pushed
the
ubuntu_oval_parser
branch
from
May 16, 2020 11:21
2914d49 to
f4405db
Compare
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
Collaborator
Author
|
Update After some tweaks , the same test case takes 5 seconds to complete, that's a massive performance gain. |
haikoschol
requested changes
May 18, 2020
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
…n oval_parser.py's getElementById method, also improve OvalExtractor's get_data method by checking for mathing_tests earlier Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
haikoschol
approved these changes
May 19, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODOs :
How is this implemented ?
Oval files basically contain the following elements : OvalObjects, OvalStates , OvalTests, OvalDefinitions, OvalVariables .
What the parser does, is take in the OVAL document(xml file), get all the definitions. Then iterate over each definition, while doing so it does the following for every definition.
0.Every definition has enclosed within a vulnerability id and the vulnerability description, we collect these.
1.Collect all the OvalTests which are referred to , within the OvalDefinition's body
2.This OvalTest has a OvalObject and OvalState nested within.
3.From (2) go take the OvalObject, this has generally a OvalVariable nested within (or it may directly has a single package name enclosed within )
4.Iterate over the children of the OvalVariable element, each child encloses a package name within we collect this.
5.From (2) go take the OvalState element, this encloses a version range,, which denotes vulnerable versions we also collect this.
6.Repeat this until we cover all the definitions.
I really suggest to take a look at
vulnerabilities/tests/test_data/ubuntu_oval._data.xmlto get a quick idea of how a OVAL document is structured.High level overview
This is a repaste from chat, which provides a gist of the parser's intended implementation:
The following is a link to interactive google colab notebook https://colab.research.google.com/drive/1-NVbGwF80bYxzDYLXk5A4yvn0L-Qdgpe?usp=sharing for the OVAL parser.
Fixes #145