From 1ab58110b5eea5b6ff51a97d384522eb10a1c112 Mon Sep 17 00:00:00 2001 From: Jan Dobes Date: Fri, 7 Nov 2025 16:49:52 +0100 Subject: [PATCH 1/5] feat(manager): add simple endpoint to get cves_without_errata status for future frontend use --- manager.spec.yaml | 32 +++++++++++++++++++++++++++++++- manager/feature_handler.py | 14 ++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/manager.spec.yaml b/manager.spec.yaml index 06595feb7..b07a6e785 100644 --- a/manager.spec.yaml +++ b/manager.spec.yaml @@ -864,6 +864,24 @@ paths: - $ref: '#/components/parameters/mssql' /feature/cves_without_errata: + get: + summary: Get a feature flag status for CVEs without errata + description: > + Use this endpoint to get an enablement status of reporting CVEs that do not have advisories + (errata) for your customer account. If the feature is disabled, CVEs without advisories + will be hidden in outputs of all endpoints. + operationId: manager.feature_handler.GetCvesWithoutErrata.get + x-methodName: getCvesWithoutErrata + security: + - ApiKeyAuth: [] + - BasicAuth: [] + responses: + 200: + description: CVEs without Errata feature enablement status. + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/CvesWithoutErrataOut' patch: summary: Set a feature flag for CVEs without errata description: > @@ -889,7 +907,7 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/CvesWithoutErrataOut' + $ref: '#/components/schemas/CvesWithoutErrataPatchOut' /notifications: delete: @@ -3932,6 +3950,18 @@ components: type: number CvesWithoutErrataOut: + type: object + properties: + cves_without_errata: + type: object + properties: + enabled: + type: boolean + required: + - cves_without_errata + - org_id + + CvesWithoutErrataPatchOut: type: object properties: updated: diff --git a/manager/feature_handler.py b/manager/feature_handler.py index ecf80d249..de36a5fc7 100644 --- a/manager/feature_handler.py +++ b/manager/feature_handler.py @@ -7,6 +7,7 @@ from common.peewee_model import RHAccount from manager.base import ApplicationException from manager.base import DeleteRequest +from manager.base import GetRequest from manager.base import PatchRequest from manager.base import get_account_data from manager.rbac_manager import RbacManager as RBAC @@ -28,6 +29,19 @@ def handle_patch(cls, **kwargs): return {"updated": {"org_id": org_id, "cves_without_errata": {"enabled": enable}}} +class GetCvesWithoutErrata(GetRequest): + """GET to /feature/cves_without_errata""" + + _endpoint_name = r"/v1/feature/cves_without_errata" + + @classmethod + def handle_get(cls, **kwargs): + """Get cves_without_errata DB flag for account.""" + org_id = context.context["user"]["org_id"] + result = RHAccount.get(RHAccount.org_id == org_id) + return {"cves_without_errata": {"enabled": result.cves_without_errata}, "org_id": result.org_id} + + class DeleteNotifications(DeleteRequest): """DELETE to /notifications""" From 47845b975eb4d36cd285d45b5d8c623ae70d9351 Mon Sep 17 00:00:00 2001 From: Petr Freyburg Date: Thu, 10 Sep 2026 14:04:34 +0200 Subject: [PATCH 2/5] fix: cves-without-errata error 500 when RHAccount doesn't exist --- manager/feature_handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manager/feature_handler.py b/manager/feature_handler.py index de36a5fc7..f8bfc0fd0 100644 --- a/manager/feature_handler.py +++ b/manager/feature_handler.py @@ -38,8 +38,11 @@ class GetCvesWithoutErrata(GetRequest): def handle_get(cls, **kwargs): """Get cves_without_errata DB flag for account.""" org_id = context.context["user"]["org_id"] - result = RHAccount.get(RHAccount.org_id == org_id) - return {"cves_without_errata": {"enabled": result.cves_without_errata}, "org_id": result.org_id} + result = RHAccount.get_or_none(RHAccount.org_id == org_id) + cves_without_errata = True + if result != None: + cves_without_errata = result.cves_without_errata + return {"cves_without_errata": {"enabled": cves_without_errata}, "org_id": result.org_id} class DeleteNotifications(DeleteRequest): From 41bc70e61258a75f2da63c3a4910da52daf29fe5 Mon Sep 17 00:00:00 2001 From: Petr Freyburg Date: Thu, 10 Sep 2026 14:12:27 +0200 Subject: [PATCH 3/5] Revert "fix: cves-without-errata error 500 when RHAccount doesn't exist" This reverts commit 47845b975eb4d36cd285d45b5d8c623ae70d9351. --- manager/feature_handler.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/manager/feature_handler.py b/manager/feature_handler.py index f8bfc0fd0..de36a5fc7 100644 --- a/manager/feature_handler.py +++ b/manager/feature_handler.py @@ -38,11 +38,8 @@ class GetCvesWithoutErrata(GetRequest): def handle_get(cls, **kwargs): """Get cves_without_errata DB flag for account.""" org_id = context.context["user"]["org_id"] - result = RHAccount.get_or_none(RHAccount.org_id == org_id) - cves_without_errata = True - if result != None: - cves_without_errata = result.cves_without_errata - return {"cves_without_errata": {"enabled": cves_without_errata}, "org_id": result.org_id} + result = RHAccount.get(RHAccount.org_id == org_id) + return {"cves_without_errata": {"enabled": result.cves_without_errata}, "org_id": result.org_id} class DeleteNotifications(DeleteRequest): From adc655499c4b7af2368b12ac6ff7d5b7a20fe878 Mon Sep 17 00:00:00 2001 From: Petr Freyburg Date: Thu, 10 Sep 2026 14:04:34 +0200 Subject: [PATCH 4/5] fix: cves-without-errata error 500 when RHAccount doesn't exist --- manager/feature_handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manager/feature_handler.py b/manager/feature_handler.py index de36a5fc7..4a30edc4b 100644 --- a/manager/feature_handler.py +++ b/manager/feature_handler.py @@ -38,8 +38,11 @@ class GetCvesWithoutErrata(GetRequest): def handle_get(cls, **kwargs): """Get cves_without_errata DB flag for account.""" org_id = context.context["user"]["org_id"] - result = RHAccount.get(RHAccount.org_id == org_id) - return {"cves_without_errata": {"enabled": result.cves_without_errata}, "org_id": result.org_id} + result = RHAccount.get_or_none(RHAccount.org_id == org_id) + cves_without_errata = True + if result is not None: + cves_without_errata = result.cves_without_errata + return {"cves_without_errata": {"enabled": cves_without_errata}, "org_id": result.org_id} class DeleteNotifications(DeleteRequest): From 638f308695a4ff6976978be93218f4f9f889a3c6 Mon Sep 17 00:00:00 2001 From: Petr Freyburg Date: Thu, 10 Sep 2026 15:44:10 +0200 Subject: [PATCH 5/5] fix: cves-without-errata error 500 when RHAccount doesn't exist --- manager/feature_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manager/feature_handler.py b/manager/feature_handler.py index 4a30edc4b..a6cc0af0b 100644 --- a/manager/feature_handler.py +++ b/manager/feature_handler.py @@ -42,7 +42,7 @@ def handle_get(cls, **kwargs): cves_without_errata = True if result is not None: cves_without_errata = result.cves_without_errata - return {"cves_without_errata": {"enabled": cves_without_errata}, "org_id": result.org_id} + return {"cves_without_errata": {"enabled": cves_without_errata}, "org_id": org_id} class DeleteNotifications(DeleteRequest):