Skip to content

Commit

Permalink
filters out identity pairs where val is none or empty string (#1907)
Browse files Browse the repository at this point in the history
  • Loading branch information
eastandwestwind authored Nov 30, 2022
1 parent bc793df commit 4261f82
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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

Expand Down
2 changes: 1 addition & 1 deletion src/fides/api/ops/models/privacy_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion src/fides/api/ops/service/connectors/saas_query_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 4261f82

Please sign in to comment.