diff --git a/CHANGELOG.md b/CHANGELOG.md index e25a07685e..80c2e78fe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ The types of changes are: - Styling improvements for the fides.js consent banners and modals [#4222](https://github.com/ethyca/fides/pull/4222) - Changed vendor form on configuring consent page to use two-part selection for consent uses [#4251](https://github.com/ethyca/fides/pull/4251) - Vendors disclosed string is now narrowed to only the vendors shown in the UI, not the whole GVL [#4250](https://github.com/ethyca/fides/pull/4250) +- Changed naming convention "fides_string" instead of "tc_string" for developer friendly consent API's [#4267](https://github.com/ethyca/fides/pull/4267) ### Fixed - TCF overlay can initialize its consent preferences from a cookie [#4124](https://github.com/ethyca/fides/pull/4124) diff --git a/src/fides/api/api/v1/endpoints/privacy_preference_endpoints.py b/src/fides/api/api/v1/endpoints/privacy_preference_endpoints.py index 7c20b3eb33..907c2394af 100644 --- a/src/fides/api/api/v1/endpoints/privacy_preference_endpoints.py +++ b/src/fides/api/api/v1/endpoints/privacy_preference_endpoints.py @@ -332,7 +332,7 @@ def save_privacy_preferences_with_verified_identity( Creates historical records for these preferences for record keeping, and also updates current preferences. Creates a privacy request to propagate preferences to third party systems where applicable. """ - tc_string: Optional[str] = data.tc_string + fides_string: Optional[str] = data.fides_string data = update_request_with_decoded_tc_string_fields(data, db) verify_privacy_notice_and_historical_records( @@ -372,8 +372,8 @@ def save_privacy_preferences_with_verified_identity( original_request_data=data, ) ) - saved_preferences_response.tc_mobile_data = convert_tc_string_to_mobile_data( - tc_string + saved_preferences_response.fides_mobile_data = convert_tc_string_to_mobile_data( + fides_string ) return saved_preferences_response @@ -704,19 +704,19 @@ def update_request_with_decoded_tc_string_fields( request_body: PrivacyPreferencesRequest, db: Session ) -> PrivacyPreferencesRequest: """Update the request body with the decoded values of the TC string if applicable""" - if request_body.tc_string: + if request_body.fides_string: tcf_contents: TCFExperienceContents = get_tcf_contents( db ) # TODO cache this so we're not building each time privacy preference is saved try: decoded_preference_request_body: TCStringFidesPreferences = ( - decode_tc_string_to_preferences(request_body.tc_string, tcf_contents) + decode_tc_string_to_preferences(request_body.fides_string, tcf_contents) ) except DecodeTCStringError as exc: raise HTTPException(status_code=HTTP_400_BAD_REQUEST, detail=exc.args[0]) # Remove the TC string from the request body now that we've decoded it - request_body.tc_string = None + request_body.fides_string = None # Add the individual sections from the TC string to the request body for decoded_tcf_section in decoded_preference_request_body.__fields__: setattr( @@ -746,7 +746,7 @@ def save_privacy_preferences( Creates historical records for these preferences for record keeping, and also updates current preferences. Creates a privacy request to propagate preferences to third party systems if applicable. """ - tc_string: Optional[str] = data.tc_string + fides_string: Optional[str] = data.fides_string data = update_request_with_decoded_tc_string_fields(data, db) verify_privacy_notice_and_historical_records( @@ -778,8 +778,8 @@ def save_privacy_preferences( original_request_data=data, ) ) - saved_preferences_response.tc_mobile_data = convert_tc_string_to_mobile_data( - tc_string + saved_preferences_response.fides_mobile_data = convert_tc_string_to_mobile_data( + fides_string ) return saved_preferences_response diff --git a/src/fides/api/schemas/privacy_experience.py b/src/fides/api/schemas/privacy_experience.py index f25a2bfd3c..32848bc43d 100644 --- a/src/fides/api/schemas/privacy_experience.py +++ b/src/fides/api/schemas/privacy_experience.py @@ -190,16 +190,16 @@ class ExperienceMeta(FidesSchema): description="A hashed value that can be compared to previously-fetched " "hash values to determine if the Experience has meaningfully changed" ) - accept_all_tc_string: Optional[str] = Field( - description="The TC string corresponding to a user opting in to all " + accept_all_fides_string: Optional[str] = Field( + description="The fides string (TC String + AC String) corresponding to a user opting in to all " "available options" ) - accept_all_tc_mobile_data: Optional[TCMobileData] = None - reject_all_tc_string: Optional[str] = Field( - description="The TC string corresponding to a user opting out of all " + accept_all_fides_mobile_data: Optional[TCMobileData] = None + reject_all_fides_string: Optional[str] = Field( + description="The fides string (TC String + AC String) corresponding to a user opting out of all " "available options" ) - reject_all_tc_mobile_data: Optional[TCMobileData] = None + reject_all_fides_mobile_data: Optional[TCMobileData] = None class PrivacyExperienceResponse(TCFExperienceContents, PrivacyExperienceWithId): diff --git a/src/fides/api/schemas/privacy_preference.py b/src/fides/api/schemas/privacy_preference.py index 40809f9b95..f987d54d92 100644 --- a/src/fides/api/schemas/privacy_preference.py +++ b/src/fides/api/schemas/privacy_preference.py @@ -115,8 +115,8 @@ class PrivacyPreferencesRequest(TCStringFidesPreferences): browser_identity: Identity code: Optional[SafeStr] - tc_string: Optional[str] = Field( - description="If supplied, TC string is decoded and preferences saved for purpose_consent, " + fides_string: Optional[str] = Field( + description="If supplied, TC strings and AC strings are decoded and preferences saved for purpose_consent, " "purpose_legitimate_interests, vendor_consent, vendor_legitimate_interests, and special_features" ) preferences: conlist(ConsentOptionCreate, max_items=200) = [] # type: ignore @@ -151,11 +151,11 @@ def tcf_duplicates_detected(preference_list: List) -> bool: f"Duplicate preferences saved against TCF component: '{field_name}'" ) - if values.get("tc_string"): + if values.get("fides_string"): for field in TCStringFidesPreferences.__fields__: if values.get(field): raise ValueError( - f"Cannot supply value for '{field}' and 'tc_string' simultaneously when saving privacy preferences." + f"Cannot supply value for '{field}' and 'fides_string' simultaneously when saving privacy preferences." ) return values @@ -334,7 +334,7 @@ class SavePrivacyPreferencesResponse(FidesSchema): special_feature_preferences: List[CurrentPrivacyPreferenceSchema] = [] system_consent_preferences: List[CurrentPrivacyPreferenceSchema] = [] system_legitimate_interests_preferences: List[CurrentPrivacyPreferenceSchema] = [] - tc_mobile_data: Optional[TCMobileData] = None + fides_mobile_data: Optional[TCMobileData] = None class CurrentPrivacyPreferenceReportingSchema(TCFAttributes): diff --git a/src/fides/api/util/tcf/experience_meta.py b/src/fides/api/util/tcf/experience_meta.py index 42e1668829..18c5c344b1 100644 --- a/src/fides/api/util/tcf/experience_meta.py +++ b/src/fides/api/util/tcf/experience_meta.py @@ -79,8 +79,8 @@ def build_experience_tcf_meta(tcf_contents: TCFExperienceContents) -> Dict: return ExperienceMeta( version_hash=build_tcf_version_hash(tcf_contents), - accept_all_tc_string=accept_all_mobile_data.IABTCF_TCString, - reject_all_tc_string=reject_all_mobile_data.IABTCF_TCString, - accept_all_tc_mobile_data=accept_all_mobile_data, - reject_all_tc_mobile_data=reject_all_mobile_data, + accept_all_fides_string=accept_all_mobile_data.IABTCF_TCString, + reject_all_fides_string=reject_all_mobile_data.IABTCF_TCString, + accept_all_fides_mobile_data=accept_all_mobile_data, + reject_all_fides_mobile_data=reject_all_mobile_data, ).dict() diff --git a/tests/ops/api/v1/endpoints/test_privacy_experience_endpoints.py b/tests/ops/api/v1/endpoints/test_privacy_experience_endpoints.py index 8e55fff0e2..35563145c5 100644 --- a/tests/ops/api/v1/endpoints/test_privacy_experience_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_privacy_experience_endpoints.py @@ -598,10 +598,10 @@ def test_get_privacy_experiences_nonexistent_fides_user_device_id_filter( assert resp["privacy_notices"][0]["outdated_served"] is None meta = resp["meta"] assert not meta["version_hash"] - assert not meta["accept_all_tc_string"] - assert not meta["accept_all_tc_mobile_data"] - assert not meta["reject_all_tc_string"] - assert not meta["reject_all_tc_mobile_data"] + assert not meta["accept_all_fides_string"] + assert not meta["accept_all_fides_mobile_data"] + assert not meta["reject_all_fides_string"] + assert not meta["reject_all_fides_mobile_data"] @pytest.mark.usefixtures( "privacy_notice_us_ca_provide", @@ -690,10 +690,10 @@ def test_tcf_not_enabled( assert resp.json()["items"][0]["tcf_system_consents"] == [] meta = resp.json()["items"][0]["meta"] assert not meta["version_hash"] - assert not meta["accept_all_tc_string"] - assert not meta["accept_all_tc_mobile_data"] - assert not meta["reject_all_tc_string"] - assert not meta["reject_all_tc_mobile_data"] + assert not meta["accept_all_fides_string"] + assert not meta["accept_all_fides_mobile_data"] + assert not meta["reject_all_fides_string"] + assert not meta["reject_all_fides_mobile_data"] @pytest.mark.usefixtures( "privacy_experience_france_overlay", @@ -723,10 +723,10 @@ def test_tcf_enabled_but_no_relevant_systems( assert resp.json()["items"][0]["gvl"] == {} meta = resp.json()["items"][0]["meta"] assert not meta["version_hash"] - assert not meta["accept_all_tc_string"] - assert not meta["accept_all_tc_mobile_data"] - assert not meta["reject_all_tc_string"] - assert not meta["reject_all_tc_mobile_data"] + assert not meta["accept_all_fides_string"] + assert not meta["accept_all_fides_mobile_data"] + assert not meta["reject_all_fides_string"] + assert not meta["reject_all_fides_mobile_data"] # Has notices = True flag will keep this experience from appearing altogether resp = api_client.get( @@ -824,10 +824,10 @@ def test_tcf_enabled_with_overlapping_vendors( assert resp.json()["items"][0]["gvl"]["gvlSpecificationVersion"] == 3 meta = resp.json()["items"][0]["meta"] assert meta["version_hash"] == "75fb2dafef58" - assert meta["accept_all_tc_string"] - assert meta["accept_all_tc_mobile_data"] - assert meta["reject_all_tc_string"] - assert meta["reject_all_tc_mobile_data"] + assert meta["accept_all_fides_string"] + assert meta["accept_all_fides_mobile_data"] + assert meta["reject_all_fides_string"] + assert meta["reject_all_fides_mobile_data"] @pytest.mark.usefixtures( "privacy_experience_france_overlay", diff --git a/tests/ops/api/v1/endpoints/test_privacy_preference_endpoints.py b/tests/ops/api/v1/endpoints/test_privacy_preference_endpoints.py index ce1768ea01..66b28f71b0 100644 --- a/tests/ops/api/v1/endpoints/test_privacy_preference_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_privacy_preference_endpoints.py @@ -187,7 +187,7 @@ def test_verify_then_set_privacy_preferences( ) assert response.status_code == 200 assert len(response.json()["preferences"]) == 1 - assert response.json()["tc_mobile_data"] is None + assert response.json()["fides_mobile_data"] is None response_json = response.json()["preferences"][0] created_privacy_preference_history_id = response_json[ @@ -294,7 +294,7 @@ def test_verify_then_set_privacy_preferences_but_no_privacy_request_created( ) assert response.status_code == 200 assert len(response.json()["preferences"]) == 1 - assert response.json()["tc_mobile_data"] is None + assert response.json()["fides_mobile_data"] is None response_json = response.json()["preferences"][0] created_privacy_preference_history_id = response_json[ @@ -367,7 +367,7 @@ def test_set_privacy_preferences_privacy_center_fides_user_device_id_only( ) assert response.status_code == 200 assert len(response.json()["preferences"]) == 1 - assert response.json()["tc_mobile_data"] is None + assert response.json()["fides_mobile_data"] is None response_json = response.json()["preferences"][0] created_privacy_preference_history_id = response_json[ @@ -659,7 +659,7 @@ def test_set_privacy_preferences( assert response.status_code == 200 assert len(response.json()["preferences"]) == 2 - assert response.json()["tc_mobile_data"] is None + assert response.json()["fides_mobile_data"] is None response_json = response.json()["preferences"] @@ -781,7 +781,7 @@ def test_set_privacy_preferences_tcf( ) assert response.status_code == 200 - assert response.json()["tc_mobile_data"] is None + assert response.json()["fides_mobile_data"] is None assert len(response.json()["preferences"]) == 0 assert len(response.json()["feature_preferences"]) == 1 @@ -994,7 +994,7 @@ def test_verify_then_set_privacy_preferences_with_additional_fides_user_device_i ) assert response.status_code == 200 assert len(response.json()["preferences"]) == 1 - assert response.json()["tc_mobile_data"] is None + assert response.json()["fides_mobile_data"] is None response_json = response.json()["preferences"][0] created_privacy_preference_history_id = response_json[ @@ -1439,7 +1439,7 @@ def test_save_privacy_preferences_with_respect_to_fides_user_device_id( url, json=request_body, headers={"Origin": "http://localhost:8080"} ) assert response.status_code == 200 - assert response.json()["tc_mobile_data"] is None + assert response.json()["fides_mobile_data"] is None response_json = response.json()["preferences"][0] assert response_json["preference"] == "opt_out" assert ( @@ -1713,7 +1713,7 @@ def test_save_tcf_privacy_preferences( assert len(response.json()["special_feature_preferences"]) == 1 assert len(response.json()["system_consent_preferences"]) == 0 assert len(response.json()["system_legitimate_interests_preferences"]) == 1 - assert response.json()["tc_mobile_data"] is None + assert response.json()["fides_mobile_data"] is None purpose_response = response.json()["purpose_consent_preferences"][0] assert purpose_response["preference"] == "opt_out" @@ -2509,7 +2509,7 @@ def test_save_privacy_preferences_tc_string_section_overlaps_request_body_sectio "browser_identity": { "fides_user_device_id": fides_user_device_id, }, - "tc_string": tc_string, + "fides_string": tc_string, "purpose_consent_preferences": [{"id": 1, "preference": "opt_out"}], } response = api_client.patch( @@ -2518,7 +2518,7 @@ def test_save_privacy_preferences_tc_string_section_overlaps_request_body_sectio assert response.status_code == 422 assert ( response.json()["detail"][0]["msg"] - == "Cannot supply value for 'purpose_consent_preferences' and 'tc_string' simultaneously when saving privacy preferences." + == "Cannot supply value for 'purpose_consent_preferences' and 'fides_string' simultaneously when saving privacy preferences." ) def test_save_privacy_preferences_bad_tc_string(self, api_client, url): @@ -2529,7 +2529,7 @@ def test_save_privacy_preferences_bad_tc_string(self, api_client, url): "browser_identity": { "fides_user_device_id": fides_user_device_id, }, - "tc_string": tc_string, + "fides_string": tc_string, } response = api_client.patch( url, json=minimal_request_body, headers={"Origin": "http://localhost:8080"} @@ -2548,7 +2548,7 @@ def test_save_privacy_preferences_with_tc_string_when_datamap_empty( "browser_identity": { "fides_user_device_id": fides_user_device_id, }, - "tc_string": tc_string, + "fides_string": tc_string, } response = api_client.patch( url, json=minimal_request_body, headers={"Origin": "http://localhost:8080"} @@ -2567,7 +2567,7 @@ def test_save_privacy_preferences_when_tcf_disabled(self, api_client, url): "browser_identity": { "fides_user_device_id": fides_user_device_id, }, - "tc_string": tc_string, + "fides_string": tc_string, } response = api_client.patch( url, json=minimal_request_body, headers={"Origin": "http://localhost:8080"} @@ -2589,7 +2589,7 @@ def test_save_privacy_preferences_with_tc_string(self, api_client, url, db): "browser_identity": { "fides_user_device_id": fides_user_device_id, }, - "tc_string": tc_string, + "fides_string": tc_string, } response = api_client.patch( url, json=minimal_request_body, headers={"Origin": "http://localhost:8080"} @@ -2648,7 +2648,7 @@ def test_save_privacy_preferences_with_tc_string(self, api_client, url, db): is None ) - mobile_data = response.json()["tc_mobile_data"] + mobile_data = response.json()["fides_mobile_data"] assert mobile_data == { "IABTCF_CmpSdkID": 12, "IABTCF_CmpSdkVersion": 1,