From 0902ee98cc8e431c9a99d8ff2e19f5e609a35b85 Mon Sep 17 00:00:00 2001 From: eastandwestwind Date: Wed, 30 Nov 2022 10:44:47 -0600 Subject: [PATCH 1/3] filters out identity pairs where val is none or empty string --- src/fides/api/ops/models/privacy_request.py | 2 +- src/fides/api/ops/service/connectors/saas_query_config.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fides/api/ops/models/privacy_request.py b/src/fides/api/ops/models/privacy_request.py index c4f2221acd..906d18ff7a 100644 --- a/src/fides/api/ops/models/privacy_request.py +++ b/src/fides/api/ops/models/privacy_request.py @@ -281,7 +281,7 @@ def persist_identity(self, db: Session, identity: Identity) -> None: """ identity_dict: Dict[str, Any] = dict(identity) for key, value in identity_dict.items(): - if value is not None: + if value: hashed_value = ProvidedIdentity.hash_value(value) ProvidedIdentity.create( db=db, diff --git a/src/fides/api/ops/service/connectors/saas_query_config.py b/src/fides/api/ops/service/connectors/saas_query_config.py index 938ae0b138..db0646ad0a 100644 --- a/src/fides/api/ops/service/connectors/saas_query_config.py +++ b/src/fides/api/ops/service/connectors/saas_query_config.py @@ -203,7 +203,11 @@ def _get_identity(self) -> Optional[str]: identities: List[str] = [] if self.privacy_request: - identities = list(self.privacy_request.get_cached_identity_data().keys()) + identity_data: Dict[ + str, Any + ] = self.privacy_request.get_cached_identity_data() + # filters out keys where associated value is None or empty str + identities = list({k for k, v in identity_data.items() if v}) if len(identities) > 1: raise FidesopsException( "Only one identity can be specified for SaaS connector traversal" From 7e03fb56f19b4d70335de842d1c00ab0c2c2d966 Mon Sep 17 00:00:00 2001 From: eastandwestwind Date: Wed, 30 Nov 2022 10:49:00 -0600 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba870fd6cb..e49b0dcd5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ The types of changes are: ### Fixed * Fix error in parent user creation seeding. [#1832](https://github.com/ethyca/fides/issues/1832) +* Fix DSR error due to unfiltered empty identities [#1901] (https://github.com/ethyca/fides/pull/1907) ### Docs From 126ca75fb0fe744bd802c8d0075ab14bf877f746 Mon Sep 17 00:00:00 2001 From: eastandwestwind Date: Wed, 30 Nov 2022 11:07:28 -0600 Subject: [PATCH 3/3] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e49b0dcd5c..0378b2bca1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,7 @@ The types of changes are: ### Fixed * Fix error in parent user creation seeding. [#1832](https://github.com/ethyca/fides/issues/1832) -* Fix DSR error due to unfiltered empty identities [#1901] (https://github.com/ethyca/fides/pull/1907) +* Fix DSR error due to unfiltered empty identities [#1901](https://github.com/ethyca/fides/pull/1907) ### Docs