From nobody Sun Jun  4 07:07:53 2023
X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QYnr95CT6z4Ym7Z;
	Sun,  4 Jun 2023 07:07:53 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4QYnr93jQYz483Y;
	Sun,  4 Jun 2023 07:07:53 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1685862473;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=DwU1SBBuPAStURRnehSMhMGdzvZzfEnY69Xmd1B6t1I=;
	b=u83Q0xSWqEoujNM4/SAbbqi79+2CARzfk9cU+isVDwG/+5WnQ5pgdSPy2adW/RcTFz7xJm
	h+DVywdCEMeimkwDKV+gbQ4OO9ZBJq7XhE8hAYQwqmdv4+drMDV1WzQ58pp+oeIpPjxe/9
	q0NuWBeVTcD65LUgqK6JMo2WHzEOQGMeQ1Im4L3d0umQEH8fXco+rfS/X+0DBGy4YpNgrU
	Xdp/ON0o/yepZHLTkuvSY6GVegRl/1TOn1bucGQc7g9SMXE7HSpuKJbecBeSLbaM1tqwkh
	6n9cIiS4zScIzL4FIduokPejVDxFsy5wQ69ogdI3omWU5UZCAUTLQGV95kTV9w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1685862473;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=DwU1SBBuPAStURRnehSMhMGdzvZzfEnY69Xmd1B6t1I=;
	b=WtzKBih0TxgfmXnotPdA2rgRIi9A+PjbmZlb1s/17UfDH7MmpgsA6nS0Cr3rKn//xNz/ik
	RlXG0/+nMfQbzMWSFuCEksriddkvFo3PYp6GHKWSy/DOYyO5zcRt5nif2UYGCnU4GRIDL2
	mjC6iD2TdU7Wz2vaXf4aMMzVbUD4+Y8iyIONP6lIOi5bKmri8QBF5K2SNOI/PVQi5+x5eF
	bxTQjiQaJxSuv0gr8nJ3hL4auedL1q0blqFPqiXGBM7MaEjd8n3lzVGYM5zFXUFfhjV4br
	izL/zxKHaRJq4QoN2KQR+TiCqjE7m6eVRteIUXHQPh0cxkiRpsK6UsXu9vNtPw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685862473; a=rsa-sha256; cv=none;
	b=y2SJIam+XW1jrWlHfXVOhpcvFgJsKQrsdNUwOdXkArJvCqussPBIA7qhYaDoewizBJpMuI
	lmZnlMIiQfmQeJ7nvF2N88adwoI/EspTL7ZMH2NavPJBhJkDAOLNTv9a3A4BhXOXnIqv2E
	T0ac5xi6qV15d09FkYbmSNQQOrwK/9n3Yb8WpJnZCHZA8DM6ID2+CxwwOi/C7ANASasziH
	oVcAhnom5k86SQ12RZM3ZLxud8JvebeS8vsE3MQzbK0gu2i7iZPgScBNLRCncloGQ3Gv9m
	EhKX6f/3VFGbobuWWfGV+qzwI7hRAW46HxQ9tG9d6aSzSYFJ9y9pYWZSSDyg7Q==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QYnr92ccqzxGY;
	Sun,  4 Jun 2023 07:07:53 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35477rBN004589;
	Sun, 4 Jun 2023 07:07:53 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35477rvA004588;
	Sun, 4 Jun 2023 07:07:53 GMT
	(envelope-from git)
Date: Sun, 4 Jun 2023 07:07:53 GMT
Message-Id: <202306040707.35477rvA004588@gitrepo.freebsd.org>
To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org,
        dev-commits-ports-branches@FreeBSD.org
From: Kai Knoblich <kai@FreeBSD.org>
Subject: git: 4d4ba5031e4c - 2023Q2 - security/py-netbox-secretstore: Backport patches and deprecate
List-Id: Commit messages for all branches of the ports repository <dev-commits-ports-all.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all
List-Help: <mailto:dev-commits-ports-all+help@freebsd.org>
List-Post: <mailto:dev-commits-ports-all@freebsd.org>
List-Subscribe: <mailto:dev-commits-ports-all+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-ports-all+unsubscribe@freebsd.org>
Sender: owner-dev-commits-ports-all@freebsd.org
X-BeenThere: dev-commits-ports-all@freebsd.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kai
X-Git-Repository: ports
X-Git-Refname: refs/heads/2023Q2
X-Git-Reftype: branch
X-Git-Commit: 4d4ba5031e4cfbc0d1c1b54d25b9a728e8a621ba
Auto-Submitted: auto-generated
X-ThisMailContainsUnwantedMimeParts: N

