Skip to content

Commit

Permalink
pull main
Browse files Browse the repository at this point in the history
  • Loading branch information
eastandwestwind committed Dec 11, 2024
2 parents 20c5133 + 05e0a94 commit 8ec34da
Show file tree
Hide file tree
Showing 70 changed files with 4,337 additions and 3,681 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/backend_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ jobs:
Safe-Tests:
needs: Check-Container-Startup
strategy:
fail-fast: false
matrix:
python_version: ["3.9.18", "3.10.13"]
test_selection:
Expand All @@ -255,7 +256,6 @@ jobs:

runs-on: ubuntu-latest
timeout-minutes: 45
continue-on-error: true
steps:
- name: Download container
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -397,8 +397,8 @@ jobs:
# Secrets to pull from 1Password
BIGQUERY_DATASET: op://github-actions/bigquery/BIGQUERY_DATASET
BIGQUERY_KEYFILE_CREDS: op://github-actions/bigquery/BIGQUERY_KEYFILE_CREDS
BIGQUERY_ENTERPRISE_DATASET: op://github-actions/bigquery-enterprise/BIGQUERY_DATASET
BIGQUERY_ENTERPRISE_KEYFILE_CREDS: op://github-actions/bigquery-enterprise/BIGQUERY_KEYFILE_CREDS
BIGQUERY_ENTERPRISE_DATASET: op://github-actions/bigquery-enterprise/BIGQUERY_ENTERPRISE_DATASET
BIGQUERY_ENTERPRISE_KEYFILE_CREDS: op://github-actions/bigquery-enterprise/BIGQUERY_ENTERPRISE_KEYFILE_CREDS
DYNAMODB_ACCESS_KEY_ID: op://github-actions/dynamodb/DYNAMODB_ACCESS_KEY_ID
DYNAMODB_ACCESS_KEY: op://github-actions/dynamodb/DYNAMODB_ACCESS_KEY
DYNAMODB_ASSUME_ROLE_ARN: op://github-actions/dynamodb/DYNAMODB_ASSUME_ROLE_ARN
Expand Down
10 changes: 8 additions & 2 deletions clients/fides-js/src/components/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const Overlay: FunctionComponent<Props> = ({
}, [showBanner, setBannerIsOpen]);

useEffect(() => {
if (!experience || options.modalLinkId === "") {
if (options.fidesEmbed || !experience || options.modalLinkId === "") {
// If empty string is explicitly set, do not attempt to bind the modal link to the click handler.
// developers using `Fides.showModal();` can use this to prevent polling for the modal link.
return () => {};
Expand Down Expand Up @@ -211,7 +211,13 @@ const Overlay: FunctionComponent<Props> = ({
}
window.Fides.showModal = defaultShowModal;
};
}, [options.modalLinkId, options.debug, handleOpenModal, experience]);
}, [
options.fidesEmbed,
options.modalLinkId,
options.debug,
handleOpenModal,
experience,
]);

const handleManagePreferencesClick = (): void => {
handleOpenModal();
Expand Down
6 changes: 3 additions & 3 deletions clients/fides-js/src/components/fides.css
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ div#fides-consent-content .fides-modal-description {
justify-content: center;
}

.fides-modal-container .fides-button-group-brand {
.fides-modal-footer .fides-button-group-brand {
min-height: var(--fides-overlay-modal-secondary-button-group-height);
}

Expand Down Expand Up @@ -1023,13 +1023,13 @@ div#fides-overlay-wrapper .fides-toggle .fides-toggle-display {
position: relative;
}

