patchman 4.0.22__tar.gz → 4.0.24__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {patchman-4.0.22 → patchman-4.0.24}/PKG-INFO +1 -1
- patchman-4.0.24/VERSION.txt +1 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/repos/yum.py +21 -3
- patchman-4.0.24/errata/tests/test_yum.py +52 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/models.py +22 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_find_updates.py +90 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/PKG-INFO +1 -1
- {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/SOURCES.txt +1 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/serializers.py +3 -1
- {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_serializers.py +11 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_utils.py +46 -1
- {patchman-4.0.22 → patchman-4.0.24}/reports/utils.py +74 -26
- {patchman-4.0.22 → patchman-4.0.24}/security/models.py +23 -21
- {patchman-4.0.22 → patchman-4.0.24}/security/tests/test_models.py +30 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/__init__.py +10 -9
- {patchman-4.0.22 → patchman-4.0.24}/util/tests/test_utils.py +22 -0
- patchman-4.0.22/VERSION.txt +0 -1
- {patchman-4.0.22 → patchman-4.0.24}/AUTHORS +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/COPYING +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/INSTALL.md +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/MANIFEST.in +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/README.md +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/migrations/0002_alter_machinearchitecture_options_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/serializers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/tests/test_api.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/tests/test_models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/utils.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/arch/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/migrations/0002_alter_domain_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/serializers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/tests/test_api.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/tests/test_models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/domains/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/managers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0002_alter_erratumreference_unique_together.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0003_delete_erratumreference_alter_erratum_references.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0004_rename_packages_erratum_fixed_packages.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0005_erratum_affected_packages_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0006_alter_erratum_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0007_alter_erratum_fixed_packages.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0008_add_cached_count_fields.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0009_backfill_cached_counts.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0010_synopsis_textfield.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/serializers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/signals.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/alma.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/arch.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/centos.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/debian.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/rocky.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/ubuntu.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/sources/repos/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/tables.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/tasks.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/templates/errata/erratum_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/templates/errata/erratum_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/tests/test_api.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/tests/test_integration.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/tests/test_models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/utils.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/errata/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/etc/patchman/apache.conf.example +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/etc/patchman/celery.conf +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/etc/patchman/local_settings.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/etc/systemd/system/patchman-celery-beat.service +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/etc/systemd/system/patchman-celery-worker@.service +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/forms.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/managers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0002_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0003_host_modules.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0004_remove_host_tags_host_tags.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0005_rename_os_host_osvariant.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0006_migrate_to_tz_aware.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0007_alter_host_tags.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0008_alter_host_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0009_host_errata.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0010_alter_hostrepo_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0011_host_bug_updates_count_host_errata_count_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0012_backfill_cached_counts.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0013_alter_hostrepo_unique_together_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0014_drop_legacy_tagging.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/serializers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/signals.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/tables.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/tasks.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/templates/hosts/host_delete.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/templates/hosts/host_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/templates/hosts/host_edit.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/templates/hosts/host_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/templatetags/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/templatetags/report_alert.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_api.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_managers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_migrations.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_utils.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/utils.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/hosts/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/managers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0002_auto_20240204_2214.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0003_alter_module_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0004_alter_module_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0005_alter_module_unique_together.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0006_alter_module_context_alter_module_name_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0007_alter_module_unique_together_module_unique_module.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/serializers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/tables.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/templates/modules/module_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/templates/modules/module_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/utils.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/modules/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/fixtures/os.json +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/fixtures/osgroup.json +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/forms.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/managers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0002_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0003_os_arch.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0003_osgroup_codename.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0004_alter_osgroup_unique_together.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0005_rename_osgroup_osrelease_rename_os_osvariant_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0006_osrelease_cpe_name_osvariant_codename.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0007_alter_osrelease_unique_together.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0008_alter_osrelease_options_alter_osvariant_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0009_osvariant_hosts_count.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0010_backfill_osvariant_counts.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0011_alter_osrelease_codename_alter_osrelease_cpe_name_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0012_alter_osrelease_unique_together_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/serializers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/signals.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/tables.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/os_landing.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osrelease_delete.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osrelease_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osrelease_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osvariant_delete.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osvariant_delete_multiple.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osvariant_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osvariant_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/tests/test_api.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/tests/test_models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/utils.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/managers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0002_auto_20250207_1319.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0002_delete_erratum_delete_erratumreference.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0003_auto_20250207_1746.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0004_alter_package_options_alter_packagecategory_options_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0005_alter_package_packagetype.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0006_alter_packageupdate_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0007_alter_package_epoch_alter_package_release_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0008_alter_package_unique_together_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/serializers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/tables.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_name_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_name_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_update_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/tests/test_api.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/tests/test_models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/tests/test_version_compare.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/tests/test_views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/utils.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/packages/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/celery.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/receivers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/settings.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/signals.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/sqlite3/base.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/static/css/base.css +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/static/js/expandable-text.js +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/static/js/sidebar.js +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman/wsgi.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/dependency_links.txt +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/requires.txt +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/top_level.txt +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0002_report_modules.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0003_remove_report_accessed.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0004_migrate_to_tz_aware.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0005_alter_report_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0006_alter_report_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tables.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tasks.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/templates/reports/report.txt +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/templates/reports/report_delete.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/templates/reports/report_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/templates/reports/report_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_api.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_edge_cases.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_integration.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_parsing.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_tasks.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/reports/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/forms.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/managers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0002_alter_repository_repotype.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0003_migrate_to_tz_aware.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0004_rename_file_checksum_mirror_package_checksum.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0005_rename_package_checksum_mirror_packages_checksum.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0006_mirror_errata_checksum_mirror_modules_checksum.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0007_alter_mirror_options_alter_mirrorpackage_options_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0008_mirror_packages_count.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0009_backfill_mirror_counts.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/arch.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/deb.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/gentoo.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/rpm.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/yast.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/yum.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/serializers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/signals.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/tables.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/tasks.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_delete.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_edit.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_with_repo_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/repo_delete.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/repo_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/repo_edit.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/repo_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/templatetags/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_api.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_managers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_mirror_sync.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_models.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/utils.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/repos/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/requirements.txt +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/sbin/patchman +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/sbin/patchman-manage +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/sbin/patchman-set-secret-key +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/scripts/clear-django-logs.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/scripts/create_graph.sh +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/scripts/rpm-install.sh +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/scripts/rpm-post-install.sh +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/admin.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/managers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0001_initial.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0002_alter_cve_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0003_alter_cve_description_alter_cwe_description.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0004_alter_cve_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0005_reference_cve_references.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0006_alter_cve_options_alter_cvss_unique_together.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0007_remove_cve_title.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0008_alter_cwe_options_alter_reference_options.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0009_alter_cvss_severity_alter_cvss_vector_string_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0010_fix_cvss_vector_string_length.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0011_alter_cvss_unique_together_and_more.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/migrations/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/serializers.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/tables.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/tasks.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/cve_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/cve_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/cwe_detail.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/cwe_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/reference_list.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/security_landing.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/tests/test_api.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/utils.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/security/views.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/setup.cfg +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/setup.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/apps.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/context_processors.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/filterspecs.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/logging.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/management/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/management/commands/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/management/commands/create_api_key.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/management/commands/list_api_keys.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/management/commands/revoke_api_key.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/tables.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/tasks.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/404.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/500.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/base.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/bulk_actions.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/dashboard.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/navbar.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/objectlist.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/registration/login.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/searchbar.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templates/table.html +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templatetags/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/templatetags/common.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/tests/__init__.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/tests/test_commands.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/urls.py +0 -0
- {patchman-4.0.22 → patchman-4.0.24}/util/views.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.0.24
|
|
@@ -25,8 +25,8 @@ from packages.models import Package
|
|
|
25
25
|
from packages.utils import get_or_create_package
|
|
26
26
|
from patchman.signals import pbar_start, pbar_update
|
|
27
27
|
from security.models import Reference
|
|
28
|
-
from util import extract, get_url, run_concurrently
|
|
29
|
-
from util.logging import clear_forked_pbar, error_message
|
|
28
|
+
from util import extract, get_url, run_concurrently, tz_aware_datetime
|
|
29
|
+
from util.logging import clear_forked_pbar, error_message, warning_message
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def extract_updateinfo(data, url, concurrent_processing=True, max_workers=25):
|
|
@@ -76,13 +76,31 @@ def process_updateinfo_erratum(update):
|
|
|
76
76
|
e_name = update.find('id').text
|
|
77
77
|
name, ref_type, urls = get_distro_data(e_name, e_type)
|
|
78
78
|
synopsis = update.find('title').text
|
|
79
|
-
issue_date = update
|
|
79
|
+
issue_date = get_updateinfo_issue_date(update)
|
|
80
|
+
if issue_date is None:
|
|
81
|
+
warning_message(text=f'No valid issued or updated date for {e_name}, skipping')
|
|
82
|
+
update.clear()
|
|
83
|
+
return
|
|
80
84
|
e, created = get_or_create_erratum(name, e_type, issue_date, synopsis)
|
|
81
85
|
add_updateinfo_erratum_references(e, update, ref_type, urls)
|
|
82
86
|
add_updateinfo_packages(e, update)
|
|
83
87
|
update.clear()
|
|
84
88
|
|
|
85
89
|
|
|
90
|
+
def get_updateinfo_issue_date(update):
|
|
91
|
+
""" Returns the issued date of an updateinfo erratum,
|
|
92
|
+
falling back to the updated date if there is no valid issued date
|
|
93
|
+
"""
|
|
94
|
+
for tag in ('issued', 'updated'):
|
|
95
|
+
element = update.find(tag)
|
|
96
|
+
date = element.attrib.get('date') if element is not None else None
|
|
97
|
+
if date:
|
|
98
|
+
try:
|
|
99
|
+
return tz_aware_datetime(date)
|
|
100
|
+
except ValueError:
|
|
101
|
+
continue
|
|
102
|
+
|
|
103
|
+
|
|
86
104
|
def get_distro_data(name, e_type):
|
|
87
105
|
""" Adds distro-specific names and references to an Erratum
|
|
88
106
|
"""
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Copyright 2026 Marcus Furlong <furlongm@gmail.com>
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Patchman.
|
|
4
|
+
#
|
|
5
|
+
# Patchman is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
|
7
|
+
# the Free Software Foundation, version 3 only.
|
|
8
|
+
#
|
|
9
|
+
# Patchman is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU General Public License
|
|
15
|
+
# along with Patchman. If not, see <http://www.gnu.org/licenses/>
|
|
16
|
+
|
|
17
|
+
from datetime import datetime, timezone
|
|
18
|
+
|
|
19
|
+
from defusedxml import ElementTree
|
|
20
|
+
from django.test import TestCase
|
|
21
|
+
|
|
22
|
+
from errata.sources.repos.yum import get_updateinfo_issue_date
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def make_update(dates):
|
|
26
|
+
return ElementTree.fromstring(f'<update type="security"><id>TEST-1</id>{dates}</update>')
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class UpdateinfoIssueDateTests(TestCase):
|
|
30
|
+
"""Tests for getting the issue date of an updateinfo erratum."""
|
|
31
|
+
|
|
32
|
+
def test_issued_date(self):
|
|
33
|
+
"""Test the issued date is used when present."""
|
|
34
|
+
update = make_update('<issued date="2026-08-26 12:34:56"/><updated date="2026-09-01 00:00:00"/>')
|
|
35
|
+
self.assertEqual(
|
|
36
|
+
get_updateinfo_issue_date(update),
|
|
37
|
+
datetime(2026, 8, 26, 12, 34, 56, tzinfo=timezone.utc),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
def test_falls_back_to_updated_date(self):
|
|
41
|
+
"""Test the updated date is used when there is no issued date."""
|
|
42
|
+
update = make_update('<updated date="2026-09-01 00:00:00 UTC"/>')
|
|
43
|
+
self.assertEqual(get_updateinfo_issue_date(update), datetime(2026, 9, 1, tzinfo=timezone.utc))
|
|
44
|
+
|
|
45
|
+
def test_falls_back_when_issued_invalid(self):
|
|
46
|
+
"""Test the updated date is used when the issued date is invalid."""
|
|
47
|
+
update = make_update('<issued date="bogus"/><updated date="1704067200"/>')
|
|
48
|
+
self.assertEqual(get_updateinfo_issue_date(update), datetime(2024, 1, 1, tzinfo=timezone.utc))
|
|
49
|
+
|
|
50
|
+
def test_no_valid_date(self):
|
|
51
|
+
"""Test None is returned when there is no valid date."""
|
|
52
|
+
self.assertIsNone(get_updateinfo_issue_date(make_update('<issued/>')))
|
|
@@ -144,6 +144,17 @@ class Host(models.Model):
|
|
|
144
144
|
if rlen > 0:
|
|
145
145
|
info_message(text=f'{self.hostname}: removed {rlen} old reports')
|
|
146
146
|
|
|
147
|
+
def find_client_updates(self):
|
|
148
|
+
""" Returns the updates the client sent with its latest report. Host
|
|
149
|
+
packages come from the same report, so stale ones are dropped
|
|
150
|
+
"""
|
|
151
|
+
from reports.models import Report
|
|
152
|
+
from reports.utils import find_client_updates
|
|
153
|
+
report = Report.objects.filter(host=self.hostname, processed=True).order_by('-created').first()
|
|
154
|
+
if report is None:
|
|
155
|
+
return []
|
|
156
|
+
return find_client_updates(self, report)
|
|
157
|
+
|
|
147
158
|
def get_host_repo_packages(self):
|
|
148
159
|
if self.host_repos_only:
|
|
149
160
|
hostrepos_q = Q(mirror__repo__in=self.repos.all(),
|
|
@@ -214,6 +225,17 @@ class Host(models.Model):
|
|
|
214
225
|
for ku_id in kernel_update_ids:
|
|
215
226
|
update_ids.add(ku_id)
|
|
216
227
|
|
|
228
|
+
# client-reported updates come from the package manager, which knows
|
|
229
|
+
# about pins and repo priorities, so they replace the computed ones
|
|
230
|
+
client_updates = self.find_client_updates()
|
|
231
|
+
if client_updates:
|
|
232
|
+
client_oldpackage_ids = {u.oldpackage_id for u in client_updates}
|
|
233
|
+
update_ids = set(PackageUpdate.objects.filter(id__in=update_ids).exclude(
|
|
234
|
+
oldpackage_id__in=client_oldpackage_ids).values_list('id', flat=True))
|
|
235
|
+
for update in client_updates:
|
|
236
|
+
self.updates.add(update)
|
|
237
|
+
update_ids.add(update.id)
|
|
238
|
+
|
|
217
239
|
for update in self.updates.all():
|
|
218
240
|
if update.id not in update_ids:
|
|
219
241
|
self.updates.remove(update)
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
# You should have received a copy of the GNU General Public License
|
|
15
15
|
# along with Patchman. If not, see <http://www.gnu.org/licenses/>
|
|
16
16
|
|
|
17
|
+
import json
|
|
18
|
+
|
|
17
19
|
from django.test import TestCase, override_settings
|
|
18
20
|
from django.utils import timezone
|
|
19
21
|
|
|
@@ -22,6 +24,7 @@ from domains.models import Domain
|
|
|
22
24
|
from hosts.models import Host, HostRepo
|
|
23
25
|
from operatingsystems.models import OSRelease, OSVariant
|
|
24
26
|
from packages.models import Package, PackageName, PackageUpdate
|
|
27
|
+
from reports.models import Report
|
|
25
28
|
from repos.models import Mirror, MirrorPackage, Repository
|
|
26
29
|
|
|
27
30
|
|
|
@@ -362,3 +365,90 @@ class HostProcessUpdateTests(TestCase):
|
|
|
362
365
|
update_id = self.host.process_update(old_pkg, new_pkg)
|
|
363
366
|
update = PackageUpdate.objects.get(id=update_id)
|
|
364
367
|
self.assertTrue(update.security)
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
@override_settings(
|
|
371
|
+
CELERY_TASK_ALWAYS_EAGER=True,
|
|
372
|
+
CACHES={'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
|
|
373
|
+
)
|
|
374
|
+
class ClientReportedUpdatesTests(TestCase):
|
|
375
|
+
"""Updates sent by the client must survive find_updates until a newer
|
|
376
|
+
report no longer applies them."""
|
|
377
|
+
|
|
378
|
+
def _report(self, packages, sec_updates='', bug_updates='', protocol='1'):
|
|
379
|
+
report = Report.objects.create(
|
|
380
|
+
host='client-updates.example.com',
|
|
381
|
+
domain='example.com',
|
|
382
|
+
report_ip='192.168.1.20',
|
|
383
|
+
os='Ubuntu 22.04',
|
|
384
|
+
kernel='5.15.0-91-generic',
|
|
385
|
+
arch='x86_64',
|
|
386
|
+
protocol=protocol,
|
|
387
|
+
packages=packages,
|
|
388
|
+
repos='' if protocol == '1' else '[]',
|
|
389
|
+
modules='' if protocol == '1' else '[]',
|
|
390
|
+
sec_updates=sec_updates,
|
|
391
|
+
bug_updates=bug_updates,
|
|
392
|
+
)
|
|
393
|
+
report.process()
|
|
394
|
+
return Host.objects.get(hostname='client-updates.example.com')
|
|
395
|
+
|
|
396
|
+
def test_apt_text_updates_without_repo(self):
|
|
397
|
+
"""bash protocol 1 apt updates have no repo field."""
|
|
398
|
+
host = self._report(
|
|
399
|
+
"'nginx' '' '1.18.0' '6ubuntu14' 'amd64' 'deb'\n"
|
|
400
|
+
"'curl' '' '7.81.0' '1ubuntu1.14' 'amd64' 'deb'\n",
|
|
401
|
+
sec_updates='nginx.amd64 1.18.0-6ubuntu14.4\n',
|
|
402
|
+
bug_updates='curl.amd64 7.81.0-1ubuntu1.15\n',
|
|
403
|
+
)
|
|
404
|
+
updates = {u.newpackage.name.name: u for u in host.updates.all()}
|
|
405
|
+
self.assertEqual(set(updates), {'nginx', 'curl'})
|
|
406
|
+
self.assertEqual(updates['nginx'].newpackage.packagetype, Package.DEB)
|
|
407
|
+
self.assertEqual(updates['nginx'].newpackage.release, '6ubuntu14.4')
|
|
408
|
+
self.assertTrue(updates['nginx'].security)
|
|
409
|
+
self.assertFalse(updates['curl'].security)
|
|
410
|
+
|
|
411
|
+
def test_json_updates_survive_find_updates(self):
|
|
412
|
+
"""A later find_updates run must not drop the client's updates."""
|
|
413
|
+
host = self._report(
|
|
414
|
+
json.dumps([{'name': 'nginx', 'epoch': '', 'version': '1.18.0',
|
|
415
|
+
'release': '6ubuntu14', 'arch': 'amd64', 'type': 'deb'}]),
|
|
416
|
+
sec_updates=json.dumps([{'name': 'nginx', 'version': '1.18.0-6ubuntu14.4', 'arch': 'amd64'}]),
|
|
417
|
+
protocol='2',
|
|
418
|
+
)
|
|
419
|
+
host.find_updates()
|
|
420
|
+
self.assertEqual(host.updates.count(), 1)
|
|
421
|
+
|
|
422
|
+
def test_stale_client_updates_are_dropped(self):
|
|
423
|
+
"""Once the package is updated, the old client update goes away."""
|
|
424
|
+
self._report(
|
|
425
|
+
"'nginx' '' '1.18.0' '6ubuntu14' 'amd64' 'deb'\n",
|
|
426
|
+
sec_updates='nginx.amd64 1.18.0-6ubuntu14.4\n',
|
|
427
|
+
)
|
|
428
|
+
host = self._report("'nginx' '' '1.18.0' '6ubuntu14.4' 'amd64' 'deb'\n")
|
|
429
|
+
self.assertEqual(host.updates.count(), 0)
|
|
430
|
+
host.find_updates()
|
|
431
|
+
self.assertEqual(host.updates.count(), 0)
|
|
432
|
+
|
|
433
|
+
def test_client_update_replaces_computed_update(self):
|
|
434
|
+
"""The package manager's choice (pins, priorities) wins over the
|
|
435
|
+
newest version found in the host's repos."""
|
|
436
|
+
host = self._report(
|
|
437
|
+
"'nginx' '' '1.18.0' '6ubuntu14' 'amd64' 'deb'\n",
|
|
438
|
+
bug_updates='nginx.amd64 1.18.0-6ubuntu14.4\n',
|
|
439
|
+
)
|
|
440
|
+
machine_arch = MachineArchitecture.objects.get(name='x86_64')
|
|
441
|
+
repo = Repository.objects.create(name='pinned', arch=machine_arch, repotype=Repository.DEB, enabled=True)
|
|
442
|
+
mirror = Mirror.objects.create(repo=repo, url='http://pinned.example.com/', enabled=True, refresh=True)
|
|
443
|
+
HostRepo.objects.create(host=host, repo=repo, enabled=True)
|
|
444
|
+
newest = Package.objects.create(
|
|
445
|
+
name=PackageName.objects.get(name='nginx'),
|
|
446
|
+
arch=PackageArchitecture.objects.get(name='amd64'),
|
|
447
|
+
epoch='', version='1.24.0', release='1', packagetype=Package.DEB,
|
|
448
|
+
)
|
|
449
|
+
MirrorPackage.objects.create(mirror=mirror, package=newest)
|
|
450
|
+
host.find_updates()
|
|
451
|
+
self.assertEqual(
|
|
452
|
+
[(u.newpackage.version, u.newpackage.release) for u in host.updates.all()],
|
|
453
|
+
[('1.18.0', '6ubuntu14.4')],
|
|
454
|
+
)
|
|
@@ -36,8 +36,10 @@ class RepoSerializer(serializers.Serializer):
|
|
|
36
36
|
name = serializers.CharField(max_length=255)
|
|
37
37
|
id = serializers.CharField(max_length=255, required=False, allow_blank=True, default='')
|
|
38
38
|
priority = serializers.IntegerField(required=False, default=0)
|
|
39
|
+
# not URLField: clients send rsync://, file:// etc, which process_repo
|
|
40
|
+
# maps or skips, rather than failing the whole report
|
|
39
41
|
urls = serializers.ListField(
|
|
40
|
-
child=serializers.
|
|
42
|
+
child=serializers.CharField(max_length=512),
|
|
41
43
|
required=False,
|
|
42
44
|
default=list
|
|
43
45
|
)
|
|
@@ -230,6 +230,17 @@ class RepoSerializerValidationTests(TestCase):
|
|
|
230
230
|
# urls defaults to empty list
|
|
231
231
|
self.assertEqual(serializer.validated_data['urls'], [])
|
|
232
232
|
|
|
233
|
+
def test_non_http_urls(self):
|
|
234
|
+
"""Test non-http(s) urls such as gentoo rsync mirrors are accepted."""
|
|
235
|
+
data = {
|
|
236
|
+
'type': 'gentoo',
|
|
237
|
+
'name': 'Gentoo Linux gentoo Repo x86_64',
|
|
238
|
+
'id': 'gentoo',
|
|
239
|
+
'urls': ['rsync://rsync.gentoo.org/gentoo-portage', 'file:///var/db/repos/local'],
|
|
240
|
+
}
|
|
241
|
+
serializer = RepoSerializer(data=data)
|
|
242
|
+
self.assertTrue(serializer.is_valid(), serializer.errors)
|
|
243
|
+
|
|
233
244
|
|
|
234
245
|
@override_settings(
|
|
235
246
|
CELERY_TASK_ALWAYS_EAGER=True,
|
|
@@ -256,6 +256,37 @@ class ProcessRepoTests(TestCase):
|
|
|
256
256
|
self.assertEqual(repo2.id, repo.id)
|
|
257
257
|
self.assertEqual(repo2.name, 'Zabbix Official Repository - x86_64 x86_64')
|
|
258
258
|
|
|
259
|
+
def test_process_repo_non_http_mirror_not_created(self):
|
|
260
|
+
"""Unknown non-http(s) URLs should not create mirrors."""
|
|
261
|
+
repo, _ = process_repo(
|
|
262
|
+
r_type=Repository.RPM,
|
|
263
|
+
r_name='Local x86_64',
|
|
264
|
+
r_id='local',
|
|
265
|
+
r_priority=-99,
|
|
266
|
+
urls=['file:///srv/repo'],
|
|
267
|
+
arch='x86_64',
|
|
268
|
+
)
|
|
269
|
+
self.assertEqual(repo.name, 'Local x86_64')
|
|
270
|
+
self.assertFalse(Mirror.objects.exists())
|
|
271
|
+
|
|
272
|
+
def test_process_repo_existing_non_http_mirror_matches(self):
|
|
273
|
+
"""An existing non-http(s) mirror should still identify its repo,
|
|
274
|
+
even if the repo was renamed or the client reports a new name.
|
|
275
|
+
"""
|
|
276
|
+
arch = MachineArchitecture.objects.create(name='x86_64')
|
|
277
|
+
repo = Repository.objects.create(name='Site Local el9', arch=arch, repotype=Repository.RPM)
|
|
278
|
+
Mirror.objects.create(repo=repo, url='file:///srv/el9')
|
|
279
|
+
repo2, _ = process_repo(
|
|
280
|
+
r_type=Repository.RPM,
|
|
281
|
+
r_name='Local x86_64',
|
|
282
|
+
r_id='local',
|
|
283
|
+
r_priority=-99,
|
|
284
|
+
urls=['file:///srv/el9/'],
|
|
285
|
+
arch='x86_64',
|
|
286
|
+
)
|
|
287
|
+
self.assertEqual(repo2.id, repo.id)
|
|
288
|
+
self.assertEqual(Repository.objects.count(), 1)
|
|
289
|
+
|
|
259
290
|
|
|
260
291
|
@override_settings(
|
|
261
292
|
CELERY_TASK_ALWAYS_EAGER=True,
|
|
@@ -283,7 +314,7 @@ class ProcessUpdateTests(TestCase):
|
|
|
283
314
|
domain=self.domain,
|
|
284
315
|
lastreport=timezone.now(),
|
|
285
316
|
)
|
|
286
|
-
# Create an old RPM package on the host
|
|
317
|
+
# Create an old RPM package on the host
|
|
287
318
|
self.pkg_name = PackageName.objects.create(name='openssl')
|
|
288
319
|
self.old_pkg = Package.objects.create(
|
|
289
320
|
name=self.pkg_name,
|
|
@@ -684,6 +715,20 @@ class GetOSTests(TestCase):
|
|
|
684
715
|
self.assertEqual(osvariant.name, 'Debian 12.0')
|
|
685
716
|
self.assertEqual(osvariant.osrelease.name, 'Debian 12')
|
|
686
717
|
|
|
718
|
+
def test_debian_major_without_minor(self):
|
|
719
|
+
"""Test Debian version without a minor part"""
|
|
720
|
+
from reports.utils import get_os
|
|
721
|
+
osvariant = get_os('Debian 13', self.arch)
|
|
722
|
+
self.assertEqual(osvariant.osrelease.name, 'Debian 13')
|
|
723
|
+
|
|
724
|
+
def test_debian_testing_codename(self):
|
|
725
|
+
"""Test Debian testing/sid reports a codename instead of a version"""
|
|
726
|
+
from reports.utils import get_os
|
|
727
|
+
osvariant = get_os('Debian trixie-sid', self.arch)
|
|
728
|
+
self.assertEqual(osvariant.name, 'Debian trixie-sid')
|
|
729
|
+
self.assertEqual(osvariant.osrelease.name, 'Debian trixie-sid')
|
|
730
|
+
self.assertIsNone(osvariant.osrelease.cpe_name)
|
|
731
|
+
|
|
687
732
|
def test_rocky_with_cpe(self):
|
|
688
733
|
"""Test Rocky Linux with CPE in brackets"""
|
|
689
734
|
from reports.utils import get_os
|
|
@@ -155,10 +155,12 @@ def parse_updates(updates_string, security):
|
|
|
155
155
|
specifying whether it is a security update or not
|
|
156
156
|
"""
|
|
157
157
|
updates = {}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
# one update per line: name.arch version [repo], apt updates have no repo
|
|
159
|
+
for line in updates_string.splitlines():
|
|
160
|
+
fields = line.split()
|
|
161
|
+
if len(fields) < 2:
|
|
162
|
+
continue
|
|
163
|
+
name = ' '.join(fields[:3]) + '\n'
|
|
162
164
|
updates[name] = security
|
|
163
165
|
return updates
|
|
164
166
|
|
|
@@ -168,7 +170,7 @@ def process_update_text(host, update_string, security):
|
|
|
168
170
|
object. Only works if the original package exists. Returns None otherwise
|
|
169
171
|
"""
|
|
170
172
|
update_str = update_string.split()
|
|
171
|
-
repo_id = update_str[2]
|
|
173
|
+
repo_id = update_str[2] if len(update_str) > 2 else ''
|
|
172
174
|
|
|
173
175
|
parts = update_str[0].rpartition('.')
|
|
174
176
|
p_name = parts[0]
|
|
@@ -182,28 +184,70 @@ def process_update_text(host, update_string, security):
|
|
|
182
184
|
def process_update(host, name, epoch, version, release, arch, repo_id, security):
|
|
183
185
|
""" Core update processing logic shared by text and JSON handlers
|
|
184
186
|
"""
|
|
187
|
+
update = get_client_update(host, name, epoch, version, release, arch, security)
|
|
188
|
+
if update is None:
|
|
189
|
+
return None
|
|
190
|
+
try:
|
|
191
|
+
repo = Repository.objects.get(repo_id=repo_id)
|
|
192
|
+
except Repository.DoesNotExist:
|
|
193
|
+
repo = None
|
|
194
|
+
if repo:
|
|
195
|
+
for mirror in repo.mirror_set.all():
|
|
196
|
+
MirrorPackage.objects.create(mirror=mirror, package=update.newpackage)
|
|
197
|
+
return update
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def get_client_update(host, name, epoch, version, release, arch, security):
|
|
201
|
+
""" Get or create the PackageUpdate for a client-reported update. Returns
|
|
202
|
+
None unless an older version of the package is installed on the host
|
|
203
|
+
"""
|
|
204
|
+
if not name or not arch or not version:
|
|
205
|
+
return None
|
|
206
|
+
installed_package = host.packages.filter(name__name=name.lower(), arch__name=arch).first()
|
|
207
|
+
if installed_package is None:
|
|
208
|
+
return None
|
|
185
209
|
package = get_or_create_package(
|
|
186
210
|
name=name,
|
|
187
211
|
epoch=epoch,
|
|
188
212
|
version=version,
|
|
189
213
|
release=release,
|
|
190
214
|
arch=arch,
|
|
191
|
-
p_type=
|
|
215
|
+
p_type=installed_package.packagetype,
|
|
192
216
|
)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
repo = None
|
|
197
|
-
if repo:
|
|
198
|
-
for mirror in repo.mirror_set.all():
|
|
199
|
-
MirrorPackage.objects.create(mirror=mirror, package=package)
|
|
217
|
+
if package is None or installed_package.compare_version(package) != -1:
|
|
218
|
+
return None
|
|
219
|
+
return get_or_create_package_update(oldpackage=installed_package, newpackage=package, security=security)
|
|
200
220
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
221
|
+
|
|
222
|
+
def find_client_updates(host, report):
|
|
223
|
+
""" Returns the updates reported by the client in a report that still
|
|
224
|
+
apply to the host
|
|
225
|
+
"""
|
|
226
|
+
if report.protocol == '2':
|
|
227
|
+
sec_updates = report.sec_updates_parsed
|
|
228
|
+
bug_updates = report.bug_updates_parsed
|
|
229
|
+
else:
|
|
230
|
+
sec_updates = [parse_update_text(u) for u in parse_updates(report.sec_updates or '', True)]
|
|
231
|
+
bug_updates = [parse_update_text(u) for u in parse_updates(report.bug_updates or '', False)]
|
|
232
|
+
updates = []
|
|
233
|
+
for reported, security in [(u, True) for u in sec_updates] + [(u, False) for u in bug_updates]:
|
|
234
|
+
if not isinstance(reported, dict) or not reported.get('version'):
|
|
235
|
+
continue
|
|
236
|
+
epoch, version, release = find_evr(reported['version'])
|
|
237
|
+
update = get_client_update(
|
|
238
|
+
host, reported.get('name'), epoch, version, release, reported.get('arch'), security,
|
|
239
|
+
)
|
|
240
|
+
if update is not None:
|
|
241
|
+
updates.append(update)
|
|
242
|
+
return updates
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def parse_update_text(update_string):
|
|
246
|
+
""" Converts a sanitized update string into a dict like a JSON update
|
|
247
|
+
"""
|
|
248
|
+
update_str = update_string.split()
|
|
249
|
+
parts = update_str[0].rpartition('.')
|
|
250
|
+
return {'name': parts[0], 'arch': parts[2], 'version': update_str[1]}
|
|
207
251
|
|
|
208
252
|
|
|
209
253
|
def parse_repos(repos_string):
|
|
@@ -244,13 +288,14 @@ def process_repo(r_type, r_name, r_id, r_priority, urls, arch):
|
|
|
244
288
|
for r_url in urls:
|
|
245
289
|
if r_type == Repository.GENTOO and r_url.startswith('rsync'):
|
|
246
290
|
r_url = 'https://api.gentoo.org/mirrors/distfiles.xml'
|
|
247
|
-
if not r_url.startswith(('http://', 'https://')):
|
|
248
|
-
warning_message(text=f'Skipping non-http(s) mirror URL: {r_url}')
|
|
249
|
-
continue
|
|
250
291
|
try:
|
|
251
292
|
mirror = Mirror.objects.get(url=r_url.strip('/'))
|
|
252
293
|
except Mirror.DoesNotExist:
|
|
253
|
-
|
|
294
|
+
# existing non-http(s) mirrors still identify their repo,
|
|
295
|
+
# but new ones are not created as they cannot be refreshed
|
|
296
|
+
if not r_url.startswith(('http://', 'https://')):
|
|
297
|
+
warning_message(text=f'Skipping non-http(s) mirror URL: {r_url}')
|
|
298
|
+
elif repository:
|
|
254
299
|
Mirror.objects.create(repo=repository, url=r_url.rstrip('/'))
|
|
255
300
|
else:
|
|
256
301
|
unknown.append(r_url)
|
|
@@ -611,9 +656,12 @@ def get_os(os, arch):
|
|
|
611
656
|
elif os.startswith('Arch'):
|
|
612
657
|
cpe_name = 'cpe:2.3:o:archlinux:arch_linux:-:*:*:*:*:*:*:*'
|
|
613
658
|
elif os.startswith('Debian'):
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
659
|
+
# testing/sid report a codename (e.g. 'Debian trixie-sid'), not a version
|
|
660
|
+
match = re.match(r'Debian (\d+)', os)
|
|
661
|
+
if match:
|
|
662
|
+
major = match.group(1)
|
|
663
|
+
osrelease_name = f'Debian {major}'
|
|
664
|
+
cpe_name = f'cpe:2.3:o:debian:debian_linux:{major}.0:*:*:*:*:*:*:*'
|
|
617
665
|
elif os.startswith('Ubuntu'):
|
|
618
666
|
lts = ''
|
|
619
667
|
if 'LTS' in os:
|
|
@@ -23,7 +23,10 @@ from django.db import models
|
|
|
23
23
|
from django.urls import reverse
|
|
24
24
|
|
|
25
25
|
from security.managers import CVEManager
|
|
26
|
-
from util import
|
|
26
|
+
from util import (
|
|
27
|
+
error_message, fetch_content, get_url, response_is_valid,
|
|
28
|
+
tz_aware_datetime,
|
|
29
|
+
)
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
class Reference(models.Model):
|
|
@@ -164,25 +167,27 @@ class CVE(models.Model):
|
|
|
164
167
|
self.fetch_nist_cve_data()
|
|
165
168
|
sleep(sleep_secs) # rate limited, see https://nvd.nist.gov/developers/start-here
|
|
166
169
|
|
|
170
|
+
def fetch_cve_json(self, url, source):
|
|
171
|
+
res = get_url(url)
|
|
172
|
+
if not response_is_valid(res):
|
|
173
|
+
status = res.status_code if res is not None else 'No response'
|
|
174
|
+
error_message(text=f'{status} - Skipping {self.cve_id} - {url}')
|
|
175
|
+
return
|
|
176
|
+
data = fetch_content(res, f'Fetching {self.cve_id} {source} data')
|
|
177
|
+
if data:
|
|
178
|
+
return json.loads(data)
|
|
179
|
+
|
|
167
180
|
def fetch_mitre_cve_data(self):
|
|
168
181
|
mitre_cve_url = f'https://cveawg.mitre.org/api/cve/{self.cve_id}'
|
|
169
|
-
|
|
170
|
-
if
|
|
171
|
-
|
|
172
|
-
return
|
|
173
|
-
data = fetch_content(res, f'Fetching {self.cve_id} MITRE data')
|
|
174
|
-
cve_json = json.loads(data)
|
|
175
|
-
self.parse_mitre_cve_data(cve_json)
|
|
182
|
+
cve_json = self.fetch_cve_json(mitre_cve_url, 'MITRE')
|
|
183
|
+
if cve_json:
|
|
184
|
+
self.parse_mitre_cve_data(cve_json)
|
|
176
185
|
|
|
177
186
|
def fetch_osv_dev_cve_data(self):
|
|
178
187
|
osv_dev_cve_url = f'https://api.osv.dev/v1/vulns/{self.cve_id}'
|
|
179
|
-
|
|
180
|
-
if
|
|
181
|
-
|
|
182
|
-
return
|
|
183
|
-
data = fetch_content(res, f'Fetching {self.cve_id} OSV data')
|
|
184
|
-
cve_json = json.loads(data)
|
|
185
|
-
self.parse_osv_dev_cve_data(cve_json)
|
|
188
|
+
cve_json = self.fetch_cve_json(osv_dev_cve_url, 'OSV')
|
|
189
|
+
if cve_json:
|
|
190
|
+
self.parse_osv_dev_cve_data(cve_json)
|
|
186
191
|
|
|
187
192
|
def parse_osv_dev_cve_data(self, cve_json):
|
|
188
193
|
from security.utils import get_or_create_reference
|
|
@@ -201,12 +206,9 @@ class CVE(models.Model):
|
|
|
201
206
|
|
|
202
207
|
def fetch_nist_cve_data(self):
|
|
203
208
|
nist_cve_url = f'https://services.nvd.nist.gov/rest/json/cves/2.0?cveIds={self.cve_id}'
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
error_message(text=f'404 - Skipping {self.cve_id} - {nist_cve_url}')
|
|
208
|
-
cve_json = json.loads(data)
|
|
209
|
-
self.parse_nist_cve_data(cve_json)
|
|
209
|
+
cve_json = self.fetch_cve_json(nist_cve_url, 'NIST')
|
|
210
|
+
if cve_json:
|
|
211
|
+
self.parse_nist_cve_data(cve_json)
|
|
210
212
|
|
|
211
213
|
def parse_nist_cve_data(self, cve_json):
|
|
212
214
|
from security.utils import get_or_create_reference
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
# along with Patchman. If not, see <http://www.gnu.org/licenses/>
|
|
16
16
|
|
|
17
17
|
from decimal import Decimal
|
|
18
|
+
from unittest.mock import patch
|
|
18
19
|
|
|
20
|
+
import requests
|
|
19
21
|
from django.db import IntegrityError
|
|
20
22
|
from django.test import TestCase, override_settings
|
|
21
23
|
|
|
@@ -63,6 +65,34 @@ class CVEMethodTests(TestCase):
|
|
|
63
65
|
cve.cvss_scores.add(score)
|
|
64
66
|
self.assertIn(score, cve.cvss_scores.all())
|
|
65
67
|
|
|
68
|
+
def _response(self, status_code, content=b''):
|
|
69
|
+
response = requests.Response()
|
|
70
|
+
response.status_code = status_code
|
|
71
|
+
response._content = content
|
|
72
|
+
return response
|
|
73
|
+
|
|
74
|
+
def test_fetch_cve_data_skips_error_responses(self):
|
|
75
|
+
"""Error or missing responses should be skipped, not crash."""
|
|
76
|
+
cve = CVE.objects.create(cve_id='CVE-2024-1234')
|
|
77
|
+
for response in (self._response(404), self._response(403), None):
|
|
78
|
+
with patch('security.models.get_url', return_value=response), \
|
|
79
|
+
patch.object(CVE, 'parse_nist_cve_data') as parse_nist, \
|
|
80
|
+
patch.object(CVE, 'parse_mitre_cve_data') as parse_mitre, \
|
|
81
|
+
patch.object(CVE, 'parse_osv_dev_cve_data') as parse_osv:
|
|
82
|
+
cve.fetch_cve_data(fetch_nist_data=True, sleep_secs=0)
|
|
83
|
+
parse_nist.assert_not_called()
|
|
84
|
+
parse_mitre.assert_not_called()
|
|
85
|
+
parse_osv.assert_not_called()
|
|
86
|
+
|
|
87
|
+
def test_fetch_nist_cve_data_parses_valid_response(self):
|
|
88
|
+
"""A valid NIST response should be parsed."""
|
|
89
|
+
cve = CVE.objects.create(cve_id='CVE-2024-1234')
|
|
90
|
+
response = self._response(200, b'{"vulnerabilities": []}')
|
|
91
|
+
with patch('security.models.get_url', return_value=response), \
|
|
92
|
+
patch.object(CVE, 'parse_nist_cve_data') as parse_nist:
|
|
93
|
+
cve.fetch_nist_cve_data()
|
|
94
|
+
parse_nist.assert_called_once_with({'vulnerabilities': []})
|
|
95
|
+
|
|
66
96
|
|
|
67
97
|
@override_settings(
|
|
68
98
|
CELERY_TASK_ALWAYS_EAGER=True,
|