{
render() {
- const { className, markdown = '', openLinksInNewTab, whiteListedRules, ...rest } = this.props;
+ const {
+ className,
+ markdown = '',
+ openLinksInNewTab,
+ whiteListedRules,
+ allowListedRules,
+ ...rest
+ } = this.props;
const classes = classNames('osdMarkdown__body', className);
- const markdownRenderer = markdownFactory(whiteListedRules, openLinksInNewTab);
+ const markdownRenderer = markdownFactory(whiteListedRules, allowListedRules, openLinksInNewTab);
const renderedMarkdown = markdownRenderer(markdown);
return (
= {
exposeToBrowser: {
ui: true,
},
- deprecations: ({ renameFromRoot }) => [
+ deprecations: ({ renameFromRoot, renameFromRootWithoutMap }) => [
// timelion.enabled and timelion_vis.enabled deprecation
renameFromRoot('timelion.enabled', 'vis_type_timeline.enabled'),
renameFromRoot('timelion_vis.enabled', 'vis_type_timeline.enabled'),
@@ -61,6 +61,11 @@ export const config: PluginConfigDescriptor = {
renameFromRoot('timelion.ui.enabled', 'vis_type_timeline.ui.enabled', true),
renameFromRoot('vis_type_timelion.ui.enabled', 'vis_type_timeline.ui.enabled', true),
renameFromRoot('timeline.ui.enabled', 'vis_type_timeline.ui.enabled', true),
+
+ renameFromRootWithoutMap(
+ 'vis_type_timeline.graphiteBlockedIPs',
+ 'vis_type_timeline.graphiteDeniedIPs'
+ ),
],
};
export const plugin = (initializerContext: PluginInitializerContext) =>
diff --git a/src/plugins/vis_type_timeline/server/lib/config_manager.ts b/src/plugins/vis_type_timeline/server/lib/config_manager.ts
index 8d5e9edc0eb6..048db67422a6 100644
--- a/src/plugins/vis_type_timeline/server/lib/config_manager.ts
+++ b/src/plugins/vis_type_timeline/server/lib/config_manager.ts
@@ -36,7 +36,6 @@ export class ConfigManager {
private opensearchShardTimeout: number = 0;
private graphiteAllowedUrls: string[] = [];
private graphiteBlockedIPs: string[] = [];
-
constructor(config: PluginInitializerContext['config']) {
config.create>().subscribe((configUpdate) => {
this.graphiteAllowedUrls = configUpdate.graphiteAllowedUrls || [];
diff --git a/src/plugins/vis_type_timeline/server/series_functions/fixtures/tl_config.js b/src/plugins/vis_type_timeline/server/series_functions/fixtures/tl_config.js
index 55a1f644936c..e9fc8d4c1487 100644
--- a/src/plugins/vis_type_timeline/server/series_functions/fixtures/tl_config.js
+++ b/src/plugins/vis_type_timeline/server/series_functions/fixtures/tl_config.js
@@ -54,6 +54,7 @@ export default function () {
opensearchShardTimeout: moment.duration(30000),
allowedGraphiteUrls: ['https://www.hostedgraphite.com/UID/ACCESS_KEY/graphite'],
+
blockedGraphiteIPs: [],
});
diff --git a/src/plugins/vis_type_timeline/server/series_functions/graphite.test.js b/src/plugins/vis_type_timeline/server/series_functions/graphite.test.js
index e5ef1c987992..e251f3963a17 100644
--- a/src/plugins/vis_type_timeline/server/series_functions/graphite.test.js
+++ b/src/plugins/vis_type_timeline/server/series_functions/graphite.test.js
@@ -90,7 +90,17 @@ describe('graphite', function () {
});
});
- it('should return error message if both allowlist and blocklist are disabled', function () {
+ it('should return error message if both allowlist and blockedlist are disabled', function () {
+ return invoke(fn, [], {
+ settings: { 'timeline:graphite.url': 'http://127.0.0.1' },
+ allowedGraphiteUrls: [],
+ blockedGraphiteIPs: [],
+ }).catch((e) => {
+ expect(e.message).to.eql(MISS_CHECKLIST_MESSAGE);
+ });
+ });
+
+ it('should return error message if both allowlist and denylist are disabled', function () {
return invoke(fn, [], {
settings: { 'timeline:graphite.url': 'http://127.0.0.1' },
allowedGraphiteUrls: [],
@@ -122,7 +132,7 @@ describe('graphite', function () {
});
});
- it('setting with matched blocklist url should return error message', function () {
+ it('setting with matched denylist url should return error message', function () {
return invoke(fn, [], {
settings: { 'timeline:graphite.url': 'http://127.0.0.1' },
allowedGraphiteUrls: [],
@@ -132,7 +142,7 @@ describe('graphite', function () {
});
});
- it('setting with matched blocklist localhost should return error message', function () {
+ it('setting with matched denylist localhost should return error message', function () {
return invoke(fn, [], {
settings: { 'timeline:graphite.url': 'http://localhost' },
allowedGraphiteUrls: [],
@@ -142,7 +152,7 @@ describe('graphite', function () {
});
});
- it('setting with unmatched blocklist https url should return result', function () {
+ it('setting with unmatched denylist https url should return result', function () {
return invoke(fn, [], {
settings: { 'timeline:graphite.url': 'https://opensearch.org/' },
allowedGraphiteUrls: [],
@@ -152,7 +162,7 @@ describe('graphite', function () {
});
});
- it('setting with unmatched blocklist ftp url should return result', function () {
+ it('setting with unmatched denylist ftp url should return result', function () {
return invoke(fn, [], {
settings: { 'timeline:graphite.url': 'ftp://www.opensearch.org' },
allowedGraphiteUrls: [],
@@ -182,7 +192,7 @@ describe('graphite', function () {
});
});
- it('with both allowlist and blocklist, setting not in blocklist but in allowlist should return result', function () {
+ it('with both allowlist and denylist, setting not in denylist but in allowlist should return result', function () {
return invoke(fn, [], {
settings: {
'timeline:graphite.url': 'https://www.hostedgraphite.com/UID/ACCESS_KEY/graphite',
@@ -194,7 +204,7 @@ describe('graphite', function () {
});
});
- it('with conflict allowlist and blocklist, setting in blocklist and in allowlist should return error message', function () {
+ it('with conflict allowlist and denylist, setting in denylist and in allowlist should return error message', function () {
return invoke(fn, [], {
settings: {
'timeline:graphite.url': 'http://127.0.0.1',
diff --git a/src/plugins/vis_type_timeline/server/series_functions/helpers/graphite_helper.js b/src/plugins/vis_type_timeline/server/series_functions/helpers/graphite_helper.js
index ceb19a0f819e..ace4987eb3b5 100644
--- a/src/plugins/vis_type_timeline/server/series_functions/helpers/graphite_helper.js
+++ b/src/plugins/vis_type_timeline/server/series_functions/helpers/graphite_helper.js
@@ -26,16 +26,16 @@ function getIpAddress(urlObject) {
return null;
}
/**
- * Check whether customer input URL is blocked
+ * Check whether customer input URL is denied
* This function first check the format of URL, URL has be in the format as
* scheme://server/path/resource otherwise an TypeError would be thrown
* Then IPCIDR check if a specific IP address fall in the
* range of an IP address block
* @param {string} configuredUrls
- * @param {Array|string} blockedIPs
- * @returns {boolean} true if the configuredUrl is blocked
+ * @param {Array|string} deniedIPs
+ * @returns {boolean} true if the configuredUrl is denied
*/
-function isBlockedURL(configuredUrl, blockedIPs) {
+function isDeniedURL(configuredUrl, deniedIPs) {
let configuredUrlObject;
try {
configuredUrlObject = new URL(configuredUrl);
@@ -46,28 +46,28 @@ function isBlockedURL(configuredUrl, blockedIPs) {
if (!ip) {
return true;
}
- const isBlocked = blockedIPs.some((blockedIP) => new IPCIDR(blockedIP).contains(ip));
- return isBlocked;
+ const isDenied = deniedIPs.some((deniedIP) => new IPCIDR(deniedIP).contains(ip));
+ return isDenied;
}
/**
- * Check configured url using blocklist and allowlist
+ * Check configured url using denylist and allowlist
* If allowlist is used, return false if allowlist does not contain configured url
- * If blocklist is used, return false if blocklist contains configured url
- * If both allowlist and blocklist are used, check blocklist first then allowlist
- * @param {Array|string} blockedIPs
+ * If denylist is used, return false if denylist contains configured url
+ * If both allowlist and denylist are used, check denylist first then allowlist
+ * @param {Array|string} deniedIPs
* @param {Array|string} allowedUrls
* @param {string} configuredUrls
* @returns {boolean} true if the configuredUrl is valid
*/
-function isValidConfig(blockedIPs, allowedUrls, configuredUrl) {
- if (blockedIPs.length === 0) {
+function isValidConfig(deniedIPs, allowedUrls, configuredUrl) {
+ if (deniedIPs.length === 0) {
if (!allowedUrls.includes(configuredUrl)) return false;
} else if (allowedUrls.length === 0) {
- if (exports.isBlockedURL(configuredUrl, blockedIPs)) return false;
+ if (exports.isDeniedURL(configuredUrl, deniedIPs)) return false;
} else {
- if (exports.isBlockedURL(configuredUrl, blockedIPs) || !allowedUrls.includes(configuredUrl))
+ if (exports.isDeniedURL(configuredUrl, deniedIPs) || !allowedUrls.includes(configuredUrl))
return false;
}
return true;
}
-export { getIpAddress, isBlockedURL, isValidConfig };
+export { getIpAddress, isDeniedURL, isValidConfig };
diff --git a/src/plugins/vis_type_timeline/server/series_functions/helpers/graphite_helper.test.js b/src/plugins/vis_type_timeline/server/series_functions/helpers/graphite_helper.test.js
index 20053c7bc212..9c1ca1a9c176 100644
--- a/src/plugins/vis_type_timeline/server/series_functions/helpers/graphite_helper.test.js
+++ b/src/plugins/vis_type_timeline/server/series_functions/helpers/graphite_helper.test.js
@@ -6,32 +6,32 @@
import * as helper from './graphite_helper';
describe('graphite_helper', function () {
- it('valid Url should not be blocked and isBlockedURL should return false', function () {
- expect(helper.isBlockedURL('https://opensearch.org', ['127.0.0.0/8'])).toEqual(false);
+ it('valid Url should not be blocked and isDeniedURL should return false', function () {
+ expect(helper.isDeniedURL('https://opensearch.org', ['127.0.0.0/8'])).toEqual(false);
});
- it('blocked Url should be blocked and isBlockedURL should return true', function () {
- expect(helper.isBlockedURL('https://127.0.0.1', ['127.0.0.0/8'])).toEqual(true);
+ it('blocked Url should be blocked and isDeniedURL should return true', function () {
+ expect(helper.isDeniedURL('https://127.0.0.1', ['127.0.0.0/8'])).toEqual(true);
});
- it('invalid Url should be blocked and isBlockedURL should return true', function () {
- expect(helper.isBlockedURL('www.opensearch.org', ['127.0.0.0/8'])).toEqual(true);
+ it('invalid Url should be blocked and isDeniedURL should return true', function () {
+ expect(helper.isDeniedURL('www.opensearch.org', ['127.0.0.0/8'])).toEqual(true);
});
- it('blocklist should be checked if blocklist is enabled', function () {
- jest.spyOn(helper, 'isBlockedURL').mockReturnValueOnce(false);
+ it('denylist should be checked if denylist is enabled', function () {
+ jest.spyOn(helper, 'isDeniedURL').mockReturnValueOnce(false);
helper.isValidConfig(['127.0.0.0/8'], [], 'https://opensearch.org');
- expect(helper.isBlockedURL).toBeCalled();
+ expect(helper.isDeniedURL).toBeCalled();
});
- it('blocklist should be checked it both allowlist and blocklist are enabled', function () {
- jest.spyOn(helper, 'isBlockedURL').mockReturnValueOnce(false);
+ it('denylist should be checked it both allowlist and denylist are enabled', function () {
+ jest.spyOn(helper, 'isDeniedURL').mockReturnValueOnce(false);
helper.isValidConfig(
['127.0.0.0/8'],
['https://www.hostedgraphite.com/UID/ACCESS_KEY/graphite'],
'https://opensearch.org'
);
- expect(helper.isBlockedURL).toBeCalled();
+ expect(helper.isDeniedURL).toBeCalled();
});
it('with only allowlist, isValidConfig should return false for Url not in the allowlist', function () {
@@ -54,15 +54,15 @@ describe('graphite_helper', function () {
).toEqual(true);
});
- it('with only blocklist, isValidConfig should return false for Url in the blocklist', function () {
+ it('with only denylist, isValidConfig should return false for Url in the denylist', function () {
expect(helper.isValidConfig(['127.0.0.0/8'], [], 'https://127.0.0.1')).toEqual(false);
});
- it('with only blocklist, isValidConfig should return true for Url not in the blocklist', function () {
+ it('with only denylist, isValidConfig should return true for Url not in the denylist', function () {
expect(helper.isValidConfig(['127.0.0.0/8'], [], 'https://opensearch.org')).toEqual(true);
});
- it('with both blocklist and allowlist, isValidConfig should return false if allowlist check fails', function () {
+ it('with both denylist and allowlist, isValidConfig should return false if allowlist check fails', function () {
expect(
helper.isValidConfig(
['127.0.0.0/8'],
@@ -72,7 +72,7 @@ describe('graphite_helper', function () {
).toEqual(false);
});
- it('with both blocklist and allowlist, isValidConfig should return false if blocklist check fails', function () {
+ it('with both denylist and allowlist, isValidConfig should return false if denylist check fails', function () {
expect(
helper.isValidConfig(
['127.0.0.0/8'],
@@ -82,7 +82,7 @@ describe('graphite_helper', function () {
).toEqual(false);
});
- it('with conflict blocklist and allowlist, isValidConfig should return false if blocklist check fails', function () {
+ it('with conflict denylist and allowlist, isValidConfig should return false if denylist check fails', function () {
expect(
helper.isValidConfig(['127.0.0.0/8'], ['https://127.0.0.1'], 'https://127.0.0.1')
).toEqual(false);
diff --git a/src/plugins/vis_type_timeseries/common/ui_restrictions.ts b/src/plugins/vis_type_timeseries/common/ui_restrictions.ts
index a153c4329a5b..d9e0c6a80e32 100644
--- a/src/plugins/vis_type_timeseries/common/ui_restrictions.ts
+++ b/src/plugins/vis_type_timeseries/common/ui_restrictions.ts
@@ -37,19 +37,25 @@ import { PANEL_TYPES } from './panel_types';
*/
export enum RESTRICTIONS_KEYS {
/**
- * Key for getting the white listed group by fields from the UIRestrictions object.
+ * Key for getting the allow listed group by fields from the UIRestrictions object.
*/
+ /** @deprecated use ALLOW_LISTED_GROUP_BY_FIELDS*/
WHITE_LISTED_GROUP_BY_FIELDS = 'whiteListedGroupByFields',
+ ALLOW_LISTED_GROUP_BY_FIELDS = 'allowListedGroupByFields',
/**
- * Key for getting the white listed metrics from the UIRestrictions object.
+ * Key for getting the allow listed metrics from the UIRestrictions object.
*/
+ /** @deprecated use ALLOW_LISTED_METRICS*/
WHITE_LISTED_METRICS = 'whiteListedMetrics',
+ ALLOW_LISTED_METRICS = 'allowListedMetrics',
/**
- * Key for getting the white listed Time Range modes from the UIRestrictions object.
+ * Key for getting the allow listed Time Range modes from the UIRestrictions object.
*/
+ /** @deprecated use ALLOW_LISTED_TIMERANGE_MODES*/
WHITE_LISTED_TIMERANGE_MODES = 'whiteListedTimerangeModes',
+ ALLOW_LISTED_TIMERANGE_MODES = 'allowListedTimerangeModes',
}
export interface UIRestrictions {
diff --git a/src/plugins/vis_type_timeseries/public/application/lib/check_ui_restrictions.js b/src/plugins/vis_type_timeseries/public/application/lib/check_ui_restrictions.js
index e2128d77c758..379643fcc726 100644
--- a/src/plugins/vis_type_timeseries/public/application/lib/check_ui_restrictions.js
+++ b/src/plugins/vis_type_timeseries/public/application/lib/check_ui_restrictions.js
@@ -53,7 +53,7 @@ const checkUIRestrictions = (key, restrictions = DEFAULT_UI_RESTRICTION, type) =
* @return {boolean}
*/
export const isMetricEnabled = (key, restrictions) => {
- return checkUIRestrictions(key, restrictions, RESTRICTIONS_KEYS.WHITE_LISTED_METRICS);
+ return checkUIRestrictions(key, restrictions, RESTRICTIONS_KEYS.ALLOW_LISTED_METRICS);
};
/**
@@ -69,7 +69,7 @@ export const isFieldEnabled = (field, metricType, restrictions = DEFAULT_UI_REST
if (isMetricEnabled(metricType, restrictions)) {
return checkUIRestrictions(
field,
- restrictions[RESTRICTIONS_KEYS.WHITE_LISTED_METRICS],
+ restrictions[RESTRICTIONS_KEYS.ALLOW_LISTED_METRICS],
metricType
);
}
@@ -86,7 +86,7 @@ export const isFieldEnabled = (field, metricType, restrictions = DEFAULT_UI_REST
* @return {boolean}
*/
export const isGroupByFieldsEnabled = (key, restrictions) => {
- return checkUIRestrictions(key, restrictions, RESTRICTIONS_KEYS.WHITE_LISTED_GROUP_BY_FIELDS);
+ return checkUIRestrictions(key, restrictions, RESTRICTIONS_KEYS.ALLOW_LISTED_GROUP_BY_FIELDS);
};
/**
@@ -99,5 +99,5 @@ export const isGroupByFieldsEnabled = (key, restrictions) => {
* @return {boolean}
*/
export const isTimerangeModeEnabled = (key, restrictions) => {
- return checkUIRestrictions(key, restrictions, RESTRICTIONS_KEYS.WHITE_LISTED_TIMERANGE_MODES);
+ return checkUIRestrictions(key, restrictions, RESTRICTIONS_KEYS.ALLOW_LISTED_TIMERANGE_MODES);
};
diff --git a/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.js
index 7807d0fb54c3..85c1de00557e 100644
--- a/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.js
+++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.js
@@ -49,23 +49,41 @@ export class DefaultSearchCapabilities {
return null;
}
+ /** @deprecated use allowListedMetrics*/
get whiteListedMetrics() {
return this.createUiRestriction();
}
+ /** @deprecated use allowListedGroupByFields*/
get whiteListedGroupByFields() {
return this.createUiRestriction();
}
+ /** @deprecated use allowListedTimerangeMode*/
get whiteListedTimerangeModes() {
return this.createUiRestriction();
}
+ get allowListedMetrics() {
+ return this.createUiRestriction();
+ }
+
+ get allowListedGroupByFields() {
+ return this.createUiRestriction();
+ }
+
+ get allowListedTimerangeModes() {
+ return this.createUiRestriction();
+ }
+
get uiRestrictions() {
return {
[RESTRICTIONS_KEYS.WHITE_LISTED_METRICS]: this.whiteListedMetrics,
[RESTRICTIONS_KEYS.WHITE_LISTED_GROUP_BY_FIELDS]: this.whiteListedGroupByFields,
[RESTRICTIONS_KEYS.WHITE_LISTED_TIMERANGE_MODES]: this.whiteListedTimerangeModes,
+ [RESTRICTIONS_KEYS.ALLOW_LISTED_METRICS]: this.allowListedMetrics,
+ [RESTRICTIONS_KEYS.ALLOW_LISTED_GROUP_BY_FIELDS]: this.allowListedGroupByFields,
+ [RESTRICTIONS_KEYS.ALLOW_LISTED_TIMERANGE_MODES]: this.allowListedTimerangeModes,
};
}
diff --git a/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.test.js
index b318a06755f0..0bfe242a0d08 100644
--- a/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.test.js
+++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.test.js
@@ -53,6 +53,9 @@ describe('DefaultSearchCapabilities', () => {
whiteListedMetrics: { '*': true },
whiteListedGroupByFields: { '*': true },
whiteListedTimerangeModes: { '*': true },
+ allowListedMetrics: { '*': true },
+ allowListedGroupByFields: { '*': true },
+ allowListedTimerangeModes: { '*': true },
});
});
diff --git a/src/plugins/vis_type_vega/public/services.ts b/src/plugins/vis_type_vega/public/services.ts
index a8c9079372c3..d241b66d472c 100644
--- a/src/plugins/vis_type_vega/public/services.ts
+++ b/src/plugins/vis_type_vega/public/services.ts
@@ -57,4 +57,4 @@ export const [getMapsLegacyConfig, setMapsLegacyConfig] = createGetterSetter