Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/decode-uri-component…
Browse files Browse the repository at this point in the history
…-0.2.2
  • Loading branch information
ashwin-pc authored Dec 15, 2022
2 parents 13d31e8 + db87a95 commit 7f521f8
Show file tree
Hide file tree
Showing 49 changed files with 1,027 additions and 9,275 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build_and_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ jobs:
npm uninstall -g yarn
npm i -g yarn@1.22.10
# image has the latest chrome v99
- name: Setup chromedriver
run: yarn add --dev chromedriver@99.0.0
run: node scripts/upgrade_chromedriver.js

- name: Run bootstrap
run: yarn osd bootstrap
Expand Down Expand Up @@ -204,9 +203,8 @@ jobs:
npm uninstall -g yarn
npm i -g yarn@1.22.10
# image has the latest chrome v99
- name: Setup chromedriver
run: yarn add --dev chromedriver@106.0.1
run: node scripts/upgrade_chromedriver.js

- name: Run bootstrap
run: yarn osd bootstrap
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.ackrc
/.opensearch
/.chromium
/package.json.bak
.DS_Store
.node_binaries
.native_modules
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Vis Builder] Add field summary popovers ([#2682](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2682))
- [I18n] Register ru, ru-RU locale ([#2817](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2817))
- Add yarn opensearch arg to setup plugin dependencies ([#2544](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2544))
- [Multi DataSource] Test the connection to an external data source when creating or updating ([#2973](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2973))

### 🐛 Bug Fixes

Expand All @@ -70,14 +71,18 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Vis Builder] Fix empty workspace animation does not work in firefox ([#2853](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2853))
- Bumped `del` version to fix MacOS race condition ([#2847](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2873))
- [Build] Fixed "Last Access Time" not being set by `scanCopy` on Windows ([#2964](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2964))
- [Vis Builder] Add global data persistence for vis builder #2896 ([#2896](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2896))
- Update `leaflet-vega` and fix its usage ([#3005](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3005))
- [Table Visualization][BUG] Fix Url content display issue in table ([#2918](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2918))

### 🚞 Infrastructure

- Add CHANGELOG.md and related workflows ([#2414](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2414))
- Update backport custom branch name to utilize head template ([#2766](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2766))
- Re-enable CI workflows for feature branckes ([#2908](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2908))
- Add Windows CI workflows ([#2966](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2966))
- Add automatic selection of the appropriate version of chrome driver to run functional tests ([#2990](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2990))


### 📝 Documentation

Expand All @@ -86,10 +91,12 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [MD] Tweak multiple data source design doc [#2724](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2724)
- Corrected README and help command of osd-plugin-helpers ([#2810](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2810))
- Add `current-usage.md` and more details to `README.md` of `charts` plugin ([#2695](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2695))
- [Doc] Add readme for global query persistence ([#3001](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3001))

### 🛠 Maintenance

- Adding @zhongnansu as maintainer. ([#2590](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2590))
- Removes `minimatch` manual resolution ([#3019](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3019))

### 🪛 Refactoring

Expand All @@ -103,6 +110,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [BWC Tests] Add BWC tests for 2.5.0 ([#2890](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2890))
- Fix incorrect validation of time values in JUnit Reporter ([#2965](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2965))
- Make tests covering plugin installation on cluster snapshots work across platforms ([#2994](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2994))
- Correct the linting logic for `no-restricted-path` to ignore trailing slashes ([#3020](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3020))
- [Tests] Bumps `chromedriver` to v107 ([#3017](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3017))

## [2.x]

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update && \
# Specify the version of Chrome that matches the version of chromedriver in the package.json.
# A list of Chrome versions can be found here:
# https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable
ARG CHROME_VERSION=100.0.4896.127-1
ARG CHROME_VERSION=107.0.5304.121-1
RUN curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& wget -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \
&& apt-get update \
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| Yan Zeng | [zengyan-amazon](https://github.com/zengyan-amazon) | Amazon |
| Kristen Tian | [kristenTian](https://github.com/kristenTian) | Amazon |
| Zhongnan Su | [zhongnansu](https://github.com/zhongnansu) | Amazon |
| Manasvini B Suryanarayana | [manasvinibs](https://github.com/manasvinibs) | Amazon |

## Emeritus

Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
"**/@types/node": "^14.17.32",
"**/ansi-regex": "^5.0.1",
"**/async": "^3.2.3",
"**/axios": "^0.27.2",
"**/d3-color": "^3.1.0",
"**/glob-parent": "^6.0.0",
"**/hoist-non-react-statics": "^3.3.2",
Expand All @@ -93,8 +92,7 @@
"**/qs": "^6.10.3",
"**/trim": "^0.0.3",
"**/typescript": "4.0.2",
"**/unset-value": "^2.0.1",
"**/minimatch": "^3.0.5"
"**/unset-value": "^2.0.1"
},
"workspaces": {
"packages": [
Expand Down Expand Up @@ -260,12 +258,12 @@
"@types/bluebird": "^3.1.1",
"@types/chance": "^1.0.0",
"@types/cheerio": "^0.22.31",
"@types/chromedriver": "^81.0.0",
"@types/color": "^3.0.0",
"@types/d3": "^3.5.43",
"@types/dedent": "^0.7.0",
"@types/deep-freeze-strict": "^1.1.0",
"@types/delete-empty": "^2.0.0",
"@types/dompurify": "^2.3.3",
"@types/elasticsearch": "^5.0.33",
"@types/enzyme": "^3.10.7",
"@types/eslint": "^6.1.3",
Expand Down Expand Up @@ -347,13 +345,14 @@
"chai": "3.5.0",
"chance": "1.0.18",
"cheerio": "0.22.0",
"chromedriver": "^100.0.0",
"chromedriver": "^107.0.3",
"classnames": "2.3.1",
"compare-versions": "3.5.1",
"d3": "3.5.17",
"d3-cloud": "1.2.5",
"dedent": "^0.7.0",
"delete-empty": "^2.0.0",
"dompurify": "^2.4.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"enzyme-to-json": "^3.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function traverseToTopFolder(src, pattern) {
const srcIdx = src.lastIndexOf(path.sep);
src = src.slice(0, srcIdx);
}
return src.replace(/\\/g, '/');
return src.replace(/\\/g, '/').replace(/\/$/, '');
}

function isSameFolderOrDescendent(src, imported, pattern) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ ruleTester.run('@osd/eslint/no-restricted-paths', rule, {
},
],
},
{
code: 'import b from "testfiles/no_restricted_paths/server/deep/deeper/e.js"',
filename: path.join(__dirname, 'testfiles/no_restricted_paths/server/deep/d.js'),
options: [
{
basePath: __dirname,
zones: [
{
target: 'testfiles/**/server/**/*',
from: 'testfiles/**/server/**/*',
allowSameFolder: true,
},
],
},
],
},

// irrelevant function calls
{
Expand Down
49 changes: 49 additions & 0 deletions release-notes/opensearch-dashboards.release-notes-1.3.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Version 1.3.7 Release Notes

### 📈 Features/Enhancements

* [Windows] Facilitate building and running OSD and plugins on Windows platforms ([#2601](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2601))
* [Windows] Add helper functions to work around the differences of platforms ([#2681](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2681))
* [Windows] Add `@osd/cross-platform` package to standardize path handling across platforms ([#2703](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2703))

### 🛡 Security

* [CVE-2022-0144] Bump shelljs from 0.8.4 to 0.8.5 ([#2511](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2511))
* [Legacy Maps Plugin] Prevent reverse-tabnabbing ([#2540](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2540))
* [CVE-2022-3517] Bump minimatch from 3.0.4 to 3.0.5 and [IBM X-Force ID: 220063] unset-value from 1.0.1 to 2.0.1 ([#2640](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2640))
* [CVE-2022-0155] Bump follow-redirects to 1.15.2 ([#2653](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2653))
* [CVE-2022-0536] Bump follow-redirects to 1.15.2 ([#2653](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2653))
* [CVE-2021-24033] Remove storybook package ([#2660](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2660))
* [CVE-2021-42740] Remove storybook package ([#2660](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2660))
* [CVE-2022-23647] Bump prismjs to 1.29.0 ([#2668](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2668))
* [CVE-2022-37599] Bump loader-utils to 2.0.4 ([#2995](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2995))
* [CVE-2022-37603] Bump loader-utils to 2.0.4 ([#2995](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2995))

### 📝 Documentation

* Add the release runbook to RELEASING.md ([#2533](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2533))
* Security-CVEs fixes guidelines [#2674](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2674)
* Correct README and help command of osd-plugin-helpers ([#2810](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2810))

### 🐛 Bug Fixes

* [Chore] Visualize link fix [#2395](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2395)
* [BUG] Fix suggestion list cutoff issue ([#2607](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2607))
* Remove Leftover X Pack references ([#2638](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2638))
* Bump `del` version to fix MacOS race condition ([#2847](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2873))
* Temporary workaround for task-kill exceptions on Windows when it is passed a pid for a process that is already dead ([#2842](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2842))
* [Build] Fixed "Last Access Time" not being set by `scanCopy` on Windows ([#2964](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2964))
* Update `leaflet-vega` and fix its usage ([#3005](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3005))

### 🚞 Infrastructure

* Update backport custom branch name to utilize head template ([#2766](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2766))

### 🛠 Maintenance

* Increment version to 1.3.7 [#2528](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2528)

### 🔩 Tests

* Bump `chromedriver` to 106 to fix function test fail issue [#2514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2514)
* Fix incorrect validation of time values in JUnit Reporter ([#2965](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2965))
9 changes: 9 additions & 0 deletions release-notes/opensearch-dashboards.release-notes-2.4.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Version 2.4.1 Release Notes

### 🐛 Bug Fixes

* Update `leaflet-vega` and fix its usage ([#3005](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3005))

### 🔩 Tests

* Correct the linting logic for `no-restricted-path` to ignore trailing slashes ([#3020](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3020))
122 changes: 122 additions & 0 deletions scripts/upgrade_chromedriver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

/**
* Upgrades the chromedriver dev-dependency to the one supported by the version of Google Chrome
* installed on the machine.
*
* Usage: node scripts/upgrade_chromedriver.js [--install]
*/

/* eslint no-restricted-syntax: 0 */
const { execSync, spawnSync } = require('child_process');
const { createReadStream, createWriteStream, unlinkSync, renameSync, existsSync } = require('fs');
const { createInterface } = require('readline');

if (!process.argv.includes(__filename)) {
console.error('Usage: node scripts/upgrade_chromedriver.js [--install]');
process.exit(1);
}

const versionCheckCommands = [];

switch (process.platform) {
case 'win32':
versionCheckCommands.push(
'powershell "(Get-Item \\"$Env:Programfiles/Google/Chrome/Application/chrome.exe\\").VersionInfo.FileVersion"'
);
break;

case 'darwin':
versionCheckCommands.push(
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --version'
);
break;

default:
versionCheckCommands.push(
...[
'/usr/bin',
'/usr/local/bin',
'/usr/sbin',
'/usr/local/sbin',
'/opt/bin',
'/usr/bin/X11',
'/usr/X11R6/bin',
].flatMap((loc) =>
[
'google-chrome --version',
'google-chrome-stable --version',
'chromium --version',
'chromium-browser --version',
].map((cmd) => `${loc}/${cmd}`)
)
);
}

let versionCheckOutput;
versionCheckCommands.some((cmd) => {
try {
console.log(cmd);
versionCheckOutput = execSync(cmd, { encoding: 'utf8' })?.trim?.();
return true;
} catch (e) {
console.log('Failed to get version using', cmd);
}
});

// Versions 90+
const majorVersion = versionCheckOutput?.match?.(/(?:^|\s)(9\d|\d{3})\./)?.[1];

if (majorVersion) {
if (process.argv.includes('--install')) {
console.log(`Installing chromedriver@^${majorVersion}`);

spawnSync(`yarn add --dev chromedriver@^${majorVersion}`, {
stdio: 'inherit',
cwd: process.cwd(),
shell: true,
});
} else {
console.log(`Upgrading to chromedriver@^${majorVersion}`);

let upgraded = false;
const writeStream = createWriteStream('package.json.upgrading-chromedriver', { flags: 'w' });
const rl = createInterface({
input: createReadStream('package.json'),
crlfDelay: Infinity,
});
rl.on('line', (line) => {
if (line.includes('"chromedriver": "')) {
line = line.replace(
/"chromedriver":\s*"[~^]?\d[\d.]*\d"/,
`"chromedriver": "^${majorVersion}"`
);
upgraded = true;
}
writeStream.write(line + '\n', 'utf8');
});
rl.on('close', () => {
writeStream.end();
if (upgraded) {
// Remove any previous backups
if (existsSync('package.json.bak')) unlinkSync('package.json.bak');

renameSync('package.json', 'package.json.bak');
renameSync('package.json.upgrading-chromedriver', 'package.json');

console.log(`Backed up package.json and updated chromedriver to ${majorVersion}`);
} else {
unlinkSync('package.json.upgrading-chromedriver');
console.error(
`Failed to update chromedriver to ${majorVersion}. Try adding the \`--install\` switch.`
);
}
});
}
} else {
console.debug(versionCheckOutput);
console.error(`Failed to extract the version of the installed Google Chrome.`);
}
1 change: 1 addition & 0 deletions src/plugins/data_source/common/data_sources/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { SavedObjectAttributes } from 'src/core/types';

export interface DataSourceAttributes extends SavedObjectAttributes {
id?: string;
title: string;
description?: string;
endpoint: string;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data_source/server/client/client_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class OpenSearchClientPool {

constructor(private logger: Logger) {}

public async setup(config: DataSourcePluginConfigType): Promise<OpenSearchClientPoolSetup> {
public setup(config: DataSourcePluginConfigType): OpenSearchClientPoolSetup {
const logger = this.logger;
const { size } = config.clientPool;

Expand Down
Loading

0 comments on commit 7f521f8

Please sign in to comment.