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

Add: The table scap.affected_products is filled for the new JSON feed. #2318

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -20511,7 +20511,7 @@ init_cpe_match_nodes_iterator (iterator_t* iterator, const char *criteria)
" JOIN scap.cpe_nodes_match_criteria c"
" ON n.id = c.node_id"
" JOIN scap.cpe_match_strings r"
" ON c.match_criteria = r.match_criteria_id"
" ON c.match_criteria_id = r.match_criteria_id"
" WHERE criteria like '%s%%';",
quoted_criteria);
g_free (quoted_criteria);
Expand Down
26 changes: 26 additions & 0 deletions src/manage_sql_secinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -4043,6 +4043,27 @@
return 0;
}

/**
* @brief Update SCAP affected products.
*
* Assume that the databases are attached.
*/
static void
update_scap_affected_products ()

Check warning on line 4052 in src/manage_sql_secinfo.c

View check run for this annotation

Codecov / codecov/patch

src/manage_sql_secinfo.c#L4052

Added line #L4052 was not covered by tests
{
g_info ("Updating affected products");

Check warning on line 4054 in src/manage_sql_secinfo.c

View check run for this annotation

Codecov / codecov/patch

src/manage_sql_secinfo.c#L4054

Added line #L4054 was not covered by tests

sql ("INSERT INTO scap2.affected_products"

Check warning on line 4056 in src/manage_sql_secinfo.c

View check run for this annotation

Codecov / codecov/patch

src/manage_sql_secinfo.c#L4056

Added line #L4056 was not covered by tests
" SELECT DISTINCT scap2.cpe_match_nodes.cve_id, scap2.cpes.id"
" FROM scap2.cpe_match_nodes, scap2.cpe_nodes_match_criteria,"
" scap2.cpe_matches, scap2.cpes"
" WHERE scap2.cpe_match_nodes.id = scap2.cpe_nodes_match_criteria.node_id"
" AND scap2.cpe_nodes_match_criteria.vulnerable = 1"
" AND scap2.cpe_nodes_match_criteria.match_criteria_id ="
" scap2.cpe_matches.match_criteria_id"
" AND scap2.cpe_matches.cpe_name_id = scap2.cpes.cpe_name_id;");
}

/**
* @brief Insert a SCAP CPE match string from JSON.
*
Expand Down Expand Up @@ -5606,6 +5627,11 @@
return -1;
}

g_debug ("%s: update affected_products", __func__);
setproctitle ("Syncing SCAP: Updating affected products");

Check warning on line 5631 in src/manage_sql_secinfo.c

View check run for this annotation

Codecov / codecov/patch

src/manage_sql_secinfo.c#L5630-L5631

Added lines #L5630 - L5631 were not covered by tests

update_scap_affected_products ();

Check warning on line 5633 in src/manage_sql_secinfo.c

View check run for this annotation

Codecov / codecov/patch

src/manage_sql_secinfo.c#L5633

Added line #L5633 was not covered by tests

g_debug ("%s: updating user defined data", __func__);

g_debug ("%s: update epss", __func__);
Expand Down
Loading