The branch 2023Q2 has been updated by kai:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4d4ba5031e4cfbc0d1c1b54d25b9a728e8a621ba

commit 4d4ba5031e4cfbc0d1c1b54d25b9a728e8a621ba
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2023-05-11 03:40:40 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2023-06-04 06:54:32 +0000

    security/py-netbox-secretstore: Backport patches and deprecate
    
    * Backport a patch of the upstream repository that fixes an issue with
      bulk updates for M2M (= many-to-many) operations.
    
    * Add patches from the py-netbox-secrets repository as well which are
      required to migrate to the py-netbox-secrets plugin.
    
    * Also give some advice how to migrate to the py-netbox-secrets plugin.
    
    * Deprecate and set and an expiration date because upstream no longer
      maintains py-netbox-secretstore which is in its current state not
      compatible with newer releases of NetBox.
    
    * Bump PORTREVISION due package change and to give users a heads-up that
      the plugin is deprecated.
    
    MFH:            2023Q2 (in 3 weeks)
    (cherry picked from commit 53edd11f9dac25ba3053108406373e6a0550f551)
---
 security/py-netbox-secretstore/Makefile            |  5 +-
 ...lter__secret__custom__field__data__and__more.py | 45 ++++++++++++++----
 .../patch-netbox__secretstore_models_secrets.py    | 51 +++++++++++++++++++++
 .../files/patch-netbox__secretstore_views.py       | 33 ++++++++++++++
 .../py-netbox-secretstore/files/pkg-message.in     | 53 ++++++++++++++++++++++
 5 files changed, 176 insertions(+), 11 deletions(-)

diff --git a/security/py-netbox-secretstore/Makefile b/security/py-netbox-secretstore/Makefile
index 6aeed0a86090..aad6bdf31053 100644
--- a/security/py-netbox-secretstore/Makefile
+++ b/security/py-netbox-secretstore/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	netbox-secretstore
 DISTVERSION=	1.4.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	security python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -12,6 +12,9 @@ WWW=		https://github.com/dansheps/netbox-secretstore
 LICENSE=	APACHE20
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
+DEPRECATED=	No longer maintained by upstream, not compatible with NetBox 3.5, please migrate to security/py-netbox-secrets
+EXPIRATION_DATE=	2023-08-15
+
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}importlib-metadata>0:devel/py-importlib-metadata@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pycryptodome>0:security/py-pycryptodome@${PY_FLAVOR}
 
diff --git a/security/py-netbox-secretstore/files/patch-netbox__secretstore_migrations_0006__alter__secret__custom__field__data__and__more.py b/security/py-netbox-secretstore/files/patch-netbox__secretstore_migrations_0006__alter__secret__custom__field__data__and__more.py
index ba6e41dd0b31..4da31820f74e 100644
--- a/security/py-netbox-secretstore/files/patch-netbox__secretstore_migrations_0006__alter__secret__custom__field__data__and__more.py
+++ b/security/py-netbox-secretstore/files/patch-netbox__secretstore_migrations_0006__alter__secret__custom__field__data__and__more.py
@@ -6,30 +6,55 @@ Obtained from:
 
 https://github.com/DanSheps/netbox-secretstore/commit/9c3f69e5af6f5e8d6af11f5c8ea41433ef51145c
 
---- netbox_secretstore/migrations/0006_alter_secret_custom_field_data_and_more.py.orig	2023-03-16 06:29:56 UTC
+From: Abhimanyu Saharan <desk.abhimanyu@gmail.com>
+Date: Wed, 12 Apr 2023 21:01:43 +0530
+Subject: [PATCH] fix migrations
+
+Obtained from:
+
+https://github.com/Onemind-Services-LLC/netbox-secretstore/commit/248330409413f1858daf13902fd1b409053fd846.patch
+
+--- netbox_secretstore/migrations/0006_alter_secret_custom_field_data_and_more.py.orig	2023-05-08 17:51:21 UTC
 +++ netbox_secretstore/migrations/0006_alter_secret_custom_field_data_and_more.py
