Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Changes can also be flagged with a GitHub label for tracking purposes. The URL o
- Migrate var(--fidesui-*) consumers to --ant-* and delete Sass var generation [#8065](https://github.com/ethyca/fides/pull/8065)
- Rename Ant cssVar prefix to fidesui and migrate all var(--ant-*) consumers [#8066](https://github.com/ethyca/fides/pull/8066)
- Upgrade ESLint and fix no-unused-vars errors for mapped types in admin-ui [#8050](https://github.com/ethyca/fides/pull/8050)
- Bundle policy-engine Go source in the ethyca-fides wheel and build libpbac in the Docker image for in-process PBAC evaluation [#8093](https://github.com/ethyca/fides/pull/8093)

### Docs
- Updated FidesJS JSDoc links to match the new fidesdocs domain-based structure [#8038](https://github.com/ethyca/fides/pull/8038)
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# If you update this, also update `DEFAULT_PYTHON_VERSION` in the GitHub workflow files
ARG PYTHON_VERSION="3.13.11"
############################
## Build libpbac (Go→C) ##
############################
FROM golang:1.24-bookworm AS libpbac_builder
WORKDIR /build
COPY policy-engine/ .
RUN go build -buildmode=c-shared -o libpbac.so ./cmd/libpbac/

#########################
## Compile Python Deps ##
#########################
Expand Down Expand Up @@ -70,6 +78,7 @@ USER fidesuser
ENV USER=fidesuser

COPY --chown=fidesuser:fidesgroup . /fides
COPY --from=libpbac_builder --chown=fidesuser:fidesgroup /build/libpbac.so /fides/src/fides/bin/libpbac.so
WORKDIR /fides

# Immediately flush to stdout, globally
Expand Down
64 changes: 1 addition & 63 deletions clients/fides-js/__tests__/lib/i18n/i18n-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
ExperienceConfig,
FidesExperienceTranslationOverrides,
FidesInitOptions,
PrivacyExperience,
PrivacyNoticeWithPreference,
Expand Down Expand Up @@ -339,75 +338,14 @@ describe("i18n-utils", () => {
expect(mockI18n.load).toHaveBeenCalledWith("en", mockI18nCatalogLoad[0]);
});

it("sets overrides experience_config translations when locale matches", () => {
const experienceTranslationOverrides: Partial<FidesExperienceTranslationOverrides> =
{
title: "My override title",
description: "My override description",
override_language: "en",
};
loadMessagesFromExperience(
mockI18n,
mockExperience,
experienceTranslationOverrides,
);
const EXPECTED_NUM_TRANSLATIONS = 2;
expect(mockI18n.load).toHaveBeenCalledTimes(EXPECTED_NUM_TRANSLATIONS);
expect(mockI18n.load).toHaveBeenCalledWith("en", {
...mockI18nCatalogLoad[0],
...{
"exp.description": experienceTranslationOverrides.description,
"exp.title": experienceTranslationOverrides.title,
},
});
expect(mockI18n.load).toHaveBeenCalledWith("es", mockI18nCatalogLoad[1]);
});

it("does not set overrides experience_config translations when no locale match", () => {
const experienceTranslationOverrides: Partial<FidesExperienceTranslationOverrides> =
{
title: "My override title",
description: "My override description",
override_language: "ja",
};
loadMessagesFromExperience(
mockI18n,
mockExperience,
experienceTranslationOverrides,
);
loadMessagesFromExperience(mockI18n, mockExperience);
const EXPECTED_NUM_TRANSLATIONS = 2;
expect(mockI18n.load).toHaveBeenCalledTimes(EXPECTED_NUM_TRANSLATIONS);
expect(mockI18n.load).toHaveBeenCalledWith("en", mockI18nCatalogLoad[0]);
expect(mockI18n.load).toHaveBeenCalledWith("es", mockI18nCatalogLoad[1]);
});

it("always override privacy_policy_url, even if locale doesn't match", () => {
const experienceTranslationOverrides: Partial<FidesExperienceTranslationOverrides> =
{
title: "My override title",
description: "My override description",
privacy_policy_url: "https://example.com/privacy",
override_language: "ja",
};
loadMessagesFromExperience(
mockI18n,
mockExperience,
experienceTranslationOverrides,
);
const EXPECTED_NUM_TRANSLATIONS = 2;
expect(mockI18n.load).toHaveBeenCalledTimes(EXPECTED_NUM_TRANSLATIONS);
expect(mockI18n.load).toHaveBeenCalledWith("en", {
...mockI18nCatalogLoad[0],
"exp.privacy_policy_url":
experienceTranslationOverrides.privacy_policy_url,
});
expect(mockI18n.load).toHaveBeenCalledWith("es", {
...mockI18nCatalogLoad[1],
"exp.privacy_policy_url":
experienceTranslationOverrides.privacy_policy_url,
});
});

describe("when loading from a tcf_overlay experience", () => {
it("reads all messages from gvl translations API response and loads into the i18n catalog", () => {
// Mock out a partial response for a tcf_overlay including translations
Expand Down
10 changes: 1 addition & 9 deletions clients/fides-js/src/components/tcf/TcfOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
ConsentMethod,
EmptyExperience,
FidesAttStatus,
FidesExperienceTranslationOverrides,
FidesModalDefaultView,
NoticeConsent,
OverrideType,
PrivacyExperience,
PrivacyExperienceMinimal,
PrivacyNoticeWithPreference,
Expand Down Expand Up @@ -49,7 +47,7 @@
selectBestNoticeTranslation,
} from "../../lib/i18n";
import { useI18n } from "../../lib/i18n/i18n-context";
import { getOverridesByType } from "../../lib/initialize";

Check failure on line 50 in clients/fides-js/src/components/tcf/TcfOverlay.tsx

View workflow job for this annotation

GitHub Actions / Clients-Unit

'getOverridesByType' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 50 in clients/fides-js/src/components/tcf/TcfOverlay.tsx

View workflow job for this annotation

GitHub Actions / Clients-Unit

'getOverridesByType' is defined but never used. Allowed unused vars must match /^_/u
import { updateConsent } from "../../lib/preferences";
import { useEvent } from "../../lib/providers/event-context";
import {
Expand Down Expand Up @@ -111,16 +109,10 @@
const {
fidesRegionString,
cookie,
config,
options,
saved_consent: savedConsent,
} = fidesGlobal;
const experienceMinimal = fidesGlobal.experience as PrivacyExperienceMinimal;
const translationOverrides: Partial<FidesExperienceTranslationOverrides> =
getOverridesByType<Partial<FidesExperienceTranslationOverrides>>(
OverrideType.EXPERIENCE_TRANSLATION,
config,
);
const {
i18n,
currentLocale,
Expand Down Expand Up @@ -276,7 +268,7 @@
if (isFullExperience) {
// Load messages from experience
// This includes any custom notices, but not the GVL translations.
loadMessagesFromExperience(i18n, experienceFull, translationOverrides);
loadMessagesFromExperience(i18n, experienceFull);

// Set the locale to the best locale
window.Fides.locale = bestLocale;
Expand Down
8 changes: 0 additions & 8 deletions clients/fides-js/src/fides-headless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { getConsentContext } from "./lib/consent-context";
import {
FidesConfig,
FidesCookie,
FidesExperienceTranslationOverrides,
FidesGlobal,
FidesInitOptionsOverrides,
FidesOverrides,
Expand Down Expand Up @@ -77,11 +76,6 @@ async function init(this: FidesGlobal, providedConfig?: FidesConfig) {
OverrideType.OPTIONS,
config,
);
const experienceTranslationOverrides: Partial<FidesExperienceTranslationOverrides> =
getOverridesByType<Partial<FidesExperienceTranslationOverrides>>(
OverrideType.EXPERIENCE_TRANSLATION,
config,
);
// DEFER: not implemented - ability to override Fides consent with OneTrust overrides
const consentPrefsOverrides: GetPreferencesFnResp | null =
await customGetConsentPreferences(config);
Expand All @@ -92,7 +86,6 @@ async function init(this: FidesGlobal, providedConfig?: FidesConfig) {
const overrides: Partial<FidesOverrides> = {
optionsOverrides,
consentPrefsOverrides,
experienceTranslationOverrides,
};
config = {
...config,
Expand Down Expand Up @@ -178,7 +171,6 @@ async function init(this: FidesGlobal, providedConfig?: FidesConfig) {
const updatedFides = await initialize({
fides: this,
updateExperience,
overrides,
automatedConsentContext,
});
Object.assign(this, updatedFides);
Expand Down
8 changes: 0 additions & 8 deletions clients/fides-js/src/fides-tcf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { FidesCookie, isNewFidesCookie } from "./fides";
import { getConsentContext } from "./lib/consent-context";
import {
FidesConfig,
FidesExperienceTranslationOverrides,
FidesGlobal,
FidesInitOptionsOverrides,
FidesOverrides,
Expand Down Expand Up @@ -119,11 +118,6 @@ async function init(this: FidesGlobal, providedConfig?: FidesConfig) {
true,
});

const experienceTranslationOverrides: Partial<FidesExperienceTranslationOverrides> =
getOverridesByType<Partial<FidesExperienceTranslationOverrides>>(
OverrideType.EXPERIENCE_TRANSLATION,
config,
);
const consentPrefsOverrides: GetPreferencesFnResp | null =
await customGetConsentPreferences(config);
// if we don't already have a fidesString override, use fidesString from consent prefs if they exist
Expand All @@ -133,7 +127,6 @@ async function init(this: FidesGlobal, providedConfig?: FidesConfig) {
const overrides: Partial<FidesOverrides> = {
optionsOverrides,
consentPrefsOverrides,
experienceTranslationOverrides,
};
// eslint-disable-next-line no-param-reassign
config = {
Expand Down Expand Up @@ -236,7 +229,6 @@ async function init(this: FidesGlobal, providedConfig?: FidesConfig) {
initOverlay,
renderOverlay,
updateExperience: updateTCFExperience,
overrides,
automatedConsentContext,
});
Object.assign(this, updatedFides);
Expand Down
8 changes: 0 additions & 8 deletions clients/fides-js/src/fides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { getConsentContext } from "./lib/consent-context";
import {
FidesConfig,
FidesCookie,
FidesExperienceTranslationOverrides,
FidesGlobal,
FidesInitOptionsOverrides,
FidesOverrides,
Expand Down Expand Up @@ -79,11 +78,6 @@ async function init(this: FidesGlobal, providedConfig?: FidesConfig) {
OverrideType.OPTIONS,
config,
);
const experienceTranslationOverrides: Partial<FidesExperienceTranslationOverrides> =
getOverridesByType<Partial<FidesExperienceTranslationOverrides>>(
OverrideType.EXPERIENCE_TRANSLATION,
config,
);
const consentPrefsOverrides: GetPreferencesFnResp | null =
await customGetConsentPreferences(config);
// if we don't already have a fidesString override, use fidesString from consent prefs if they exist
Expand All @@ -93,7 +87,6 @@ async function init(this: FidesGlobal, providedConfig?: FidesConfig) {
const overrides: Partial<FidesOverrides> = {
optionsOverrides,
consentPrefsOverrides,
experienceTranslationOverrides,
};

config = {
Expand Down Expand Up @@ -184,7 +177,6 @@ async function init(this: FidesGlobal, providedConfig?: FidesConfig) {
initOverlay,
renderOverlay,
updateExperience,
overrides,
automatedConsentContext,
});
Object.assign(this, updatedFides);
Expand Down
37 changes: 1 addition & 36 deletions clients/fides-js/src/lib/consent-constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
FidesExperienceLanguageValidatorMap,
FidesOverrideValidatorMap,
} from "./consent-types";
import { FidesOverrideValidatorMap } from "./consent-types";
import { LOCALE_REGEX } from "./i18n/i18n-constants";
import { parseCommaSeparatedString } from "./shared-consent-utils";

Expand Down Expand Up @@ -174,38 +171,6 @@ export const FIDES_OVERRIDE_OPTIONS_VALIDATOR_MAP: FidesOverrideValidatorMap[] =
},
];

/**
* Allows various user-provided experience lang overrides to be validated and mapped to the appropriate Fides variable.
* overrideName is Fides internal, but overrideKey is the key the user uses to override the option.
*/
export const FIDES_OVERRIDE_EXPERIENCE_LANGUAGE_VALIDATOR_MAP: FidesExperienceLanguageValidatorMap[] =
[
{
overrideName: "title",
overrideType: "string",
overrideKey: "fides_title",
validationRegex: /(.*)/,
},
{
overrideName: "description",
overrideType: "string",
overrideKey: "fides_description",
validationRegex: /(.*)/,
},
{
overrideName: "privacy_policy_url",
overrideType: "string",
overrideKey: "fides_privacy_policy_url",
validationRegex: /(.*)/,
},
{
overrideName: "override_language",
overrideType: "string",
overrideKey: "fides_override_language",
validationRegex: LOCALE_REGEX,
},
];

export const FIDES_OVERLAY_WRAPPER = "fides-overlay-wrapper";
export const FIDES_I18N_ICON = "fides-i18n-icon";

Expand Down
25 changes: 1 addition & 24 deletions clients/fides-js/src/lib/consent-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -899,13 +899,6 @@ export enum FidesModalDefaultView {
*/
export { FidesOptions };

export type OverrideExperienceTranslations = {
fides_title: string;
fides_description: string;
fides_privacy_policy_url: string;
fides_override_language: string;
};

/**
* Select the subset of FidesInitOptions that can be overridden at runtime using
* one of the customer-provided FidesOptions properties above. There's a 1:1
Expand Down Expand Up @@ -941,22 +934,13 @@ export type FidesInitOptionsOverrides = Pick<
| "fidesExternalId"
>;

export type FidesExperienceTranslationOverrides = {
title: string;
description: string;
privacy_policy_url: string;
override_language: string;
};

export type FidesOverrides = {
optionsOverrides: Partial<FidesInitOptionsOverrides>;
consentPrefsOverrides: GetPreferencesFnResp | null;
experienceTranslationOverrides: Partial<FidesExperienceTranslationOverrides>;
};

export enum OverrideType {
OPTIONS = "options",
EXPERIENCE_TRANSLATION = "language",
}

export enum ButtonType {
Expand Down Expand Up @@ -1156,13 +1140,6 @@ export type FidesOverrideValidatorMap = FidesValidatorMap<
keyof FidesOptions
>;

export type FidesExperienceLanguageValidatorMap = FidesValidatorMap<
FidesExperienceTranslationOverrides,
string
>;

export type FidesWindowOverrides = Partial<
FidesOptions & OverrideExperienceTranslations
> & {
export type FidesWindowOverrides = Partial<FidesOptions> & {
[key: string]: string | boolean | undefined;
};
9 changes: 1 addition & 8 deletions clients/fides-js/src/lib/consent-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
FIDES_OVERRIDE_EXPERIENCE_LANGUAGE_VALIDATOR_MAP,
FIDES_OVERRIDE_OPTIONS_VALIDATOR_MAP,
VALID_ISO_3166_LOCATION_REGEX,
} from "./consent-constants";
Expand All @@ -12,7 +11,6 @@ import {
ConsentNonApplicableFlagMode,
EmptyExperience,
FidesCookie,
FidesExperienceLanguageValidatorMap,
FidesInitOptions,
FidesOverrideValidatorMap,
FidesWindowOverrides,
Expand Down Expand Up @@ -150,16 +148,11 @@ export const validateOptions = (options: FidesInitOptions): boolean => {

export const getOverrideValidatorMapByType = (
overrideType: OverrideType,
):
| FidesOverrideValidatorMap[]
| FidesExperienceLanguageValidatorMap[]
| null => {
): FidesOverrideValidatorMap[] | null => {
// eslint-disable-next-line default-case
switch (overrideType) {
case OverrideType.OPTIONS:
return FIDES_OVERRIDE_OPTIONS_VALIDATOR_MAP;
case OverrideType.EXPERIENCE_TRANSLATION:
return FIDES_OVERRIDE_EXPERIENCE_LANGUAGE_VALIDATOR_MAP;
default:
return null;
}
Expand Down
Loading
Loading