git: 2a391a1b50df - main - security/py-netbox-secrets: Backport two upstream PRs

From: Kai Knoblich <kai_at_FreeBSD.org>
Date: Wed, 18 Mar 2026 10:30:10 UTC
The branch main has been updated by kai:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2a391a1b50dfc2b5adf06ea79ff387cd123b1448

commit 2a391a1b50dfc2b5adf06ea79ff387cd123b1448
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2026-03-18 10:27:43 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2026-03-18 10:27:43 +0000

    security/py-netbox-secrets: Backport two upstream PRs
    
    * One patch fixes warning sthat occur during the generation of API
      schemas, which prevent access to the REST API documentation:
    
    [...]
    /usr/local/lib/python3.11/site-packages/netbox_secrets/graphql/filters.py:40: UserWarning: FilterLookup[str] may cause DuplicatedTypeName errors. Use StrFilterLookup instead.
      name: FilterLookup[str] | None = strawberry_django.filter_field()
    [...]
    
    * The other patch also resolves several DuplicatedNameType errors
      that trigger exceptions which make the NetBox instance unusable:
    
    [...]
      File "/usr/local/lib/python3.11/site-packages/strawberry/schema/schema_converter.py", line 503, in from_input_object
        self.validate_same_type_definition(type_name, type_definition, cached_type)
      File "/usr/local/lib/python3.11/site-packages/strawberry/schema/schema_converter.py", line 1040, in validate_same_type_definition
        raise DuplicatedTypeName(first_origin, second_origin, name)
    strawberry.exceptions.duplicated_type_name.DuplicatedTypeName: Type StrFilterLookup is defined multiple times in the schema
    [...]
    
    * Bump PORTREVISION due changed package content.
---
 security/py-netbox-secrets/Makefile                |  1 +
 .../files/patch-netbox__secrets_api_views.py       | 55 ++++++++++++++++++++++
 .../files/patch-netbox__secrets_graphql_filters.py | 30 ++++++++++++
 3 files changed, 86 insertions(+)

diff --git a/security/py-netbox-secrets/Makefile b/security/py-netbox-secrets/Makefile
index a20a46ba97e4..15a7f8ec7100 100644
--- a/security/py-netbox-secrets/Makefile
+++ b/security/py-netbox-secrets/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	netbox-secrets
 DISTVERSION=	3.0.0
+PORTREVISION=	1
 CATEGORIES=	security python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/security/py-netbox-secrets/files/patch-netbox__secrets_api_views.py b/security/py-netbox-secrets/files/patch-netbox__secrets_api_views.py
new file mode 100644
index 000000000000..bf80f2407895
--- /dev/null
+++ b/security/py-netbox-secrets/files/patch-netbox__secrets_api_views.py
@@ -0,0 +1,55 @@
+Fix API schema error caused by LegacyActivateUserKeyViewSet
+
+Obtained from:
+
+https://github.com/Onemind-Services-LLC/netbox-secrets/pull/241
+
+--- netbox_secrets/api/views.py.orig	2026-03-18 08:56:30 UTC
++++ netbox_secrets/api/views.py
+@@ -725,6 +725,46 @@ class LegacyActivateUserKeyViewSet(ViewSet):
+     permission_classes = [IsAuthenticated]
+     serializer_class = serializers.ActivateUserKeySerializer
+ 
++    @extend_schema(
++        request=serializers.ActivateUserKeySerializer,
++        responses={
++            200: OpenApiResponse(
++                response=OpenApiTypes.STR,
++                description="Plain-text success message.",
++                examples=[
++                    OpenApiExample(
++                        "Success",
++                        value="Successfully activated 2 user keys.",
++                    )
++                ],
++            ),
++            400: OpenApiResponse(
++                description="Bad request or validation error.",
++                response=OpenApiTypes.OBJECT,
++                examples=[
++                    OpenApiExample(
++                        "Validation error",
++                        value={"user_key_ids": ["This field is required."]},
++                    ),
++                    OpenApiExample(
++                        "Legacy error message",
++                        value={"detail": ERR_NO_KEYS_PROVIDED},
++                    ),
++                ],
++            ),
++            403: OpenApiResponse(
++                response=OpenApiTypes.STR,
++                description="Permission denied.",
++                examples=[
++                    OpenApiExample(
++                        "Permission denied",
++                        value="You do not have permission to active User Keys.",
++                    )
++                ],
++            ),
++        },
++        deprecated=True,
++    )
+     def create(self, request):
+         """
+         Activate one or more user keys using the caller's private key.
diff --git a/security/py-netbox-secrets/files/patch-netbox__secrets_graphql_filters.py b/security/py-netbox-secrets/files/patch-netbox__secrets_graphql_filters.py
new file mode 100644
index 000000000000..90dffb5d66e1
--- /dev/null
+++ b/security/py-netbox-secrets/files/patch-netbox__secrets_graphql_filters.py
@@ -0,0 +1,30 @@
+Fixes following warnings/exceptions:
+
+UserWarning: FilterLookup[str] may cause DuplicatedTypeName errors. Use StrFilterLookup instead
+
+Obtained from:
+
+https://github.com/Onemind-Services-LLC/netbox-secrets/pull/239
+
+--- netbox_secrets/graphql/filters.py.orig	2026-03-18 09:11:43 UTC
++++ netbox_secrets/graphql/filters.py
+@@ -3,7 +3,7 @@ from strawberry.scalars import ID
+ import strawberry
+ import strawberry_django
+ from strawberry.scalars import ID
+-from strawberry_django import FilterLookup
++from strawberry_django import StrFilterLookup
+ 
+ from netbox.graphql.filters import (
+     OrganizationalModelFilter,
+@@ -36,8 +36,8 @@ class SecretRoleFilter(OrganizationalModelFilter):
+ 
+ 
+ @strawberry_django.filter_type(Secret, lookups=True)
+-class SecretFilter(ContactFilterMixin, PrimaryModelFilter):
+-    name: FilterLookup[str] | None = strawberry_django.filter_field()
++class SecretFilter(PrimaryModelFilter, ContactFilterMixin):
++    name: StrFilterLookup[str] | None = strawberry_django.filter_field()
+     role: Annotated[
+         'SecretRoleFilter', strawberry.lazy('netbox_secrets.graphql.filters')
+     ] | None = strawberry_django.filter_field()