-@@ -0,0 +1,24 @@
-+# Generated by Django 4.1.4 on 2023-01-24 19:50
+@@ -0,0 +1,41 @@
++# Generated by Django 4.1.7 on 2023-04-12 15:31
 +
++from django.conf import settings
 +from django.db import migrations, models
++import django.db.models.deletion
 +import utilities.json
 +
 +
 +class Migration(migrations.Migration):
 +
 +    dependencies = [
-+        ('netbox_secretstore', '0005_alter_secret_created_alter_secret_id_and_more'),
++        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
++        ("netbox_secretstore", "0005_alter_secret_created_alter_secret_id_and_more"),
 +    ]
 +
 +    operations = [
 +        migrations.AlterField(
-+            model_name='secret',
-+            name='custom_field_data',
-+            field=models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder),
++            model_name="secret",
++            name="custom_field_data",
++            field=models.JSONField(
++                blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder
++            ),
++        ),
++        migrations.AlterField(
++            model_name="secretrole",
++            name="custom_field_data",
++            field=models.JSONField(
++                blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder
++            ),
 +        ),
 +        migrations.AlterField(
-+            model_name='secretrole',
-+            name='custom_field_data',
-+            field=models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder),
++            model_name="userkey",
++            name="user",
++            field=models.OneToOneField(
++                editable=False,
++                on_delete=django.db.models.deletion.CASCADE,
++                related_name="user_key_secretstore",
++                to=settings.AUTH_USER_MODEL,
++            ),
 +        ),
 +    ]
diff --git a/security/py-netbox-secretstore/files/patch-netbox__secretstore_models_secrets.py b/security/py-netbox-secretstore/files/patch-netbox__secretstore_models_secrets.py
new file mode 100644
index 000000000000..af682f8b802a
--- /dev/null
+++ b/security/py-netbox-secretstore/files/patch-netbox__secretstore_models_secrets.py
@@ -0,0 +1,51 @@
+From: Abhimanyu Saharan <desk.abhimanyu@gmail.com>
+Date: Wed, 12 Apr 2023 21:01:43 +0530
+Subject: [PATCH] fix migrations
+
+Obtained from:
+
+https://github.com/Onemind-Services-LLC/netbox-secretstore/commit/248330409413f1858daf13902fd1b409053fd846.patch
+
+--- netbox_secretstore/models/secrets.py.orig	2022-12-31 01:50:00 UTC
++++ netbox_secretstore/models/secrets.py
+@@ -21,6 +21,7 @@ from netbox_secretstore.utils import encrypt_master_ke
+ from netbox_secretstore.hashers import SecretValidationHasher
+ from netbox_secretstore.querysets import UserKeyQuerySet
+ from netbox_secretstore.utils import encrypt_master_key, decrypt_master_key, generate_random_key
++from taggit.managers import TaggableManager
+ 
+ 
+ __all__ = (
+@@ -47,7 +48,7 @@ class UserKey(models.Model):
+     user = models.OneToOneField(
+         to=User,
+         on_delete=models.CASCADE,
+-        related_name='user_key',
++        related_name='user_key_secretstore',
+         editable=False
+     )
+     public_key = models.TextField(
+@@ -256,6 +257,11 @@ class SecretRole(OrganizationalModel):
+         blank=True,
+     )
+ 
++    tags = TaggableManager(
++        through='extras.TaggedItem',
++        related_name='netbox_secretstore_secretroles'
++    )
++
+     objects = RestrictedQuerySet.as_manager()
+ 
+     csv_headers = ['name', 'slug', 'description']
+@@ -312,6 +318,11 @@ class Secret(NetBoxModel):
+     hash = models.CharField(
+         max_length=128,
+         editable=False
++    )
++
++    tags = TaggableManager(
++        through='extras.TaggedItem',
++        related_name='netbox_secretstore_secret'
+     )
+ 
+     objects = RestrictedQuerySet.as_manager()
diff --git a/security/py-netbox-secretstore/files/patch-netbox__secretstore_views.py b/security/py-netbox-secretstore/files/patch-netbox__secretstore_views.py
new file mode 100644
index 000000000000..b9f12b55e322
--- /dev/null
+++ b/security/py-netbox-secretstore/files/patch-netbox__secretstore_views.py
@@ -0,0 +1,33 @@
+From: Daniel Sheppard <dans@dansheps.com>
+Date: Tue, 11 Apr 2023 08:34:04 -0500
+Subject: [PATCH] #12087 - Fix Bulk Edit update when M2M operations are present.
+
+Obtained from:
+
+https://github.com/DanSheps/netbox-secretstore/commit/7ad1ba639aa077c45bcac05dc025132c6bd9139e.patch
+
+--- netbox_secretstore/views.py.orig	2022-12-31 01:50:00 UTC
++++ netbox_secretstore/views.py
+@@ -156,15 +156,15 @@ class SecretEditView(ObjectEditView):
+                     secret.plaintext = str(form.cleaned_data['plaintext'])
+                     secret.encrypt(master_key)
+ 
+-            secret.save()
+-            form.save_m2m()
++                    secret.save()
++                    form.save_m2m()
+ 
+-            msg = '{} secret'.format('Created' if not form.instance.pk else 'Modified')
+-            logger.info(f"{msg} {secret} (PK: {secret.pk})")
+-            msg = f'{msg} <a href="{secret.get_absolute_url()}">{escape(secret)}</a>'
+-            messages.success(request, mark_safe(msg))
++                    msg = '{} secret'.format('Created' if not form.instance.pk else 'Modified')
++                    logger.info(f"{msg} {secret} (PK: {secret.pk})")
++                    msg = f'{msg} <a href="{secret.get_absolute_url()}">{escape(secret)}</a>'
++                    messages.success(request, mark_safe(msg))
+ 
+-            return redirect(self.get_return_url(request, secret))
++                    return redirect(self.get_return_url(request, secret))
+ 
+         else:
+             logger.debug("Form validation failed")
diff --git a/security/py-netbox-secretstore/files/pkg-message.in b/security/py-netbox-secretstore/files/pkg-message.in
index 4957b1933eb1..5e2a87dc3ef3 100644
--- a/security/py-netbox-secretstore/files/pkg-message.in
+++ b/security/py-netbox-secretstore/files/pkg-message.in
@@ -54,4 +54,57 @@ EOD
 3. Restart WSGI/httpd environment (supervisord/apache/nginx/etc.)
 EOD
 }
