diff --git a/MIGRATION.md b/MIGRATION.md
index 06a40b167305..34f089dc8a12 100644
--- a/MIGRATION.md
+++ b/MIGRATION.md
@@ -255,6 +255,8 @@ Sentry.addBreadcrumb({
> 'ignoreUrls' was renamed to 'blacklistUrls'. 'ignoreErrors', which has a similar name was not renamed. [Docs](https://docs.sentry.io/error-reporting/configuration/?platform=browser#blacklist-urls) and [Decluttering Sentry](https://docs.sentry.io/platforms/javascript/#decluttering-sentry)
+> 'blacklistUrls' has since been renamed to 'excludedUrls'
+
_Old_:
```js
diff --git a/packages/browser/examples/app.js b/packages/browser/examples/app.js
index a6035444c43a..21630e6d98bd 100644
--- a/packages/browser/examples/app.js
+++ b/packages/browser/examples/app.js
@@ -37,9 +37,9 @@ Sentry.init({
// An array of strings or regexps that'll be used to ignore specific errors based on their type/message
ignoreErrors: [/PickleRick_\d\d/, 'RangeError'],
// An array of strings or regexps that'll be used to ignore specific errors based on their origin url
- blacklistUrls: ['external-lib.js'],
+ excludedUrls: ['external-lib.js'],
// An array of strings or regexps that'll be used to allow specific errors based on their origin url
- whitelistUrls: ['http://localhost:5000', 'https://browser.sentry-cdn'],
+ includedUrls: ['http://localhost:5000', 'https://browser.sentry-cdn'],
// Debug mode with valuable initialization/lifecycle informations.
debug: true,
// Whether SDK should be enabled or not.
@@ -93,7 +93,7 @@ Sentry.init({
// Testing code, irrelevant vvvvv
document.addEventListener('DOMContentLoaded', () => {
- document.querySelector('#blacklist-url').addEventListener('click', () => {
+ document.querySelector('#excluded-url').addEventListener('click', () => {
const script = document.createElement('script');
script.crossOrigin = 'anonymous';
script.src =
@@ -101,7 +101,7 @@ document.addEventListener('DOMContentLoaded', () => {
document.body.appendChild(script);
});
- document.querySelector('#whitelist-url').addEventListener('click', () => {
+ document.querySelector('#included-url').addEventListener('click', () => {
const script = document.createElement('script');
script.crossOrigin = 'anonymous';
script.src =
diff --git a/packages/browser/examples/index.html b/packages/browser/examples/index.html
index a6f3915b2d84..d49b7e210ed7 100644
--- a/packages/browser/examples/index.html
+++ b/packages/browser/examples/index.html
@@ -20,8 +20,8 @@
-
-
+
+
diff --git a/packages/browser/src/backend.ts b/packages/browser/src/backend.ts
index a7c5847fa1a8..6834d269ff54 100644
--- a/packages/browser/src/backend.ts
+++ b/packages/browser/src/backend.ts
@@ -12,16 +12,18 @@ import { FetchTransport, XHRTransport } from './transports';
export interface BrowserOptions extends Options {
/**
* A pattern for error URLs which should not be sent to Sentry.
- * To whitelist certain errors instead, use {@link Options.whitelistUrls}.
+ * To include certain errors instead, use {@link Options.includedUrls}.
* By default, all errors will be sent.
*/
+ excludedUrls?: Array;
blacklistUrls?: Array;
/**
* A pattern for error URLs which should exclusively be sent to Sentry.
- * This is the opposite of {@link Options.blacklistUrls}.
+ * This is the opposite of {@link Options.excludedUrls}.
* By default, all errors will be sent.
*/
+ includedUrls?: Array;
whitelistUrls?: Array;
}
diff --git a/packages/browser/src/sdk.ts b/packages/browser/src/sdk.ts
index 074d308c8918..b56ab343d05f 100644
--- a/packages/browser/src/sdk.ts
+++ b/packages/browser/src/sdk.ts
@@ -77,6 +77,9 @@ export function init(options: BrowserOptions = {}): void {
if (options.defaultIntegrations === undefined) {
options.defaultIntegrations = defaultIntegrations;
}
+ // Deprecate, but still support old exclusion/inclusion types
+ options.excludedUrls = options.excludedUrls || options.blacklistUrls;
+ options.includedUrls = options.includedUrls || options.whitelistUrls;
if (options.release === undefined) {
const window = getGlobalObject();
// This supports the variable that sentry-webpack-plugin injects
diff --git a/packages/browser/test/integration/suites/config.js b/packages/browser/test/integration/suites/config.js
index 3ba82a06c3fc..984da16003f7 100644
--- a/packages/browser/test/integration/suites/config.js
+++ b/packages/browser/test/integration/suites/config.js
@@ -21,10 +21,10 @@ describe("config", function() {
* > bar.js file called a function in baz.js
* > baz.js threw an error
*
- * foo.js is blacklisted in the `init` call (init.js), thus we filter it
+ * foo.js is excluded in the `init` call (init.js), thus we filter it
* */
- var urlWithBlacklistedUrl = new Error("filter");
- urlWithBlacklistedUrl.stack =
+ var urlWithExcludedUrl = new Error("filter");
+ urlWithExcludedUrl.stack =
"Error: bar\n" +
" at http://localhost:5000/foo.js:7:19\n" +
" at bar(http://localhost:5000/bar.js:2:3)\n" +
@@ -35,17 +35,17 @@ describe("config", function() {
* > bar-pass.js file called a function in baz-pass.js
* > baz-pass.js threw an error
*
- * foo-pass.js is *not* blacklisted in the `init` call (init.js), thus we don't filter it
+ * foo-pass.js is *not* excluded in the `init` call (init.js), thus we don't filter it
* */
- var urlWithoutBlacklistedUrl = new Error("pass");
- urlWithoutBlacklistedUrl.stack =
+ var urlWithoutExcludedUrl = new Error("pass");
+ urlWithoutExcludedUrl.stack =
"Error: bar\n" +
" at http://localhost:5000/foo-pass.js:7:19\n" +
" at bar(http://localhost:5000/bar-pass.js:2:3)\n" +
" at baz(http://localhost:5000/baz-pass.js:2:9)\n";
- Sentry.captureException(urlWithBlacklistedUrl);
- Sentry.captureException(urlWithoutBlacklistedUrl);
+ Sentry.captureException(urlWithExcludedUrl);
+ Sentry.captureException(urlWithoutExcludedUrl);
}).then(function(summary) {
assert.lengthOf(summary.events, 1);
assert.equal(summary.events[0].exception.values[0].type, "Error");
diff --git a/packages/core/src/integrations/inboundfilters.ts b/packages/core/src/integrations/inboundfilters.ts
index 99ece511eac5..093a4ede220a 100644
--- a/packages/core/src/integrations/inboundfilters.ts
+++ b/packages/core/src/integrations/inboundfilters.ts
@@ -8,10 +8,10 @@ const DEFAULT_IGNORE_ERRORS = [/^Script error\.?$/, /^Javascript error: Script e
/** JSDoc */
interface InboundFiltersOptions {
- blacklistUrls?: Array;
+ excludedUrls?: Array;
ignoreErrors?: Array;
ignoreInternal?: boolean;
- whitelistUrls?: Array;
+ includedUrls?: Array;
}
/** Inbound filters configurable by the user */
@@ -61,17 +61,17 @@ export class InboundFilters implements Integration {
);
return true;
}
- if (this._isBlacklistedUrl(event, options)) {
+ if (this._isExcludedUrl(event, options)) {
logger.warn(
- `Event dropped due to being matched by \`blacklistUrls\` option.\nEvent: ${getEventDescription(
+ `Event dropped due to being matched by \`excludedUrls\` option.\nEvent: ${getEventDescription(
event,
)}.\nUrl: ${this._getEventFilterUrl(event)}`,
);
return true;
}
- if (!this._isWhitelistedUrl(event, options)) {
+ if (!this._isIncludedUrl(event, options)) {
logger.warn(
- `Event dropped due to not being matched by \`whitelistUrls\` option.\nEvent: ${getEventDescription(
+ `Event dropped due to not being matched by \`includedUrls\` option.\nEvent: ${getEventDescription(
event,
)}.\nUrl: ${this._getEventFilterUrl(event)}`,
);
@@ -113,36 +113,36 @@ export class InboundFilters implements Integration {
}
/** JSDoc */
- private _isBlacklistedUrl(event: Event, options: InboundFiltersOptions = {}): boolean {
+ private _isExcludedUrl(event: Event, options: InboundFiltersOptions = {}): boolean {
// TODO: Use Glob instead?
- if (!options.blacklistUrls || !options.blacklistUrls.length) {
+ if (!options.excludedUrls || !options.excludedUrls.length) {
return false;
}
const url = this._getEventFilterUrl(event);
- return !url ? false : options.blacklistUrls.some(pattern => isMatchingPattern(url, pattern));
+ return !url ? false : options.excludedUrls.some(pattern => isMatchingPattern(url, pattern));
}
/** JSDoc */
- private _isWhitelistedUrl(event: Event, options: InboundFiltersOptions = {}): boolean {
+ private _isIncludedUrl(event: Event, options: InboundFiltersOptions = {}): boolean {
// TODO: Use Glob instead?
- if (!options.whitelistUrls || !options.whitelistUrls.length) {
+ if (!options.includedUrls || !options.includedUrls.length) {
return true;
}
const url = this._getEventFilterUrl(event);
- return !url ? true : options.whitelistUrls.some(pattern => isMatchingPattern(url, pattern));
+ return !url ? true : options.includedUrls.some(pattern => isMatchingPattern(url, pattern));
}
/** JSDoc */
private _mergeOptions(clientOptions: InboundFiltersOptions = {}): InboundFiltersOptions {
return {
- blacklistUrls: [...(this._options.blacklistUrls || []), ...(clientOptions.blacklistUrls || [])],
+ excludedUrls: [...(this._options.excludedUrls || []), ...(clientOptions.excludedUrls || [])],
ignoreErrors: [
...(this._options.ignoreErrors || []),
...(clientOptions.ignoreErrors || []),
...DEFAULT_IGNORE_ERRORS,
],
ignoreInternal: typeof this._options.ignoreInternal !== 'undefined' ? this._options.ignoreInternal : true,
- whitelistUrls: [...(this._options.whitelistUrls || []), ...(clientOptions.whitelistUrls || [])],
+ includedUrls: [...(this._options.includedUrls || []), ...(clientOptions.includedUrls || [])],
};
}
diff --git a/packages/core/test/lib/integrations/inboundfilters.test.ts b/packages/core/test/lib/integrations/inboundfilters.test.ts
index 14b06bc138c6..44c9d859762f 100644
--- a/packages/core/test/lib/integrations/inboundfilters.test.ts
+++ b/packages/core/test/lib/integrations/inboundfilters.test.ts
@@ -18,38 +18,38 @@ describe('InboundFilters', () => {
expect(inboundFilters._shouldDropEvent({}, inboundFilters._mergeOptions())).toBe(true);
});
- it('should drop when url is blacklisted', () => {
- inboundFilters._isBlacklistedUrl = () => true;
+ it('should drop when url is excluded', () => {
+ inboundFilters._isExcludedUrl = () => true;
expect(inboundFilters._shouldDropEvent({}, inboundFilters._mergeOptions())).toBe(true);
});
- it('should drop when url is not whitelisted', () => {
- inboundFilters._isWhitelistedUrl = () => false;
+ it('should drop when url is not included', () => {
+ inboundFilters._isIncludedUrl = () => false;
expect(inboundFilters._shouldDropEvent({}, inboundFilters._mergeOptions())).toBe(true);
});
- it('should drop when url is not blacklisted, but also not whitelisted', () => {
- inboundFilters._isBlacklistedUrl = () => false;
- inboundFilters._isWhitelistedUrl = () => false;
+ it('should drop when url is not excluded, but also not included', () => {
+ inboundFilters._isExcludedUrl = () => false;
+ inboundFilters._isIncludedUrl = () => false;
expect(inboundFilters._shouldDropEvent({}, inboundFilters._mergeOptions())).toBe(true);
});
- it('should drop when url is blacklisted and whitelisted at the same time', () => {
- inboundFilters._isBlacklistedUrl = () => true;
- inboundFilters._isWhitelistedUrl = () => true;
+ it('should drop when url is excluded and included at the same time', () => {
+ inboundFilters._isExcludedUrl = () => true;
+ inboundFilters._isIncludedUrl = () => true;
expect(inboundFilters._shouldDropEvent({}, inboundFilters._mergeOptions())).toBe(true);
});
- it('should not drop when url is not blacklisted, but whitelisted', () => {
- inboundFilters._isBlacklistedUrl = () => false;
- inboundFilters._isWhitelistedUrl = () => true;
+ it('should not drop when url is not excluded, but included', () => {
+ inboundFilters._isExcludedUrl = () => false;
+ inboundFilters._isIncludedUrl = () => true;
expect(inboundFilters._shouldDropEvent({}, inboundFilters._mergeOptions())).toBe(false);
});
it('should not drop when any of checks dont match', () => {
inboundFilters._isIgnoredError = () => false;
- inboundFilters._isBlacklistedUrl = () => false;
- inboundFilters._isWhitelistedUrl = () => true;
+ inboundFilters._isExcludedUrl = () => false;
+ inboundFilters._isIncludedUrl = () => true;
expect(inboundFilters._shouldDropEvent({}, inboundFilters._mergeOptions())).toBe(false);
});
});
@@ -251,7 +251,7 @@ describe('InboundFilters', () => {
});
});
- describe('blacklistUrls/whitelistUrls', () => {
+ describe('excludedUrls/includedUrls', () => {
const messageEvent = {
message: 'wat',
stacktrace: {
@@ -284,20 +284,20 @@ describe('InboundFilters', () => {
it('should filter captured message based on its stack trace using string filter', () => {
expect(
- inboundFilters._isBlacklistedUrl(
+ inboundFilters._isExcludedUrl(
messageEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['https://awesome-analytics.io'],
- whitelistUrls: ['https://awesome-analytics.io'],
+ excludedUrls: ['https://awesome-analytics.io'],
+ includedUrls: ['https://awesome-analytics.io'],
}),
),
).toBe(true);
expect(
- inboundFilters._isWhitelistedUrl(
+ inboundFilters._isIncludedUrl(
messageEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['https://awesome-analytics.io'],
- whitelistUrls: ['https://awesome-analytics.io'],
+ excludedUrls: ['https://awesome-analytics.io'],
+ includedUrls: ['https://awesome-analytics.io'],
}),
),
).toBe(true);
@@ -305,18 +305,18 @@ describe('InboundFilters', () => {
it('should filter captured message based on its stack trace using regexp filter', () => {
expect(
- inboundFilters._isBlacklistedUrl(
+ inboundFilters._isExcludedUrl(
messageEvent,
inboundFilters._mergeOptions({
- blacklistUrls: [/awesome-analytics\.io/],
+ excludedUrls: [/awesome-analytics\.io/],
}),
),
).toBe(true);
expect(
- inboundFilters._isWhitelistedUrl(
+ inboundFilters._isIncludedUrl(
messageEvent,
inboundFilters._mergeOptions({
- blacklistUrls: [/awesome-analytics\.io/],
+ excludedUrls: [/awesome-analytics\.io/],
}),
),
).toBe(true);
@@ -324,24 +324,24 @@ describe('InboundFilters', () => {
it('should not filter captured messages with no stacktraces', () => {
expect(
- inboundFilters._isBlacklistedUrl(
+ inboundFilters._isExcludedUrl(
{
message: 'any',
},
inboundFilters._mergeOptions({
- blacklistUrls: ['https://awesome-analytics.io'],
- whitelistUrls: ['https://awesome-analytics.io'],
+ excludedUrls: ['https://awesome-analytics.io'],
+ includedUrls: ['https://awesome-analytics.io'],
}),
),
).toBe(false);
expect(
- inboundFilters._isWhitelistedUrl(
+ inboundFilters._isIncludedUrl(
{
message: 'any',
},
inboundFilters._mergeOptions({
- blacklistUrls: ['https://awesome-analytics.io'],
- whitelistUrls: ['https://awesome-analytics.io'],
+ excludedUrls: ['https://awesome-analytics.io'],
+ includedUrls: ['https://awesome-analytics.io'],
}),
),
).toBe(true);
@@ -349,20 +349,20 @@ describe('InboundFilters', () => {
it('should filter captured exception based on its stack trace using string filter', () => {
expect(
- inboundFilters._isBlacklistedUrl(
+ inboundFilters._isExcludedUrl(
exceptionEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['https://awesome-analytics.io'],
- whitelistUrls: ['https://awesome-analytics.io'],
+ excludedUrls: ['https://awesome-analytics.io'],
+ includedUrls: ['https://awesome-analytics.io'],
}),
),
).toBe(true);
expect(
- inboundFilters._isWhitelistedUrl(
+ inboundFilters._isIncludedUrl(
exceptionEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['https://awesome-analytics.io'],
- whitelistUrls: ['https://awesome-analytics.io'],
+ excludedUrls: ['https://awesome-analytics.io'],
+ includedUrls: ['https://awesome-analytics.io'],
}),
),
).toBe(true);
@@ -370,20 +370,20 @@ describe('InboundFilters', () => {
it('should filter captured exceptions based on its stack trace using regexp filter', () => {
expect(
- inboundFilters._isBlacklistedUrl(
+ inboundFilters._isExcludedUrl(
exceptionEvent,
inboundFilters._mergeOptions({
- blacklistUrls: [/awesome-analytics\.io/],
- whitelistUrls: [/awesome-analytics\.io/],
+ excludedUrls: [/awesome-analytics\.io/],
+ includedUrls: [/awesome-analytics\.io/],
}),
),
).toBe(true);
expect(
- inboundFilters._isWhitelistedUrl(
+ inboundFilters._isIncludedUrl(
exceptionEvent,
inboundFilters._mergeOptions({
- blacklistUrls: [/awesome-analytics\.io/],
- whitelistUrls: [/awesome-analytics\.io/],
+ excludedUrls: [/awesome-analytics\.io/],
+ includedUrls: [/awesome-analytics\.io/],
}),
),
).toBe(true);
@@ -391,20 +391,20 @@ describe('InboundFilters', () => {
it('should not filter events that doesnt pass the test', () => {
expect(
- inboundFilters._isBlacklistedUrl(
+ inboundFilters._isExcludedUrl(
exceptionEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['some-other-domain.com'],
- whitelistUrls: ['some-other-domain.com'],
+ excludedUrls: ['some-other-domain.com'],
+ includedUrls: ['some-other-domain.com'],
}),
),
).toBe(false);
expect(
- inboundFilters._isWhitelistedUrl(
+ inboundFilters._isIncludedUrl(
exceptionEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['some-other-domain.com'],
- whitelistUrls: ['some-other-domain.com'],
+ excludedUrls: ['some-other-domain.com'],
+ includedUrls: ['some-other-domain.com'],
}),
),
).toBe(false);
@@ -412,46 +412,46 @@ describe('InboundFilters', () => {
it('should be able to use multiple filters', () => {
expect(
- inboundFilters._isBlacklistedUrl(
+ inboundFilters._isExcludedUrl(
exceptionEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['some-other-domain.com', /awesome-analytics\.io/],
- whitelistUrls: ['some-other-domain.com', /awesome-analytics\.io/],
+ excludedUrls: ['some-other-domain.com', /awesome-analytics\.io/],
+ includedUrls: ['some-other-domain.com', /awesome-analytics\.io/],
}),
),
).toBe(true);
expect(
- inboundFilters._isWhitelistedUrl(
+ inboundFilters._isIncludedUrl(
exceptionEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['some-other-domain.com', /awesome-analytics\.io/],
- whitelistUrls: ['some-other-domain.com', /awesome-analytics\.io/],
+ excludedUrls: ['some-other-domain.com', /awesome-analytics\.io/],
+ includedUrls: ['some-other-domain.com', /awesome-analytics\.io/],
}),
),
).toBe(true);
});
- it('should not fail with malformed event event and default to false for isBlacklistedUrl and true for isWhitelistedUrl', () => {
+ it('should not fail with malformed event event and default to false for isExcludedUrl and true for isIncludedUrl', () => {
const malformedEvent = {
stacktrace: {
frames: undefined,
},
};
expect(
- inboundFilters._isBlacklistedUrl(
+ inboundFilters._isExcludedUrl(
malformedEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['https://awesome-analytics.io'],
- whitelistUrls: ['https://awesome-analytics.io'],
+ excludedUrls: ['https://awesome-analytics.io'],
+ includedUrls: ['https://awesome-analytics.io'],
}),
),
).toBe(false);
expect(
- inboundFilters._isWhitelistedUrl(
+ inboundFilters._isIncludedUrl(
malformedEvent,
inboundFilters._mergeOptions({
- blacklistUrls: ['https://awesome-analytics.io'],
- whitelistUrls: ['https://awesome-analytics.io'],
+ excludedUrls: ['https://awesome-analytics.io'],
+ includedUrls: ['https://awesome-analytics.io'],
}),
),
).toBe(true);
diff --git a/packages/utils/src/misc.ts b/packages/utils/src/misc.ts
index cc63caa8f165..0797e3a53c83 100644
--- a/packages/utils/src/misc.ts
+++ b/packages/utils/src/misc.ts
@@ -335,9 +335,9 @@ function _htmlElementAsString(el: unknown): string {
out.push(`.${classes[i]}`);
}
}
- const attrWhitelist = ['type', 'name', 'title', 'alt'];
- for (i = 0; i < attrWhitelist.length; i++) {
- key = attrWhitelist[i];
+ const includedAttrs = ['type', 'name', 'title', 'alt'];
+ for (i = 0; i < includedAttrs.length; i++) {
+ key = includedAttrs[i];
attr = elem.getAttribute(key);
if (attr) {
out.push(`[${key}="${attr}"]`);