-
Notifications
You must be signed in to change notification settings - Fork 32
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
CVEs alerts inventory for Vulnerability Detector: partial scan type #1428
CVEs alerts inventory for Vulnerability Detector: partial scan type #1428
Conversation
Add retry decorator to create_simulated_agent of vulnerability_detector module to allow two attempts when the simulated agent is added to the system Add ALERT_LOGS_PATH to the initialization module of the wazuh_testing.tools package #1425
30fd32f
to
1639efa
Compare
for _ in range(VULN_DETECTOR_GLOBAL_TIMEOUT): | ||
try: | ||
make_query(CVE_DB_PATH, [query_string]) | ||
return | ||
except sqlite3.OperationalError: | ||
sleep(1) | ||
raise sqlite3.OperationalError |
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.
for _ in range(VULN_DETECTOR_GLOBAL_TIMEOUT): | |
try: | |
make_query(CVE_DB_PATH, [query_string]) | |
return | |
except sqlite3.OperationalError: | |
sleep(1) | |
raise sqlite3.OperationalError | |
for _ in range(VULN_DETECTOR_GLOBAL_TIMEOUT): | |
try: | |
make_query(CVE_DB_PATH, [query_string]) | |
break | |
except sqlite3.OperationalError: | |
sleep(1) | |
else: | |
raise sqlite3.OperationalError |
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.
Done in: 1d7710d
Args: | ||
timestamp (int): The new timestamp value to set. | ||
""" |
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.
Raises
field is missing
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.
Done in: 1d7710d
parameters = [{ | ||
'BUSTER_FEED_PATH': buster_oval_feed_path, | ||
'DEBIAN_JSON_FEED_PATH': debian_json_feed_path, | ||
'NVD_JSON_FEED_PATH': nvd_json_feed_path | ||
}] | ||
metadata = [{ | ||
'BUSTER_FEED_PATH': buster_oval_feed_path, | ||
'DEBIAN_JSON_FEED_PATH': debian_json_feed_path, | ||
'NVD_JSON_FEED_PATH': nvd_json_feed_path | ||
}] |
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.
parameters = [{ | |
'BUSTER_FEED_PATH': buster_oval_feed_path, | |
'DEBIAN_JSON_FEED_PATH': debian_json_feed_path, | |
'NVD_JSON_FEED_PATH': nvd_json_feed_path | |
}] | |
metadata = [{ | |
'BUSTER_FEED_PATH': buster_oval_feed_path, | |
'DEBIAN_JSON_FEED_PATH': debian_json_feed_path, | |
'NVD_JSON_FEED_PATH': nvd_json_feed_path | |
}] | |
parameters = [{ | |
'BUSTER_FEED_PATH': buster_oval_feed_path, | |
'DEBIAN_JSON_FEED_PATH': debian_json_feed_path, | |
'NVD_JSON_FEED_PATH': nvd_json_feed_path | |
}] | |
metadata = parameters |
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.
Done in: d0b7c1d
"""Add a dummy agent, inserts in its database (sys_programs table) a test package, | ||
and configures its database to appear to be up to date (sync_info table).""" |
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.
Change this docstring to look like the one in test_partial_scan_type
. A single line explaining what it does, another one if you need further details and the args.
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.
Done in: d0b7c1d
test_feed_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'data', 'feeds') | ||
configurations_path = os.path.join(test_data_path, 'wazuh_partial_scan_type.yaml') | ||
wazuh_log_monitor = FileMonitor(LOG_FILE_PATH) | ||
wazuh_alert_monitor = FileMonitor(ALERT_LOGS_PATH) |
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.
I prefer to monitor the alerts.json
file rather than the plain log. The reason for this change is based on the fact that we can extract the alert using the FileMonitor
and check the fields in it by import it with the json
module.
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.
Done in: d0b7c1d
Fix docstring in add_simulated_agent fixture #1425
Description
This PR adds a test to verify if the
PARTIAL_SCAN
type of vulnerability detector works correctly as part of #1261.Test results
Manager
Tested on CentOS 8 (local)
Tested on CentOS 7 (Jenkins)
Documentation
Tests
pycodestyle --max-line-length=120 --show-source --show-pep8 file.py
.provision_documentation.sh
generate the docs without errors.