From dd520dd5f7226d012f7af263def5a3dba670a6fd Mon Sep 17 00:00:00 2001 From: jguz-pubnub Date: Fri, 23 Oct 2026 14:01:59 +0200 Subject: [PATCH 1/3] fix(grant): reject uuids combined with channels or groups Grant validation only failed when channels, groups and uuids were all set. --- pubnub/endpoints/access/grant.py | 2 +- tests/functional/test_grant.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pubnub/endpoints/access/grant.py b/pubnub/endpoints/access/grant.py index 9209ad37..126decb6 100644 --- a/pubnub/endpoints/access/grant.py +++ b/pubnub/endpoints/access/grant.py @@ -149,7 +149,7 @@ def validate_params(self): self.validate_publish_key() # self.validate_channels_and_groups() - if self._channels and self._groups and self._uuids: + if self._uuids and (self._channels or self._groups): raise PubNubException( pn_error=PNERR_PAM_INVALID_ARGUMENTS, errormsg="Grants for channels or channelGroups can't be changed together with grants for UUIDs") diff --git a/tests/functional/test_grant.py b/tests/functional/test_grant.py index 2638273c..6fab015e 100644 --- a/tests/functional/test_grant.py +++ b/tests/functional/test_grant.py @@ -162,3 +162,25 @@ def test_category_one_minute_grant_rejected(self): def test_category_one_minute_revoke_allowed(self): self.grant.auth_keys('a').categories(['channels']).get(False).ttl(1).validate_params() + + +class TestGrantUuidCombinationValidation(unittest.TestCase): + def setUp(self): + self.pubnub = MagicMock(spec=PubNub, config=pnconf_pam, sdk_name=sdk_name, + timestamp=MagicMock(return_value=123), uuid=None) + self.pubnub.uuid = "UUID_GrantUnitTest" + self.grant = Grant(self.pubnub) + + def test_uuids_with_channels_rejected(self): + with self.assertRaises(PubNubException): + self.grant.auth_keys('a').uuids(['u']).channels(['c']).get(True).validate_params() + + def test_uuids_with_groups_rejected(self): + with self.assertRaises(PubNubException): + self.grant.auth_keys('a').uuids(['u']).channel_groups(['g']).get(True).validate_params() + + def test_uuids_only_allowed(self): + self.grant.auth_keys('a').uuids(['u']).get(True).validate_params() + + def test_uuids_with_category_allowed(self): + self.grant.auth_keys('a').uuids(['u']).categories(['channels']).get(True).validate_params() From 0bfec5fe9c72031eac3fab042d0cf50854137c17 Mon Sep 17 00:00:00 2001 From: jguz-pubnub Date: Mon, 26 Oct 2026 14:38:40 +0100 Subject: [PATCH 2/3] test_grant.py --- tests/functional/test_grant.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tests/functional/test_grant.py b/tests/functional/test_grant.py index 6fab015e..2638273c 100644 --- a/tests/functional/test_grant.py +++ b/tests/functional/test_grant.py @@ -162,25 +162,3 @@ def test_category_one_minute_grant_rejected(self): def test_category_one_minute_revoke_allowed(self): self.grant.auth_keys('a').categories(['channels']).get(False).ttl(1).validate_params() - - -class TestGrantUuidCombinationValidation(unittest.TestCase): - def setUp(self): - self.pubnub = MagicMock(spec=PubNub, config=pnconf_pam, sdk_name=sdk_name, - timestamp=MagicMock(return_value=123), uuid=None) - self.pubnub.uuid = "UUID_GrantUnitTest" - self.grant = Grant(self.pubnub) - - def test_uuids_with_channels_rejected(self): - with self.assertRaises(PubNubException): - self.grant.auth_keys('a').uuids(['u']).channels(['c']).get(True).validate_params() - - def test_uuids_with_groups_rejected(self): - with self.assertRaises(PubNubException): - self.grant.auth_keys('a').uuids(['u']).channel_groups(['g']).get(True).validate_params() - - def test_uuids_only_allowed(self): - self.grant.auth_keys('a').uuids(['u']).get(True).validate_params() - - def test_uuids_with_category_allowed(self): - self.grant.auth_keys('a').uuids(['u']).categories(['channels']).get(True).validate_params() From 2f99d11192f50e04be2b9e2aa2fb445dfcc118ea Mon Sep 17 00:00:00 2001 From: PubNub Release Bot <120067856+pubnub-release-bot@users.noreply.github.com> Date: Mon, 26 Oct 2026 16:23:17 +0000 Subject: [PATCH 3/3] PubNub SDK 10.8.1 release. --- .pubnub.yml | 13 +++++++++---- CHANGELOG.md | 6 ++++++ setup.py | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.pubnub.yml b/.pubnub.yml index 1280e81c..56dffe48 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,5 +1,5 @@ name: python -version: 10.8.0 +version: 10.8.1 schema: 1 scm: github.com/pubnub/python sdks: @@ -18,7 +18,7 @@ sdks: distributions: - distribution-type: library distribution-repository: package - package-name: pubnub-10.8.0 + package-name: pubnub-10.8.1 location: https://pypi.org/project/pubnub/ supported-platforms: supported-operating-systems: @@ -94,8 +94,8 @@ sdks: - distribution-type: library distribution-repository: git release - package-name: pubnub-10.8.0 - location: https://github.com/pubnub/python/releases/download/10.8.0/pubnub-10.8.0.tar.gz + package-name: pubnub-10.8.1 + location: https://github.com/pubnub/python/releases/download/10.8.1/pubnub-10.8.1.tar.gz supported-platforms: supported-operating-systems: Linux: @@ -169,6 +169,11 @@ sdks: license-url: https://github.com/encode/httpx/blob/master/LICENSE.md is-required: Required changelog: + - date: 2026-10-26 + version: 10.8.1 + changes: + - type: bug + text: "Reject uuids combined with channels or groups (grant-v2)." - date: 2026-10-19 version: 10.8.0 changes: diff --git a/CHANGELOG.md b/CHANGELOG.md index d9d08092..d3884a06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 10.8.1 +October 26 2026 + +#### Fixed +- Reject uuids combined with channels or groups (grant-v2). + ## 10.8.0 October 19 2026 diff --git a/setup.py b/setup.py index 3646bd31..c3be7e7c 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='pubnub', - version='10.8.0', + version='10.8.1', description='PubNub Real-time push service in the cloud', author='PubNub', author_email='support@pubnub.com',