From nobody Thu May 11 04:02:27 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 4QGysJ0rfXz49bXk; Thu, 11 May 2023 04:02:28 +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 4QGysJ0M1fz47Bj; Thu, 11 May 2023 04:02:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683777748; 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=U0oDm34O5AXCq5u4acRNvpHw65YTQqKszE4h2aa4gkY=; b=TLr7tSaXSgkI9vnP5D7SxF/nCqA8Fmznw2b6UhDMuIvc5BL1ka+7wRg7GgNxVLpnwbrFp3 +QCScEcEmPzbbHWrVErNcWE/bzzioeN9ZIlTha5C90ict/Y1+RkRrr15vMcdJhZlVJi3Hr sPgCrED7kSvtoNhrLVYdkKG3a0LUcwTMfDnd5T4RxfccUQ/LO6tNFbSgZDwM5JQXHjqcei w18mXrXA/8OfdzT/9wBtRtZsNdizHBOWZaN+z7E2m/KnBnzAL3YXW+ZxbyivlyMWcCY6ry F6dwPBxtOo2e0JofmnEYYOIdvWTjVcmNNnvjQcs4xWaPtUfPIsjWye1UpR3kcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683777748; 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=U0oDm34O5AXCq5u4acRNvpHw65YTQqKszE4h2aa4gkY=; b=QpTA338il5B3ePzi6qZsf0c9jOXgV1FRGYu7GiGx9Zu/3U7cFmB9aUe+jK8BIxGGjtFTK6 gQxtdYrK/3aeArjsuHyEzBmLcOPOyyfnMJ7qEq/XEgjweNYAWy5qIUY0yxCV4BcF5etnmk xdoaqLeFWovx7HHBGPl7W6YV9D3iGVda323rFptVzdyPLMSNBgGnzqgDwieKcPi+U7/Oy5 sGl6xNhS/5lxqCi5L36J3wcbfT02HSVaDQlE2OfkpyrY3woCBBZj/q218djCA5J87lOeCm XsuJaSBZdiErnRyHTapQBpTc2Rgt2zbwF7yUcThn8pU+YMS97hs3prEikvF8tQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683777748; a=rsa-sha256; cv=none; b=xW7QDRX4srLPKZjIRpLVTKYH5vfetL2Vk34Jlvnaws7T/PKkX7Vmzu+cEkbenMuQ/w5EBv voegFm130YsYGygA77bPFxB4hx8IprFLu37EPBSQMb4567oq3SLLH7JNzEpTfNj0VARBWJ xMU5S0P8hL5A2K3JXh+D809WJ5PsBEBkVJMxIlHjpAZpCFBr+HSTVbUBRPFtofQ9mjvuDh frlEvwPT8f3ji1COusqJzmPxy7+0qTnRelOB2Ribm0HhM9oyMaDbbQRycssz3rU4r16D52 Wn7iXYdaMosIpUAktr6R1uDHGxFerVKVmG0psk3puc8DZ21/ZklaaEvmSHsrsw== 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 4QGysH6LV9zd85; Thu, 11 May 2023 04:02:27 +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 34B42RaG036608; Thu, 11 May 2023 04:02:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34B42RYx036607; Thu, 11 May 2023 04:02:27 GMT (envelope-from git) Date: Thu, 11 May 2023 04:02:27 GMT Message-Id: <202305110402.34B42RYx036607@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Kai Knoblich Subject: git: 53edd11f9dac - main - security/py-netbox-secretstore: Backport patches and deprecate List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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/main X-Git-Reftype: branch X-Git-Commit: 53edd11f9dac25ba3053108406373e6a0550f551 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kai: URL: https://cgit.FreeBSD.org/ports/commit/?id=53edd11f9dac25ba3053108406373e6a0550f551 commit 53edd11f9dac25ba3053108406373e6a0550f551 Author: Kai Knoblich AuthorDate: 2023-05-11 03:40:40 +0000 Commit: Kai Knoblich CommitDate: 2023-05-11 03:42:04 +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) --- 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 +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 +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 +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} {escape(secret)}' +- 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} {escape(secret)}' ++ 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: < 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 +} ]