greenbone / gvmd

Greenbone Vulnerability Manager - The database backend for the Greenbone Community Edition
GNU Affero General Public License v3.0
290 stars 157 forks source link

Fix: Add DATA_TYPE back to GET_AGGREGATES/AGGREGATE (backport #2236) #2307

Closed mergify[bot] closed 1 month ago

mergify[bot] commented 1 month ago

What

Add element DATA_TYPE back to element AGGREGATE in GMP GET_AGGREGATES.

Why

Element was accidentally removed.

References

This element was removed in d73fba850fbbb26927f6ab6070a01e2738dcbbd5 (SVN r23003) in 2015. In omp.c line 16809 was removed from omp_xml_handle_end_element but was missing from the addition buffer_aggregate_xml at line 11416.

It looks like this was an accident because the element is still in the GMP doc, and the removal would likely have been mentioned in the commit log. Let me know if this was intentional though, I'll adjust the doc instead.

Note that the original had a type NULL check before the g_string_append_printf, but type is already checked at the top of handle_get_aggregates.

Quick test

Before PR:

$ o m m '<get_aggregates type="cve" group_column="severity"/>'
<get_aggregates_response status_text="OK" status="200">
  <aggregate>
    <group_column>severity</group_column>

$ o m m '<get_aggregates type="result" group_column="description" mode="word_counts" max_groups="10"/>'
<get_aggregates_response status_text="OK" status="200">
  <aggregate>
    <group_column>description</group_column>

After PR, element data_type is back:


$ o m m '<get_aggregates type="cve" group_column="severity"/>'
<get_aggregates_response status_text="OK" status="200">
  <aggregate>
    <data_type>cve</data_type>
    <group_column>severity</group_column>

$ o m m '<get_aggregates type="result" group_column="description" mode="word_counts" max_groups="10"/>'
<get_aggregates_response status_text="OK" status="200">
  <aggregate>
    <data_type>result</data_type>
    <group_column>description</group_column>
```<hr>This is an automatic backport of pull request #2236 done by [Mergify](https://mergify.com).
github-actions[bot] commented 1 month ago

Conventional Commits Report

Type Number
Bug Fixes 1

:rocket: Conventional commits found.