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.
Files changed (371) hide show
  1. {patchman-4.0.22 → patchman-4.0.24}/PKG-INFO +1 -1
  2. patchman-4.0.24/VERSION.txt +1 -0
  3. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/repos/yum.py +21 -3
  4. patchman-4.0.24/errata/tests/test_yum.py +52 -0
  5. {patchman-4.0.22 → patchman-4.0.24}/hosts/models.py +22 -0
  6. {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_find_updates.py +90 -0
  7. {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/PKG-INFO +1 -1
  8. {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/SOURCES.txt +1 -0
  9. {patchman-4.0.22 → patchman-4.0.24}/reports/serializers.py +3 -1
  10. {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_serializers.py +11 -0
  11. {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_utils.py +46 -1
  12. {patchman-4.0.22 → patchman-4.0.24}/reports/utils.py +74 -26
  13. {patchman-4.0.22 → patchman-4.0.24}/security/models.py +23 -21
  14. {patchman-4.0.22 → patchman-4.0.24}/security/tests/test_models.py +30 -0
  15. {patchman-4.0.22 → patchman-4.0.24}/util/__init__.py +10 -9
  16. {patchman-4.0.22 → patchman-4.0.24}/util/tests/test_utils.py +22 -0
  17. patchman-4.0.22/VERSION.txt +0 -1
  18. {patchman-4.0.22 → patchman-4.0.24}/AUTHORS +0 -0
  19. {patchman-4.0.22 → patchman-4.0.24}/COPYING +0 -0
  20. {patchman-4.0.22 → patchman-4.0.24}/INSTALL.md +0 -0
  21. {patchman-4.0.22 → patchman-4.0.24}/MANIFEST.in +0 -0
  22. {patchman-4.0.22 → patchman-4.0.24}/README.md +0 -0
  23. {patchman-4.0.22 → patchman-4.0.24}/arch/__init__.py +0 -0
  24. {patchman-4.0.22 → patchman-4.0.24}/arch/admin.py +0 -0
  25. {patchman-4.0.22 → patchman-4.0.24}/arch/apps.py +0 -0
  26. {patchman-4.0.22 → patchman-4.0.24}/arch/migrations/0001_initial.py +0 -0
  27. {patchman-4.0.22 → patchman-4.0.24}/arch/migrations/0002_alter_machinearchitecture_options_and_more.py +0 -0
  28. {patchman-4.0.22 → patchman-4.0.24}/arch/migrations/__init__.py +0 -0
  29. {patchman-4.0.22 → patchman-4.0.24}/arch/models.py +0 -0
  30. {patchman-4.0.22 → patchman-4.0.24}/arch/serializers.py +0 -0
  31. {patchman-4.0.22 → patchman-4.0.24}/arch/tests/__init__.py +0 -0
  32. {patchman-4.0.22 → patchman-4.0.24}/arch/tests/test_api.py +0 -0
  33. {patchman-4.0.22 → patchman-4.0.24}/arch/tests/test_models.py +0 -0
  34. {patchman-4.0.22 → patchman-4.0.24}/arch/utils.py +0 -0
  35. {patchman-4.0.22 → patchman-4.0.24}/arch/views.py +0 -0
  36. {patchman-4.0.22 → patchman-4.0.24}/domains/__init__.py +0 -0
  37. {patchman-4.0.22 → patchman-4.0.24}/domains/admin.py +0 -0
  38. {patchman-4.0.22 → patchman-4.0.24}/domains/apps.py +0 -0
  39. {patchman-4.0.22 → patchman-4.0.24}/domains/migrations/0001_initial.py +0 -0
  40. {patchman-4.0.22 → patchman-4.0.24}/domains/migrations/0002_alter_domain_options.py +0 -0
  41. {patchman-4.0.22 → patchman-4.0.24}/domains/migrations/__init__.py +0 -0
  42. {patchman-4.0.22 → patchman-4.0.24}/domains/models.py +0 -0
  43. {patchman-4.0.22 → patchman-4.0.24}/domains/serializers.py +0 -0
  44. {patchman-4.0.22 → patchman-4.0.24}/domains/tests/__init__.py +0 -0
  45. {patchman-4.0.22 → patchman-4.0.24}/domains/tests/test_api.py +0 -0
  46. {patchman-4.0.22 → patchman-4.0.24}/domains/tests/test_models.py +0 -0
  47. {patchman-4.0.22 → patchman-4.0.24}/domains/views.py +0 -0
  48. {patchman-4.0.22 → patchman-4.0.24}/errata/__init__.py +0 -0
  49. {patchman-4.0.22 → patchman-4.0.24}/errata/admin.py +0 -0
  50. {patchman-4.0.22 → patchman-4.0.24}/errata/apps.py +0 -0
  51. {patchman-4.0.22 → patchman-4.0.24}/errata/managers.py +0 -0
  52. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0001_initial.py +0 -0
  53. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0002_alter_erratumreference_unique_together.py +0 -0
  54. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0003_delete_erratumreference_alter_erratum_references.py +0 -0
  55. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0004_rename_packages_erratum_fixed_packages.py +0 -0
  56. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0005_erratum_affected_packages_and_more.py +0 -0
  57. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0006_alter_erratum_options.py +0 -0
  58. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0007_alter_erratum_fixed_packages.py +0 -0
  59. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0008_add_cached_count_fields.py +0 -0
  60. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0009_backfill_cached_counts.py +0 -0
  61. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/0010_synopsis_textfield.py +0 -0
  62. {patchman-4.0.22 → patchman-4.0.24}/errata/migrations/__init__.py +0 -0
  63. {patchman-4.0.22 → patchman-4.0.24}/errata/models.py +0 -0
  64. {patchman-4.0.22 → patchman-4.0.24}/errata/serializers.py +0 -0
  65. {patchman-4.0.22 → patchman-4.0.24}/errata/signals.py +0 -0
  66. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/__init__.py +0 -0
  67. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/__init__.py +0 -0
  68. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/alma.py +0 -0
  69. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/arch.py +0 -0
  70. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/centos.py +0 -0
  71. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/debian.py +0 -0
  72. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/rocky.py +0 -0
  73. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/distros/ubuntu.py +0 -0
  74. {patchman-4.0.22 → patchman-4.0.24}/errata/sources/repos/__init__.py +0 -0
  75. {patchman-4.0.22 → patchman-4.0.24}/errata/tables.py +0 -0
  76. {patchman-4.0.22 → patchman-4.0.24}/errata/tasks.py +0 -0
  77. {patchman-4.0.22 → patchman-4.0.24}/errata/templates/errata/erratum_detail.html +0 -0
  78. {patchman-4.0.22 → patchman-4.0.24}/errata/templates/errata/erratum_list.html +0 -0
  79. {patchman-4.0.22 → patchman-4.0.24}/errata/tests/__init__.py +0 -0
  80. {patchman-4.0.22 → patchman-4.0.24}/errata/tests/test_api.py +0 -0
  81. {patchman-4.0.22 → patchman-4.0.24}/errata/tests/test_integration.py +0 -0
  82. {patchman-4.0.22 → patchman-4.0.24}/errata/tests/test_models.py +0 -0
  83. {patchman-4.0.22 → patchman-4.0.24}/errata/urls.py +0 -0
  84. {patchman-4.0.22 → patchman-4.0.24}/errata/utils.py +0 -0
  85. {patchman-4.0.22 → patchman-4.0.24}/errata/views.py +0 -0
  86. {patchman-4.0.22 → patchman-4.0.24}/etc/patchman/apache.conf.example +0 -0
  87. {patchman-4.0.22 → patchman-4.0.24}/etc/patchman/celery.conf +0 -0
  88. {patchman-4.0.22 → patchman-4.0.24}/etc/patchman/local_settings.py +0 -0
  89. {patchman-4.0.22 → patchman-4.0.24}/etc/systemd/system/patchman-celery-beat.service +0 -0
  90. {patchman-4.0.22 → patchman-4.0.24}/etc/systemd/system/patchman-celery-worker@.service +0 -0
  91. {patchman-4.0.22 → patchman-4.0.24}/hosts/__init__.py +0 -0
  92. {patchman-4.0.22 → patchman-4.0.24}/hosts/admin.py +0 -0
  93. {patchman-4.0.22 → patchman-4.0.24}/hosts/apps.py +0 -0
  94. {patchman-4.0.22 → patchman-4.0.24}/hosts/forms.py +0 -0
  95. {patchman-4.0.22 → patchman-4.0.24}/hosts/managers.py +0 -0
  96. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0001_initial.py +0 -0
  97. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0002_initial.py +0 -0
  98. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0003_host_modules.py +0 -0
  99. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0004_remove_host_tags_host_tags.py +0 -0
  100. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0005_rename_os_host_osvariant.py +0 -0
  101. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0006_migrate_to_tz_aware.py +0 -0
  102. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0007_alter_host_tags.py +0 -0
  103. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0008_alter_host_options.py +0 -0
  104. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0009_host_errata.py +0 -0
  105. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0010_alter_hostrepo_options.py +0 -0
  106. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0011_host_bug_updates_count_host_errata_count_and_more.py +0 -0
  107. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0012_backfill_cached_counts.py +0 -0
  108. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0013_alter_hostrepo_unique_together_and_more.py +0 -0
  109. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/0014_drop_legacy_tagging.py +0 -0
  110. {patchman-4.0.22 → patchman-4.0.24}/hosts/migrations/__init__.py +0 -0
  111. {patchman-4.0.22 → patchman-4.0.24}/hosts/serializers.py +0 -0
  112. {patchman-4.0.22 → patchman-4.0.24}/hosts/signals.py +0 -0
  113. {patchman-4.0.22 → patchman-4.0.24}/hosts/tables.py +0 -0
  114. {patchman-4.0.22 → patchman-4.0.24}/hosts/tasks.py +0 -0
  115. {patchman-4.0.22 → patchman-4.0.24}/hosts/templates/hosts/host_delete.html +0 -0
  116. {patchman-4.0.22 → patchman-4.0.24}/hosts/templates/hosts/host_detail.html +0 -0
  117. {patchman-4.0.22 → patchman-4.0.24}/hosts/templates/hosts/host_edit.html +0 -0
  118. {patchman-4.0.22 → patchman-4.0.24}/hosts/templates/hosts/host_list.html +0 -0
  119. {patchman-4.0.22 → patchman-4.0.24}/hosts/templatetags/__init__.py +0 -0
  120. {patchman-4.0.22 → patchman-4.0.24}/hosts/templatetags/report_alert.py +0 -0
  121. {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/__init__.py +0 -0
  122. {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_api.py +0 -0
  123. {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_managers.py +0 -0
  124. {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_migrations.py +0 -0
  125. {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_models.py +0 -0
  126. {patchman-4.0.22 → patchman-4.0.24}/hosts/tests/test_utils.py +0 -0
  127. {patchman-4.0.22 → patchman-4.0.24}/hosts/urls.py +0 -0
  128. {patchman-4.0.22 → patchman-4.0.24}/hosts/utils.py +0 -0
  129. {patchman-4.0.22 → patchman-4.0.24}/hosts/views.py +0 -0
  130. {patchman-4.0.22 → patchman-4.0.24}/modules/__init__.py +0 -0
  131. {patchman-4.0.22 → patchman-4.0.24}/modules/admin.py +0 -0
  132. {patchman-4.0.22 → patchman-4.0.24}/modules/apps.py +0 -0
  133. {patchman-4.0.22 → patchman-4.0.24}/modules/managers.py +0 -0
  134. {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0001_initial.py +0 -0
  135. {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0002_auto_20240204_2214.py +0 -0
  136. {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0003_alter_module_options.py +0 -0
  137. {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0004_alter_module_options.py +0 -0
  138. {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0005_alter_module_unique_together.py +0 -0
  139. {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0006_alter_module_context_alter_module_name_and_more.py +0 -0
  140. {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/0007_alter_module_unique_together_module_unique_module.py +0 -0
  141. {patchman-4.0.22 → patchman-4.0.24}/modules/migrations/__init__.py +0 -0
  142. {patchman-4.0.22 → patchman-4.0.24}/modules/models.py +0 -0
  143. {patchman-4.0.22 → patchman-4.0.24}/modules/serializers.py +0 -0
  144. {patchman-4.0.22 → patchman-4.0.24}/modules/tables.py +0 -0
  145. {patchman-4.0.22 → patchman-4.0.24}/modules/templates/modules/module_detail.html +0 -0
  146. {patchman-4.0.22 → patchman-4.0.24}/modules/templates/modules/module_list.html +0 -0
  147. {patchman-4.0.22 → patchman-4.0.24}/modules/urls.py +0 -0
  148. {patchman-4.0.22 → patchman-4.0.24}/modules/utils.py +0 -0
  149. {patchman-4.0.22 → patchman-4.0.24}/modules/views.py +0 -0
  150. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/__init__.py +0 -0
  151. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/admin.py +0 -0
  152. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/apps.py +0 -0
  153. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/fixtures/os.json +0 -0
  154. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/fixtures/osgroup.json +0 -0
  155. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/forms.py +0 -0
  156. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/managers.py +0 -0
  157. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0001_initial.py +0 -0
  158. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0002_initial.py +0 -0
  159. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0003_os_arch.py +0 -0
  160. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0003_osgroup_codename.py +0 -0
  161. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0004_alter_osgroup_unique_together.py +0 -0
  162. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0005_rename_osgroup_osrelease_rename_os_osvariant_and_more.py +0 -0
  163. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0006_osrelease_cpe_name_osvariant_codename.py +0 -0
  164. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0007_alter_osrelease_unique_together.py +0 -0
  165. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0008_alter_osrelease_options_alter_osvariant_options.py +0 -0
  166. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0009_osvariant_hosts_count.py +0 -0
  167. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0010_backfill_osvariant_counts.py +0 -0
  168. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0011_alter_osrelease_codename_alter_osrelease_cpe_name_and_more.py +0 -0
  169. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/0012_alter_osrelease_unique_together_and_more.py +0 -0
  170. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/migrations/__init__.py +0 -0
  171. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/models.py +0 -0
  172. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/serializers.py +0 -0
  173. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/signals.py +0 -0
  174. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/tables.py +0 -0
  175. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/os_landing.html +0 -0
  176. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osrelease_delete.html +0 -0
  177. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osrelease_detail.html +0 -0
  178. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osrelease_list.html +0 -0
  179. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osvariant_delete.html +0 -0
  180. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osvariant_delete_multiple.html +0 -0
  181. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osvariant_detail.html +0 -0
  182. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/templates/operatingsystems/osvariant_list.html +0 -0
  183. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/tests/__init__.py +0 -0
  184. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/tests/test_api.py +0 -0
  185. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/tests/test_models.py +0 -0
  186. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/urls.py +0 -0
  187. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/utils.py +0 -0
  188. {patchman-4.0.22 → patchman-4.0.24}/operatingsystems/views.py +0 -0
  189. {patchman-4.0.22 → patchman-4.0.24}/packages/__init__.py +0 -0
  190. {patchman-4.0.22 → patchman-4.0.24}/packages/admin.py +0 -0
  191. {patchman-4.0.22 → patchman-4.0.24}/packages/apps.py +0 -0
  192. {patchman-4.0.22 → patchman-4.0.24}/packages/managers.py +0 -0
  193. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0001_initial.py +0 -0
  194. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0002_auto_20250207_1319.py +0 -0
  195. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0002_delete_erratum_delete_erratumreference.py +0 -0
  196. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0003_auto_20250207_1746.py +0 -0
  197. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0004_alter_package_options_alter_packagecategory_options_and_more.py +0 -0
  198. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0005_alter_package_packagetype.py +0 -0
  199. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0006_alter_packageupdate_options.py +0 -0
  200. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0007_alter_package_epoch_alter_package_release_and_more.py +0 -0
  201. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/0008_alter_package_unique_together_and_more.py +0 -0
  202. {patchman-4.0.22 → patchman-4.0.24}/packages/migrations/__init__.py +0 -0
  203. {patchman-4.0.22 → patchman-4.0.24}/packages/models.py +0 -0
  204. {patchman-4.0.22 → patchman-4.0.24}/packages/serializers.py +0 -0
  205. {patchman-4.0.22 → patchman-4.0.24}/packages/tables.py +0 -0
  206. {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_detail.html +0 -0
  207. {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_list.html +0 -0
  208. {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_name_detail.html +0 -0
  209. {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_name_list.html +0 -0
  210. {patchman-4.0.22 → patchman-4.0.24}/packages/templates/packages/package_update_list.html +0 -0
  211. {patchman-4.0.22 → patchman-4.0.24}/packages/tests/__init__.py +0 -0
  212. {patchman-4.0.22 → patchman-4.0.24}/packages/tests/test_api.py +0 -0
  213. {patchman-4.0.22 → patchman-4.0.24}/packages/tests/test_models.py +0 -0
  214. {patchman-4.0.22 → patchman-4.0.24}/packages/tests/test_version_compare.py +0 -0
  215. {patchman-4.0.22 → patchman-4.0.24}/packages/tests/test_views.py +0 -0
  216. {patchman-4.0.22 → patchman-4.0.24}/packages/urls.py +0 -0
  217. {patchman-4.0.22 → patchman-4.0.24}/packages/utils.py +0 -0
  218. {patchman-4.0.22 → patchman-4.0.24}/packages/views.py +0 -0
  219. {patchman-4.0.22 → patchman-4.0.24}/patchman/__init__.py +0 -0
  220. {patchman-4.0.22 → patchman-4.0.24}/patchman/celery.py +0 -0
  221. {patchman-4.0.22 → patchman-4.0.24}/patchman/receivers.py +0 -0
  222. {patchman-4.0.22 → patchman-4.0.24}/patchman/settings.py +0 -0
  223. {patchman-4.0.22 → patchman-4.0.24}/patchman/signals.py +0 -0
  224. {patchman-4.0.22 → patchman-4.0.24}/patchman/sqlite3/base.py +0 -0
  225. {patchman-4.0.22 → patchman-4.0.24}/patchman/static/css/base.css +0 -0
  226. {patchman-4.0.22 → patchman-4.0.24}/patchman/static/js/expandable-text.js +0 -0
  227. {patchman-4.0.22 → patchman-4.0.24}/patchman/static/js/sidebar.js +0 -0
  228. {patchman-4.0.22 → patchman-4.0.24}/patchman/urls.py +0 -0
  229. {patchman-4.0.22 → patchman-4.0.24}/patchman/wsgi.py +0 -0
  230. {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/dependency_links.txt +0 -0
  231. {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/requires.txt +0 -0
  232. {patchman-4.0.22 → patchman-4.0.24}/patchman.egg-info/top_level.txt +0 -0
  233. {patchman-4.0.22 → patchman-4.0.24}/reports/__init__.py +0 -0
  234. {patchman-4.0.22 → patchman-4.0.24}/reports/admin.py +0 -0
  235. {patchman-4.0.22 → patchman-4.0.24}/reports/apps.py +0 -0
  236. {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0001_initial.py +0 -0
  237. {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0002_report_modules.py +0 -0
  238. {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0003_remove_report_accessed.py +0 -0
  239. {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0004_migrate_to_tz_aware.py +0 -0
  240. {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0005_alter_report_options.py +0 -0
  241. {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/0006_alter_report_options.py +0 -0
  242. {patchman-4.0.22 → patchman-4.0.24}/reports/migrations/__init__.py +0 -0
  243. {patchman-4.0.22 → patchman-4.0.24}/reports/models.py +0 -0
  244. {patchman-4.0.22 → patchman-4.0.24}/reports/tables.py +0 -0
  245. {patchman-4.0.22 → patchman-4.0.24}/reports/tasks.py +0 -0
  246. {patchman-4.0.22 → patchman-4.0.24}/reports/templates/reports/report.txt +0 -0
  247. {patchman-4.0.22 → patchman-4.0.24}/reports/templates/reports/report_delete.html +0 -0
  248. {patchman-4.0.22 → patchman-4.0.24}/reports/templates/reports/report_detail.html +0 -0
  249. {patchman-4.0.22 → patchman-4.0.24}/reports/templates/reports/report_list.html +0 -0
  250. {patchman-4.0.22 → patchman-4.0.24}/reports/tests/__init__.py +0 -0
  251. {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_api.py +0 -0
  252. {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_edge_cases.py +0 -0
  253. {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_integration.py +0 -0
  254. {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_models.py +0 -0
  255. {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_parsing.py +0 -0
  256. {patchman-4.0.22 → patchman-4.0.24}/reports/tests/test_tasks.py +0 -0
  257. {patchman-4.0.22 → patchman-4.0.24}/reports/urls.py +0 -0
  258. {patchman-4.0.22 → patchman-4.0.24}/reports/views.py +0 -0
  259. {patchman-4.0.22 → patchman-4.0.24}/repos/__init__.py +0 -0
  260. {patchman-4.0.22 → patchman-4.0.24}/repos/admin.py +0 -0
  261. {patchman-4.0.22 → patchman-4.0.24}/repos/apps.py +0 -0
  262. {patchman-4.0.22 → patchman-4.0.24}/repos/forms.py +0 -0
  263. {patchman-4.0.22 → patchman-4.0.24}/repos/managers.py +0 -0
  264. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0001_initial.py +0 -0
  265. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0002_alter_repository_repotype.py +0 -0
  266. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0003_migrate_to_tz_aware.py +0 -0
  267. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0004_rename_file_checksum_mirror_package_checksum.py +0 -0
  268. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0005_rename_package_checksum_mirror_packages_checksum.py +0 -0
  269. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0006_mirror_errata_checksum_mirror_modules_checksum.py +0 -0
  270. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0007_alter_mirror_options_alter_mirrorpackage_options_and_more.py +0 -0
  271. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0008_mirror_packages_count.py +0 -0
  272. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/0009_backfill_mirror_counts.py +0 -0
  273. {patchman-4.0.22 → patchman-4.0.24}/repos/migrations/__init__.py +0 -0
  274. {patchman-4.0.22 → patchman-4.0.24}/repos/models.py +0 -0
  275. {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/__init__.py +0 -0
  276. {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/arch.py +0 -0
  277. {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/deb.py +0 -0
  278. {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/gentoo.py +0 -0
  279. {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/rpm.py +0 -0
  280. {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/yast.py +0 -0
  281. {patchman-4.0.22 → patchman-4.0.24}/repos/repo_types/yum.py +0 -0
  282. {patchman-4.0.22 → patchman-4.0.24}/repos/serializers.py +0 -0
  283. {patchman-4.0.22 → patchman-4.0.24}/repos/signals.py +0 -0
  284. {patchman-4.0.22 → patchman-4.0.24}/repos/tables.py +0 -0
  285. {patchman-4.0.22 → patchman-4.0.24}/repos/tasks.py +0 -0
  286. {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_delete.html +0 -0
  287. {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_detail.html +0 -0
  288. {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_edit.html +0 -0
  289. {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_list.html +0 -0
  290. {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/mirror_with_repo_list.html +0 -0
  291. {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/repo_delete.html +0 -0
  292. {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/repo_detail.html +0 -0
  293. {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/repo_edit.html +0 -0
  294. {patchman-4.0.22 → patchman-4.0.24}/repos/templates/repos/repo_list.html +0 -0
  295. {patchman-4.0.22 → patchman-4.0.24}/repos/templatetags/__init__.py +0 -0
  296. {patchman-4.0.22 → patchman-4.0.24}/repos/tests/__init__.py +0 -0
  297. {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_api.py +0 -0
  298. {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_managers.py +0 -0
  299. {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_mirror_sync.py +0 -0
  300. {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_models.py +0 -0
  301. {patchman-4.0.22 → patchman-4.0.24}/repos/tests/test_views.py +0 -0
  302. {patchman-4.0.22 → patchman-4.0.24}/repos/urls.py +0 -0
  303. {patchman-4.0.22 → patchman-4.0.24}/repos/utils.py +0 -0
  304. {patchman-4.0.22 → patchman-4.0.24}/repos/views.py +0 -0
  305. {patchman-4.0.22 → patchman-4.0.24}/requirements.txt +0 -0
  306. {patchman-4.0.22 → patchman-4.0.24}/sbin/patchman +0 -0
  307. {patchman-4.0.22 → patchman-4.0.24}/sbin/patchman-manage +0 -0
  308. {patchman-4.0.22 → patchman-4.0.24}/sbin/patchman-set-secret-key +0 -0
  309. {patchman-4.0.22 → patchman-4.0.24}/scripts/clear-django-logs.py +0 -0
  310. {patchman-4.0.22 → patchman-4.0.24}/scripts/create_graph.sh +0 -0
  311. {patchman-4.0.22 → patchman-4.0.24}/scripts/rpm-install.sh +0 -0
  312. {patchman-4.0.22 → patchman-4.0.24}/scripts/rpm-post-install.sh +0 -0
  313. {patchman-4.0.22 → patchman-4.0.24}/security/__init__.py +0 -0
  314. {patchman-4.0.22 → patchman-4.0.24}/security/admin.py +0 -0
  315. {patchman-4.0.22 → patchman-4.0.24}/security/apps.py +0 -0
  316. {patchman-4.0.22 → patchman-4.0.24}/security/managers.py +0 -0
  317. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0001_initial.py +0 -0
  318. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0002_alter_cve_options.py +0 -0
  319. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0003_alter_cve_description_alter_cwe_description.py +0 -0
  320. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0004_alter_cve_options.py +0 -0
  321. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0005_reference_cve_references.py +0 -0
  322. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0006_alter_cve_options_alter_cvss_unique_together.py +0 -0
  323. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0007_remove_cve_title.py +0 -0
  324. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0008_alter_cwe_options_alter_reference_options.py +0 -0
  325. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0009_alter_cvss_severity_alter_cvss_vector_string_and_more.py +0 -0
  326. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0010_fix_cvss_vector_string_length.py +0 -0
  327. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/0011_alter_cvss_unique_together_and_more.py +0 -0
  328. {patchman-4.0.22 → patchman-4.0.24}/security/migrations/__init__.py +0 -0
  329. {patchman-4.0.22 → patchman-4.0.24}/security/serializers.py +0 -0
  330. {patchman-4.0.22 → patchman-4.0.24}/security/tables.py +0 -0
  331. {patchman-4.0.22 → patchman-4.0.24}/security/tasks.py +0 -0
  332. {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/cve_detail.html +0 -0
  333. {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/cve_list.html +0 -0
  334. {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/cwe_detail.html +0 -0
  335. {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/cwe_list.html +0 -0
  336. {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/reference_list.html +0 -0
  337. {patchman-4.0.22 → patchman-4.0.24}/security/templates/security/security_landing.html +0 -0
  338. {patchman-4.0.22 → patchman-4.0.24}/security/tests/__init__.py +0 -0
  339. {patchman-4.0.22 → patchman-4.0.24}/security/tests/test_api.py +0 -0
  340. {patchman-4.0.22 → patchman-4.0.24}/security/urls.py +0 -0
  341. {patchman-4.0.22 → patchman-4.0.24}/security/utils.py +0 -0
  342. {patchman-4.0.22 → patchman-4.0.24}/security/views.py +0 -0
  343. {patchman-4.0.22 → patchman-4.0.24}/setup.cfg +0 -0
  344. {patchman-4.0.22 → patchman-4.0.24}/setup.py +0 -0
  345. {patchman-4.0.22 → patchman-4.0.24}/util/apps.py +0 -0
  346. {patchman-4.0.22 → patchman-4.0.24}/util/context_processors.py +0 -0
  347. {patchman-4.0.22 → patchman-4.0.24}/util/filterspecs.py +0 -0
  348. {patchman-4.0.22 → patchman-4.0.24}/util/logging.py +0 -0
  349. {patchman-4.0.22 → patchman-4.0.24}/util/management/__init__.py +0 -0
  350. {patchman-4.0.22 → patchman-4.0.24}/util/management/commands/__init__.py +0 -0
  351. {patchman-4.0.22 → patchman-4.0.24}/util/management/commands/create_api_key.py +0 -0
  352. {patchman-4.0.22 → patchman-4.0.24}/util/management/commands/list_api_keys.py +0 -0
  353. {patchman-4.0.22 → patchman-4.0.24}/util/management/commands/revoke_api_key.py +0 -0
  354. {patchman-4.0.22 → patchman-4.0.24}/util/tables.py +0 -0
  355. {patchman-4.0.22 → patchman-4.0.24}/util/tasks.py +0 -0
  356. {patchman-4.0.22 → patchman-4.0.24}/util/templates/404.html +0 -0
  357. {patchman-4.0.22 → patchman-4.0.24}/util/templates/500.html +0 -0
  358. {patchman-4.0.22 → patchman-4.0.24}/util/templates/base.html +0 -0
  359. {patchman-4.0.22 → patchman-4.0.24}/util/templates/bulk_actions.html +0 -0
  360. {patchman-4.0.22 → patchman-4.0.24}/util/templates/dashboard.html +0 -0
  361. {patchman-4.0.22 → patchman-4.0.24}/util/templates/navbar.html +0 -0
  362. {patchman-4.0.22 → patchman-4.0.24}/util/templates/objectlist.html +0 -0
  363. {patchman-4.0.22 → patchman-4.0.24}/util/templates/registration/login.html +0 -0
  364. {patchman-4.0.22 → patchman-4.0.24}/util/templates/searchbar.html +0 -0
  365. {patchman-4.0.22 → patchman-4.0.24}/util/templates/table.html +0 -0
  366. {patchman-4.0.22 → patchman-4.0.24}/util/templatetags/__init__.py +0 -0
  367. {patchman-4.0.22 → patchman-4.0.24}/util/templatetags/common.py +0 -0
  368. {patchman-4.0.22 → patchman-4.0.24}/util/tests/__init__.py +0 -0
  369. {patchman-4.0.22 → patchman-4.0.24}/util/tests/test_commands.py +0 -0
  370. {patchman-4.0.22 → patchman-4.0.24}/util/urls.py +0 -0
  371. {patchman-4.0.22 → patchman-4.0.24}/util/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchman
3
- Version: 4.0.22
3
+ Version: 4.0.24
4
4
  Summary: Django based patch status monitoring tool for linux systems
5
5
  Home-page: http://patchman.openbytes.ie/
6
6
  Author: Marcus Furlong
@@ -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.find('issued').attrib.get('date')
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
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchman
3
- Version: 4.0.22
3
+ Version: 4.0.24
4
4
  Summary: Django based patch status monitoring tool for linux systems
5
5
  Home-page: http://patchman.openbytes.ie/
6
6
  Author: Marcus Furlong
@@ -71,6 +71,7 @@ errata/tests/__init__.py
71
71
  errata/tests/test_api.py
72
72
  errata/tests/test_integration.py
73
73
  errata/tests/test_models.py
74
+ errata/tests/test_yum.py
74
75
  etc/patchman/apache.conf.example
75
76
  etc/patchman/celery.conf
76
77
  etc/patchman/local_settings.py
@@ -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.URLField(max_length=512),
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 (process_update uses RPM type)
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
- ulist = updates_string.split()
159
- while ulist:
160
- name = f'{ulist[0]} {ulist[1]} {ulist[2]}\n'
161
- del ulist[:3]
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=Package.RPM
215
+ p_type=installed_package.packagetype,
192
216
  )
193
- try:
194
- repo = Repository.objects.get(repo_id=repo_id)
195
- except Repository.DoesNotExist:
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
- installed_packages = host.packages.filter(name=package.name, arch=package.arch, packagetype=Package.RPM)
202
- if installed_packages:
203
- installed_package = installed_packages[0]
204
- update = get_or_create_package_update(oldpackage=installed_package, newpackage=package, security=security)
205
- return update
206
- return None
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
- if repository:
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
- major, minor = os.split(' ')[1].split('.')
615
- osrelease_name = f'Debian {major}'
616
- cpe_name = f'cpe:2.3:o:debian:debian_linux:{major}.0:*:*:*:*:*:*:*'
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 error_message, fetch_content, get_url, tz_aware_datetime
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
- res = get_url(mitre_cve_url)
170
- if res.status_code == 404:
171
- error_message(text=f'404 - Skipping {self.cve_id} - {mitre_cve_url}')
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
- res = get_url(osv_dev_cve_url)
180
- if res.status_code == 404:
181
- error_message(text=f'404 - Skipping {self.cve_id} - {osv_dev_cve_url}')
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
- res = get_url(nist_cve_url)
205
- data = fetch_content(res, f'Fetching {self.cve_id} NIST data')
206
- if res.status_code == 404:
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,