.fides-modal-container .fides-i18n-menu {
.fides-modal-footer .fides-i18n-menu {
position: absolute;
left: var(--fides-overlay-padding);
bottom: var(--fides-overlay-padding);
}

.fides-modal-container .fides-button-group-i18n {
.fides-modal-footer .fides-button-group-i18n {
min-height: var(--fides-overlay-modal-secondary-button-group-height);
}

Expand Down
7 changes: 7 additions & 0 deletions clients/sample-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ This will automatically bring up a Docker Compose project to create a sample app

Once running successfully, open http://localhost:3000 to see the Cookie House!

Note: If you are already running a database on port 5432 locally, you can override the default port by setting the `FIDES_SAMPLE_APP__DATABASE_PORT` environment variable and ALSO changing the **host** port number in the `docker-compose.yml` file. For example:

```yaml
ports:
- "5433:5432"
```
## Pre-commit
Before committing any changes, run the following:
Expand Down
109 changes: 109 additions & 0 deletions clients/sample-app/src/pages/embedded-consent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { GetServerSideProps } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import Script from "next/script";

interface Props {
gtmContainerId: string | null;
privacyCenterUrl: string;
}

// Regex to ensure the provided GTM container ID appears valid (e.g. "GTM-ABCD123")
// NOTE: this also protects against XSS since this ID is added to a script template
const VALID_GTM_REGEX = /^[0-9a-zA-Z-]+$/;

/**
* Pass the following server-side ENV variables to the page:
* - FIDES_SAMPLE_APP__GOOGLE_TAG_MANAGER_CONTAINER_ID: configure a GTM container, e.g. "GTM-ABCD123"
* - FIDES_SAMPLE_APP__PRIVACY_CENTER_URL: configure Privacy Center URL, e.g. "http://localhost:3001"
*/
export const getServerSideProps: GetServerSideProps<Props> = async () => {
// Check for a valid FIDES_SAMPLE_APP__GOOGLE_TAG_MANAGER_CONTAINER_ID
let gtmContainerId = null;
if (
process.env.FIDES_SAMPLE_APP__GOOGLE_TAG_MANAGER_CONTAINER_ID?.match(
VALID_GTM_REGEX,
)
) {
gtmContainerId =
process.env.FIDES_SAMPLE_APP__GOOGLE_TAG_MANAGER_CONTAINER_ID;
}

// Check for a valid FIDES_SAMPLE_APP__PRIVACY_CENTER_URL
const privacyCenterUrl =
process.env.FIDES_SAMPLE_APP__PRIVACY_CENTER_URL || "http://localhost:3001";

// Pass the server-side props to the page
return { props: { gtmContainerId, privacyCenterUrl } };
};

const IndexPage = ({ gtmContainerId, privacyCenterUrl }: Props) => {
// Load the fides.js script from the Fides Privacy Center, assumed to be
// running at http://localhost:3001
const fidesScriptTagUrl = new URL(`${privacyCenterUrl}/fides.js`);
const router = useRouter();
// eslint-disable-next-line @typescript-eslint/naming-convention
const { geolocation, property_id } = router.query;

// If `geolocation=` or `property_id` query params exists, pass those along to the fides.js fetch
if (geolocation && typeof geolocation === "string") {
fidesScriptTagUrl.searchParams.append("geolocation", geolocation);
}
if (typeof property_id === "string") {
fidesScriptTagUrl.searchParams.append("property_id", property_id);
}

return (
<>
<Head>
<title>Cookie House</title>
{/* Require FidesJS to "embed" it's UI onto the page, instead of as an overlay over the <body> itself. (see https://ethyca.com/docs/dev-docs/js/reference/interfaces/FidesOptions#fides_embed) */}
<script>{`window.fides_overrides = { fides_embed: true, fides_disable_banner: true }`}</script>
{/* Allow the embedded consent modal to fill the screen */}
<style>{`
#fides-embed-container {
--fides-overlay-width: 'auto'
}
body {
font-family: "Inter", sans-serif;
color: #171923;
font-size: 14px;
}
`}</style>
</Head>
{/**
Insert the fides.js script and run the GTM integration once ready
DEFER: using "beforeInteractive" here triggers a lint warning from NextJS
as it should only be used in the _document.tsx file. This still works and
ensures that fides.js fires earlier than other scripts, but isn't a best
practice.
*/}
<Script
id="fides-js"
src={fidesScriptTagUrl.href}
onReady={() => {
// Enable the GTM integration, if GTM is configured
if (gtmContainerId) {
(window as any).Fides.gtm();
}
}}
/>
{/* Insert the GTM script, if a container ID was provided */}
{gtmContainerId ? (
<Script id="google-tag-manager" strategy="afterInteractive">
{`
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','${gtmContainerId}');
`}
</Script>
) : null}
<div id="fides-embed-container" />
</>
);
};

export default IndexPage;
25 changes: 7 additions & 18 deletions data/dataset/bigquery_enterprise_test_dataset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dataset:
references: null
identity: null
primary_key: true
data_type: null
data_type: integer
length: null
return_all_elements: null
read_only: null
Expand Down Expand Up @@ -103,7 +103,7 @@ dataset:
references: null
identity: null
primary_key: true
data_type: null
data_type: integer
length: null
return_all_elements: null
read_only: null
Expand All @@ -119,18 +119,7 @@ dataset:
description: null
data_categories:
- system.operations
fides_meta:
references:
- dataset: enterprise_dsr_testing
field: stackoverflow_posts.id
direction: from
identity: null
primary_key: null
data_type: null
length: null
return_all_elements: null
read_only: null
custom_request_field: null
fides_meta: null
fields: null
- name: revision_guid
description: null
Expand All @@ -147,7 +136,7 @@ dataset:
- name: user_id
description: null
data_categories:
- user.contact
- system.operations
fides_meta:
references:
- dataset: enterprise_dsr_testing
Expand Down Expand Up @@ -216,7 +205,7 @@ dataset:
references: null
identity: null
primary_key: true
data_type: null
data_type: integer
length: null
return_all_elements: null
read_only: null
Expand Down Expand Up @@ -260,7 +249,7 @@ dataset:
- name: owner_display_name
description: null
data_categories:
- system.operations
- user.contact
fides_meta: null
fields: null
- name: owner_user_id
Expand All @@ -274,7 +263,7 @@ dataset:
direction: from
identity: null
primary_key: null
data_type: null
data_type: integer
length: null
return_all_elements: null
read_only: null
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def optional_requirements(
## Package Setup ##
###################
setup(
name="ethyca-fides",
name="ethyca_fides",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description="Open-source ecosystem for data privacy as code.",
Expand Down
48 changes: 25 additions & 23 deletions src/fides/api/service/connectors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from fides.api.models.connectionconfig import ConnectionConfig as ConnectionConfig
from fides.api.models.connectionconfig import ConnectionType as ConnectionType
from fides.api.service.connectors.base_connector import BaseConnector as BaseConnector
from fides.api.service.connectors.bigquery_connector import (
BigQueryConnector as BigQueryConnector,
)
from fides.api.service.connectors.consent_email_connector import (
GenericConsentEmailConnector,
)
Expand All @@ -29,47 +32,46 @@
from fides.api.service.connectors.fides_connector import (
FidesConnector as FidesConnector,
)
from fides.api.service.connectors.google_cloud_mysql_connector import (
GoogleCloudSQLMySQLConnector as GoogleCloudSQLMySQLConnector,
)
from fides.api.service.connectors.google_cloud_postgres_connector import (
GoogleCloudSQLPostgresConnector as GoogleCloudSQLPostgresConnector,
)
from fides.api.service.connectors.http_connector import HTTPSConnector as HTTPSConnector
from fides.api.service.connectors.manual_webhook_connector import (
ManualWebhookConnector as ManualWebhookConnector,
)
from fides.api.service.connectors.mariadb_connector import (
MariaDBConnector as MariaDBConnector,
)
from fides.api.service.connectors.microsoft_sql_server_connector import (
MicrosoftSQLServerConnector as MicrosoftSQLServerConnector,
)
from fides.api.service.connectors.mongodb_connector import (
MongoDBConnector as MongoDBConnector,
)
from fides.api.service.connectors.mysql_connector import (
MySQLConnector as MySQLConnector,
)
from fides.api.service.connectors.postgres_connector import (
PostgreSQLConnector as PostgreSQLConnector,
)
from fides.api.service.connectors.rds_mysql_connector import (
RDSMySQLConnector as RDSMySQLConnector,
)
from fides.api.service.connectors.rds_postgres_connector import (
RDSPostgresConnector as RDSPostgresConnector,
)
from fides.api.service.connectors.redshift_connector import (
RedshiftConnector as RedshiftConnector,
)
from fides.api.service.connectors.s3_connector import S3Connector
from fides.api.service.connectors.saas_connector import SaaSConnector as SaaSConnector
from fides.api.service.connectors.scylla_connector import (
ScyllaConnector as ScyllaConnector,
)
from fides.api.service.connectors.sql_connector import (
BigQueryConnector as BigQueryConnector,
)
from fides.api.service.connectors.sql_connector import (
GoogleCloudSQLMySQLConnector as GoogleCloudSQLMySQLConnector,
)
from fides.api.service.connectors.sql_connector import (
GoogleCloudSQLPostgresConnector as GoogleCloudSQLPostgresConnector,
)
from fides.api.service.connectors.sql_connector import (
MariaDBConnector as MariaDBConnector,
)
from fides.api.service.connectors.sql_connector import (
MicrosoftSQLServerConnector as MicrosoftSQLServerConnector,
)
from fides.api.service.connectors.sql_connector import MySQLConnector as MySQLConnector
from fides.api.service.connectors.sql_connector import (
PostgreSQLConnector as PostgreSQLConnector,
)
from fides.api.service.connectors.sql_connector import (
RedshiftConnector as RedshiftConnector,
)
from fides.api.service.connectors.sql_connector import (
from fides.api.service.connectors.snowflake_connector import (
SnowflakeConnector as SnowflakeConnector,
)
from fides.api.service.connectors.timescale_connector import (
Expand Down
2 changes: 1 addition & 1 deletion src/fides/api/service/connectors/base_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from fides.api.models.connectionconfig import ConnectionConfig, ConnectionTestStatus
from fides.api.models.policy import Policy
from fides.api.models.privacy_request import PrivacyRequest, RequestTask
from fides.api.service.connectors.query_config import QueryConfig
from fides.api.service.connectors.query_configs.query_config import QueryConfig
from fides.api.util.collection_util import Row
from fides.config import CONFIG

Expand Down
Loading

0 comments on commit 8ec34da

Please sign in to comment.