+{ type: upgrade
+  maximum_version: 1.4.2_2
+  message: <<EOD
+Upstream no longer maintains py-netbox-secretstore which it is not compatible
+with NetBox 3.5 or newer.  To ensure compatibility with newer releases of
+NetBox, the py-netbox-secrets plugin should be used instead.
+
+To migrate from security/py-netbox-secretstore to security/py-netbox-secrets
+please do following steps:
+
+ 1. Make a backup.
+
+ 2. Install security/py-netbox-secrets
+
+ 3. Enable both plugins by updating the following line in the netbox
+    configuration (usually %%LOCALBASE%%/share/netbox/netbox/configuration.py):
+
+    PLUGINS = ['netbox_secretstore', 'netbox_secrets']
+
+ 4. Run NetBox migrations:
+
+    # cd %%LOCALBASE%%/share/netbox
+    # python%%PYTHON_VER%% manage.py migrate
+
+ 5. Re-adjust the indices for the netbox-secrets plugin:
+
+    # python%%PYTHON_VER%% manage.py sqlsequencereset netbox_secrets > output.sql
+
+ 6. Run the output of the previous command in the database, e.g.:
+
+    # psql -d NETBOXDB < output.sql
+
+ 7. You can now remove netbox-secretstore from the application by removing it
+    from the PLUGINS line in the netbox configuration:
+
+    PLUGINS = ['netbox_secrets']
+
+ 8. Collect static files of the netbox-secrets plugin:
+
+    # python%%PYTHON_VER%% manage.py collectstatic --no-input
+
+ 9. Restart WSGI/httpd environment (supervisord/apache/nginx/etc.).
+
+10. You may have clean up your database of the old tables manually, e.g.:
+
+    DROP TABLE netbox_secretstore_secret;
+    DROP TABLE netbox_secretstore_secretrole;
+    DROP TABLE netbox_secretstore_sessionkey;
+    DROP TABLE netbox_secretstore_userkey;
+
+11. Uninstall security/py-netbox-secretstore.
+EOD
+}
 ]