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

Migrate test_cpe_indexing documentation to qa-docs #2407

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

fedepacher
Copy link
Contributor

Related issue
#2328

Description

As part of epic #1796, this PR adds the missing documentation and migrates the current documentation to the new format used by qa-docs.

The schema used is the one defined in issue #1694

Generated documentation

test_cpe_indexing.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "Wazuh is able to detect vulnerabilities in the applications installed in agents using the Vulnerability Detector module. This software audit is performed through the integration of vulnerability feeds indexed by Redhat, Canonical, Debian, Amazon Linux and NVD Database.",
    "tier": 1,
    "modules": [
        "vulnerability_detector"
    ],
    "components": [
        "manager"
    ],
    "daemons": [
        "wazuh-modulesd",
        "wazuh-db",
        "wazuh-analysisd"
    ],
    "os_platform": [
        "linux"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/vulnerability-detection/index.html",
        "https://wazuh.com/blog/using-wazuh-for-windows-vulnerability-detection/",
        "https://documentation.wazuh.com/current/user-manual/capabilities/vulnerability-detection/cpe-helper.html"
    ],
    "tags": [
        "settings",
        "vulnerability",
        "vulnerability_detector"
    ],
    "name": "test_cpe_indexing.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_vulnerability_detector/test_windows/test_cpe_indexing.py",
    "tests": [
        {
            "description": "Check if inserted vulnerable packages are reported by the vulnerability detector. To do this, an auxiliary dictionary is generated in order to translate the gathered program names, (emulated by an entry list), into the standard format used by the NVD, which is called CPE. This allows the vulnerability detector to scan the NVD looking for vulnerabilities of these applications. So, is inserted a vulnerability in the NVD_CVE table since this is needed for the vulnerability detector to generate the required log.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "configure_local_internal_options_module": {
                        "type": "fixture",
                        "brief": "Configure the local internal options file."
                    }
                },
                {
                    "restart_modulesd": {
                        "type": "fixture",
                        "brief": "Reset the logs file and start a new monitor."
                    }
                },
                {
                    "check_cve_db": {
                        "type": "fixture",
                        "brief": "Check if the CVE database exists and its tables are created."
                    }
                },
                {
                    "mock_system": {
                        "type": "fixture",
                        "brief": "It allows to insert a vulnerability in the NVD_CVE table."
                    }
                },
                {
                    "file_monitoring": {
                        "type": "fixture",
                        "brief": "Handle the monitoring of a specified file."
                    }
                }
            ],
            "assertions": [
                "Verify that the monitor gets the expected message."
            ],
            "input_description": [
                "Test cases are found in the test module. The `cpe_indexing.yaml` file provides the configuration of this module for this test. Feeds are got from custom_nvd_feed.json file. Vulnerabilities are got from custom_msu.json file."
            ],
            "expected_output": [
                "r'The CPE `o:microsoft:.*:(-|r2|.*):(.*)?:::::.*:` from the agent `.*` was indexed'"
            ],
            "name": "test_window_version_indexing",
            "inputs": [
                "cpe_index_configuration-WINDOWS_SERVER_2013",
                "cpe_index_configuration-WINDOWS_SERVER_2013_R2",
                "cpe_index_configuration-WINDOWS_XP",
                "cpe_index_configuration-WINDOWS_VISTA",
                "cpe_index_configuration-WINDOWS_7",
                "cpe_index_configuration-WINDOWS_8",
                "cpe_index_configuration-WINDOWS_8.1",
                "cpe_index_configuration-WINDOWS_10",
                "cpe_index_configuration-WINDOWS_SERVER_2008",
                "cpe_index_configuration-WINDOWS_SERVER_2008_R2",
                "cpe_index_configuration-WINDOWS_SERVER_2012",
                "cpe_index_configuration-WINDOWS_SERVER_2012_R2",
                "cpe_index_configuration-WINDOWS_SERVER_2016",
                "cpe_index_configuration-WINDOWS_SERVER_2019",
                "cpe_index_configuration-WINDOWS_SERVER_2013_I386",
                "cpe_index_configuration-WINDOWS_SERVER_2013_R2_I386",
                "cpe_index_configuration-WINDOWS_XP_I386",
                "cpe_index_configuration-WINDOWS_VISTA_I386",
                "cpe_index_configuration-WINDOWS_7_I386",
                "cpe_index_configuration-WINDOWS_8_I386",
                "cpe_index_configuration-WINDOWS_8.1_I386",
                "cpe_index_configuration-WINDOWS_10_I386",
                "cpe_index_configuration-WINDOWS_SERVER_2008_I386",
                "cpe_index_configuration-WINDOWS_SERVER_2008_R2_I386",
                "cpe_index_configuration-WINDOWS_SERVER_2012_I386",
                "cpe_index_configuration-WINDOWS_SERVER_2012_R2_I386",
                "cpe_index_configuration-WINDOWS_SERVER_2016_I386",
                "cpe_index_configuration-WINDOWS_SERVER_2019_I386"
            ]
        }
    ]
}

Tests

  • Python codebase satisfies PEP-8 style style guide. pycodestyle --max-line-length=120 --show-source --show-pep8 file.py.
  • The qa-docs tool does not raise any error.

@fedepacher fedepacher self-assigned this Dec 24, 2021
@fedepacher fedepacher changed the title doc: Add documentation to test_cpe_indexing of test_windows #2328 Migrate test_cpe_indexing documentation to qa-docs Dec 24, 2021
Copy link

@roronoasins roronoasins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@snaow snaow merged commit 69af898 into master Jan 7, 2022
@snaow snaow deleted the 2328-qa-docs-migrate-test-windows branch January 7, 2022 07:59
@snaow snaow mentioned this pull request Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants