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

Consider new vt refs in SQL data model. #553

Closed
wants to merge 16 commits into from

Conversation

janowagner
Copy link
Member

@janowagner janowagner commented May 22, 2019

Note: A sequence of smaller PRs established this functionality, so this PR is void
and was therefore closed without merge.

Essentially the columns "bid", "xrefs" and "cve" are removed from table "nvts".
These fields contained comma-separated lists of references where xref
hat a addtional colon-separation to define a type.

A new table "vt_refs" will store all these references with one reference per entry.
This removes the internal syntax of comma/colon-separation and the respective parsing.

Subsequently many places are changed because actually the access to the
references is now simpler. Even some some helper tables can be removed.

"bid" and "xref" are relatively easy to resolve. But for "cve" many internal logic
algorithms need adjustments.

The changes are not applied for the sqlite3 case, only for PostgreSQL.

Required:
greenbone/gvm-libs#232

@janowagner janowagner requested a review from a team May 22, 2019 17:45
@janowagner janowagner added the work in progress This pull request should not be merged yet, more commits are expected label May 22, 2019
janowagner added 16 commits May 23, 2019 18:41
This prepare to use the table for storing references
in a dedicated table rather than in the VTs.
This always removes all refs for the vt first to ensure
a remove vt is indeed removed.
This routine is a bit slow and there might be options to improve
performance.
The respective fields will not be filled in the table "nvts"
anymore.
The list of CVEs referring to a NVT can now be
retrieved via the new vt_refs table.

Essentially these commands are equivalent:

gvmd=> select ref_id from vt_refs where vt_oid = '1.3.6.1.4.1.25623.1.0.808066' and type = 'cve';
    ref_id
---------------
 CVE-2015-3152

gvmd=> select cve_name from nvt_cves where oid = '1.3.6.1.4.1.25623.1.0.808066';
   cve_name
---------------
 CVE-2015-3152
A recent commit was going to far for now.
Several functionalities still require the cve
in its old location. Eventually this commit
can finally be reverted for a clean
situation.
This table is not used anymore because the table vt_refs
is now used in all places.
These two fields are not used anywhere anymore. The table
vt_refs is used now to store and access bid and xref references.
It is not used anymore since recent commit.
Since two columns were removed, the count for the following
ones need to be decreased by 2.
This dramatically speeds up the loading of the nvt cache
by at least a factor of 1000.
@janowagner janowagner force-pushed the new_xrefs_data_model branch from 40df2cd to f5ad18c Compare May 23, 2019 18:54
@janowagner janowagner closed this Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work in progress This pull request should not be merged yet, more commits are expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant