Merge branch 'master' of https://github.com/Azure/cosmos-explorer into users/jawelton/removenotebooks-phase3-062226

This commit is contained in:
Jade Welton
2026-06-24 10:57:30 -07:00
4 changed files with 36 additions and 22 deletions
+18 -6
View File
@@ -14396,20 +14396,33 @@
} }
}, },
"node_modules/form-data": { "node_modules/form-data": {
"version": "4.0.5", "version": "4.0.6",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz",
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==",
"license": "MIT",
"dependencies": { "dependencies": {
"asynckit": "^0.4.0", "asynckit": "^0.4.0",
"combined-stream": "^1.0.8", "combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0", "es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.2", "hasown": "^2.0.4",
"mime-types": "^2.1.12" "mime-types": "^2.1.35"
}, },
"engines": { "engines": {
"node": ">= 6" "node": ">= 6"
} }
}, },
"node_modules/form-data/node_modules/hasown": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/format": { "node_modules/format": {
"version": "0.2.2", "version": "0.2.2",
"resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz",
@@ -14495,7 +14508,6 @@
"version": "2.3.2", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"optional": true, "optional": true,
"os": [ "os": [
+6 -5
View File
@@ -11,7 +11,7 @@
"body-parser": "^2.2.2", "body-parser": "^2.2.2",
"express": "^5.2.1", "express": "^5.2.1",
"follow-redirects": "^1.16.0", "follow-redirects": "^1.16.0",
"http-proxy-middleware": "^3.0.5", "http-proxy-middleware": "^3.0.7",
"node": "^20.19.5", "node": "^20.19.5",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"path-to-regexp": "^0.1.13" "path-to-regexp": "^0.1.13"
@@ -416,9 +416,10 @@
} }
}, },
"node_modules/http-proxy-middleware": { "node_modules/http-proxy-middleware": {
"version": "3.0.5", "version": "3.0.7",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-3.0.5.tgz", "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-3.0.7.tgz",
"integrity": "sha512-GLZZm1X38BPY4lkXA01jhwxvDoOkkXqjgVyUzVxiEK4iuRu03PZoYHhHRwxnfhQMDuaxi3vVri0YgSro/1oWqg==", "integrity": "sha512-iwbQltVlx8bCrqePUM8C+hllHvdawVhQJaLrj1X7qllkvFQdXFsr16pW/mo9+JDVjN+QO2XUx9jd8SmoFkE5qw==",
"license": "MIT",
"dependencies": { "dependencies": {
"@types/http-proxy": "^1.17.15", "@types/http-proxy": "^1.17.15",
"debug": "^4.3.6", "debug": "^4.3.6",
@@ -428,7 +429,7 @@
"micromatch": "^4.0.8" "micromatch": "^4.0.8"
}, },
"engines": { "engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0" "node": "^14.18.0 || ^16.10.0 || >=18.0.0"
} }
}, },
"node_modules/http-proxy-middleware/node_modules/braces": { "node_modules/http-proxy-middleware/node_modules/braces": {
+1 -1
View File
@@ -14,7 +14,7 @@
"body-parser": "^2.2.2", "body-parser": "^2.2.2",
"express": "^5.2.1", "express": "^5.2.1",
"follow-redirects": "^1.16.0", "follow-redirects": "^1.16.0",
"http-proxy-middleware": "^3.0.5", "http-proxy-middleware": "^3.0.7",
"node": "^20.19.5", "node": "^20.19.5",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"path-to-regexp": "^0.1.13" "path-to-regexp": "^0.1.13"
+11 -10
View File
@@ -63,11 +63,15 @@ const dispatchPostMessage = (data: unknown, origin: string) => {
window.dispatchEvent(event); window.dispatchEvent(event);
}; };
// Deliberately invalid account name
const FAKE_ACCOUNT_NAME: string = "-FakeAccount-";
const FAKE_KEY: string = "<redacted-test-key>";
describe("HostedExplorer tryCosmosDB postMessage handler", () => { describe("HostedExplorer tryCosmosDB postMessage handler", () => {
it("accepts a valid SQL connection string from an allowed origin", async () => { it("accepts a valid SQL connection string from an allowed origin", async () => {
render(<App />); render(<App />);
const validConnStr = "AccountEndpoint=https://myaccount.documents.azure.com:443/;AccountKey=dGVzdGtleQ==;"; const validConnStr = `AccountEndpoint=https://${FAKE_ACCOUNT_NAME}.documents.azure.com:443/;AccountKey=${FAKE_KEY};`;
await act(async () => { await act(async () => {
dispatchPostMessage( dispatchPostMessage(
@@ -83,7 +87,7 @@ describe("HostedExplorer tryCosmosDB postMessage handler", () => {
it("accepts a valid Mongo connection string from an allowed origin", async () => { it("accepts a valid Mongo connection string from an allowed origin", async () => {
render(<App />); render(<App />);
const mongoConnStr = "mongodb://myaccount:dGVzdGtleQ==@myaccount.documents.azure.com:10255"; const mongoConnStr = `mongodb://${FAKE_ACCOUNT_NAME}:${FAKE_KEY}@${FAKE_ACCOUNT_NAME}.documents.azure.com:10255`;
await act(async () => { await act(async () => {
dispatchPostMessage( dispatchPostMessage(
@@ -99,8 +103,7 @@ describe("HostedExplorer tryCosmosDB postMessage handler", () => {
it("accepts a valid Cassandra connection string from an allowed origin", async () => { it("accepts a valid Cassandra connection string from an allowed origin", async () => {
render(<App />); render(<App />);
const cassandraConnStr = const cassandraConnStr = `AccountEndpoint=https://${FAKE_ACCOUNT_NAME}.cassandra.cosmosdb.azure.com:443/;AccountKey=${FAKE_KEY};`;
"AccountEndpoint=https://myaccount.cassandra.cosmosdb.azure.com:443/;AccountKey=dGVzdGtleQ==;";
await act(async () => { await act(async () => {
dispatchPostMessage( dispatchPostMessage(
@@ -116,8 +119,7 @@ describe("HostedExplorer tryCosmosDB postMessage handler", () => {
it("accepts a valid Table connection string from an allowed origin", async () => { it("accepts a valid Table connection string from an allowed origin", async () => {
render(<App />); render(<App />);
const tableConnStr = const tableConnStr = `DefaultEndpointsProtocol=https;AccountName=${FAKE_ACCOUNT_NAME};AccountKey=${FAKE_KEY};TableEndpoint=https://${FAKE_ACCOUNT_NAME}.table.cosmosdb.azure.com:443/;`;
"DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=dGVzdGtleQ==;TableEndpoint=https://myaccount.table.cosmosdb.azure.com:443/;";
await act(async () => { await act(async () => {
dispatchPostMessage( dispatchPostMessage(
@@ -133,8 +135,7 @@ describe("HostedExplorer tryCosmosDB postMessage handler", () => {
it("accepts a valid Gremlin connection string from an allowed origin", async () => { it("accepts a valid Gremlin connection string from an allowed origin", async () => {
render(<App />); render(<App />);
const gremlinConnStr = const gremlinConnStr = `AccountEndpoint=https://${FAKE_ACCOUNT_NAME}.documents.azure.com:443/;AccountKey=${FAKE_KEY};ApiKind=Gremlin;`;
"AccountEndpoint=https://myaccount.documents.azure.com:443/;AccountKey=dGVzdGtleQ==;ApiKind=Gremlin;";
await act(async () => { await act(async () => {
dispatchPostMessage( dispatchPostMessage(
@@ -150,7 +151,7 @@ describe("HostedExplorer tryCosmosDB postMessage handler", () => {
it("rejects messages from a disallowed origin", async () => { it("rejects messages from a disallowed origin", async () => {
render(<App />); render(<App />);
const validConnStr = "AccountEndpoint=https://myaccount.documents.azure.com:443/;AccountKey=dGVzdGtleQ==;"; const validConnStr = `AccountEndpoint=https://${FAKE_ACCOUNT_NAME}.documents.azure.com:443/;AccountKey=${FAKE_KEY};`;
await act(async () => { await act(async () => {
dispatchPostMessage( dispatchPostMessage(
@@ -198,7 +199,7 @@ describe("HostedExplorer tryCosmosDB postMessage handler", () => {
it("ignores messages with an unrelated type", async () => { it("ignores messages with an unrelated type", async () => {
render(<App />); render(<App />);
const validConnStr = "AccountEndpoint=https://myaccount.documents.azure.com:443/;AccountKey=dGVzdGtleQ==;"; const validConnStr = `AccountEndpoint=https://${FAKE_ACCOUNT_NAME}.documents.azure.com:443/;AccountKey=${FAKE_KEY};`;
await act(async () => { await act(async () => {
dispatchPostMessage({ type: "someOtherMessage", connectionString: validConnStr }, "https://cosmos.azure.com"); dispatchPostMessage({ type: "someOtherMessage", connectionString: validConnStr }, "https://cosmos.azure.com");