From 8e7a3db67eb2a739c5197b59076fe51d998916d7 Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Thu, 5 Sep 2024 10:57:55 -0400 Subject: [PATCH] Point DE to new Mongo and Cassandra Proxies only and activate Cassandra Proxy in FF/MC (#1958) Co-authored-by: Asier Isayas --- src/Common/MongoProxyClient.ts | 8 -------- src/ConfigContext.ts | 4 ---- src/Explorer/Tables/TableDataClient.ts | 10 ++-------- src/Explorer/Tabs/Tabs.tsx | 16 ++-------------- 4 files changed, 4 insertions(+), 34 deletions(-) diff --git a/src/Common/MongoProxyClient.ts b/src/Common/MongoProxyClient.ts index 97cc849d8..5c0f4d743 100644 --- a/src/Common/MongoProxyClient.ts +++ b/src/Common/MongoProxyClient.ts @@ -723,16 +723,8 @@ export function useMongoProxyEndpoint(api: string): boolean { MongoProxyEndpoints.Fairfax, MongoProxyEndpoints.Mooncake, ]; - let canAccessMongoProxy: boolean = userContext.databaseAccount.properties.publicNetworkAccess === "Enabled"; - if ( - configContext.MONGO_PROXY_ENDPOINT !== MongoProxyEndpoints.Local && - userContext.databaseAccount.properties.ipRules?.length > 0 - ) { - canAccessMongoProxy = canAccessMongoProxy && configContext.MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED; - } return ( - canAccessMongoProxy && configContext.NEW_MONGO_APIS?.includes(api) && activeMongoProxyEndpoints.includes(configContext.MONGO_PROXY_ENDPOINT) ); diff --git a/src/ConfigContext.ts b/src/ConfigContext.ts index f202602e9..f675160c6 100644 --- a/src/ConfigContext.ts +++ b/src/ConfigContext.ts @@ -53,10 +53,8 @@ export interface ConfigContext { NEW_BACKEND_APIS?: BackendApi[]; MONGO_BACKEND_ENDPOINT?: string; MONGO_PROXY_ENDPOINT?: string; - MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED?: boolean; NEW_MONGO_APIS?: string[]; CASSANDRA_PROXY_ENDPOINT?: string; - CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED: boolean; NEW_CASSANDRA_APIS?: string[]; PROXY_PATH?: string; JUNO_ENDPOINT: string; @@ -119,10 +117,8 @@ let configContext: Readonly = { "legacyMongoShell", "bulkdelete", ], - MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED: false, CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Prod, NEW_CASSANDRA_APIS: ["postQuery", "createOrDelete", "getKeys", "getSchema"], - CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED: false, isTerminalEnabled: false, isPhoenixEnabled: false, }; diff --git a/src/Explorer/Tables/TableDataClient.ts b/src/Explorer/Tables/TableDataClient.ts index 25a43f56b..4e0859f95 100644 --- a/src/Explorer/Tables/TableDataClient.ts +++ b/src/Explorer/Tables/TableDataClient.ts @@ -753,17 +753,11 @@ export class CassandraAPIDataClient extends TableDataClient { CassandraProxyEndpoints.Development, CassandraProxyEndpoints.Mpac, CassandraProxyEndpoints.Prod, + CassandraProxyEndpoints.Fairfax, + CassandraProxyEndpoints.Mooncake, ]; - let canAccessCassandraProxy: boolean = userContext.databaseAccount.properties.publicNetworkAccess === "Enabled"; - if ( - configContext.CASSANDRA_PROXY_ENDPOINT !== CassandraProxyEndpoints.Development && - userContext.databaseAccount.properties.ipRules?.length > 0 - ) { - canAccessCassandraProxy = canAccessCassandraProxy && configContext.CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED; - } return ( - canAccessCassandraProxy && configContext.NEW_CASSANDRA_APIS?.includes(api) && activeCassandraProxyEndpoints.includes(configContext.CASSANDRA_PROXY_ENDPOINT) ); diff --git a/src/Explorer/Tabs/Tabs.tsx b/src/Explorer/Tabs/Tabs.tsx index d40bc23b7..0996922a3 100644 --- a/src/Explorer/Tabs/Tabs.tsx +++ b/src/Explorer/Tabs/Tabs.tsx @@ -1,7 +1,7 @@ import { IMessageBarStyles, Link, MessageBar, MessageBarButton, MessageBarType } from "@fluentui/react"; import { CassandraProxyEndpoints, MongoProxyEndpoints } from "Common/Constants"; import { sendMessage } from "Common/MessageHandler"; -import { Platform, configContext, updateConfigContext } from "ConfigContext"; +import { Platform, configContext } from "ConfigContext"; import { IpRule } from "Contracts/DataModels"; import { MessageTypes } from "Contracts/ExplorerContracts"; import { CollectionTabKind } from "Contracts/ViewModels"; @@ -118,7 +118,7 @@ export const Tabs = ({ explorer }: TabsProps): JSX.Element => { setShowMongoAndCassandraProxiesNetworkSettingsWarningState(false); }} > - {`We are moving our middleware to new infrastructure. To avoid future issues with Data Explorer access, please + {`We have migrated our middleware to new infrastructure. To avoid issues with Data Explorer access, please re-enable "Allow access from Azure Portal" on the Networking blade for your account.`} )} @@ -397,12 +397,6 @@ const showMongoAndCassandraProxiesNetworkSettingsWarning = (): boolean => { ipAddressesFromIPRules.includes(mongoProxyOutboundIP), ); - if (ipRulesIncludeMongoProxy) { - updateConfigContext({ - MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED: true, - }); - } - return !ipRulesIncludeMongoProxy; } else if (userContext.apiType === "Cassandra") { const isProdOrMpacCassandraProxyEndpoint: boolean = [ @@ -421,12 +415,6 @@ const showMongoAndCassandraProxiesNetworkSettingsWarning = (): boolean => { (cassandraProxyOutboundIP: string) => ipAddressesFromIPRules.includes(cassandraProxyOutboundIP), ); - if (ipRulesIncludeCassandraProxy) { - updateConfigContext({ - CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED: true, - }); - } - return !ipRulesIncludeCassandraProxy; } }