Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V7: Rename filters -> redacted keys #704

Merged
merged 2 commits into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- Add static `Bugsnag` client interface [#685](https://github.com/bugsnag/bugsnag-js/pull/685)
- Add `getUser()` and `setUser()` methods to `Session` [#692](https://github.com/bugsnag/bugsnag-js/pull/692)
- Ensure automatic context is not used when `setContext(null)` has been called [#694](https://github.com/bugsnag/bugsnag-js/pull/694)
- Rename `filters` option to `redactedKeys` [#704](https://github.com/bugsnag/bugsnag-js/pull/704)

## 6.5.1 (2020-01-08)

Expand Down
2 changes: 1 addition & 1 deletion packages/browser/types/test/fixtures/all-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Bugsnag.init({
user: null,
metadata: {},
logger: undefined,
filters: ["foo",/bar/],
redactedKeys: ["foo",/bar/],
collectUserIp: true,
maxEvents: 10
})
2 changes: 1 addition & 1 deletion packages/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module.exports.schema = {
true
))
},
filters: {
redactedKeys: {
defaultValue: () => ['password'],
message: 'should be an array of strings|regexes',
validate: value =>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/types/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface Config {
enabledBreadcrumbTypes?: BreadcrumbType[];
enabledReleaseStages?: string[];
endpoints?: { notify: string; sessions: string };
filters?: Array<string | RegExp>;
redactedKeys?: Array<string | RegExp>;
onBreadcrumb?: OnBreadcrumbCallback | OnBreadcrumbCallback[];
onError?: OnErrorCallback | OnErrorCallback[];
onSession?: OnSessionCallback | OnSessionCallback[];
Expand Down
4 changes: 2 additions & 2 deletions packages/delivery-expo/delivery.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = (client, fetch = global.fetch) => {

let body, opts
try {
body = payload.event(event, client._config.filters)
body = payload.event(event, client._config.redactedKeys)
opts = {
method: 'POST',
headers: {
Expand Down Expand Up @@ -71,7 +71,7 @@ module.exports = (client, fetch = global.fetch) => {

let body, opts
try {
body = payload.session(session, client._config.filters)
body = payload.session(session, client._config.redactedKeys)
opts = {
method: 'POST',
headers: {
Expand Down
18 changes: 9 additions & 9 deletions packages/delivery-expo/test/delivery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('delivery: expo', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: `http://0.0.0.0:${server.address().port}/notify/` },
filters: []
redactedKeys: []
}
delivery({ _config: config, _logger: noopLogger }, fetch).sendEvent(payload, (err) => {
expect(err).toBe(null)
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('delivery: expo', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: 'blah', sessions: `http://0.0.0.0:${server.address().port}/sessions/` },
filters: []
redactedKeys: []
}
delivery({ _config: config, _logger: noopLogger }, fetch).sendSession(payload, (err) => {
expect(err).toBe(null)
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('delivery: expo', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: 'http://0.0.0.0:9999/notify/' },
filters: []
redactedKeys: []
}
let didLog = false
const log = () => { didLog = true }
Expand Down Expand Up @@ -170,7 +170,7 @@ describe('delivery: expo', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: `http://0.0.0.0:${server.address().port}/notify/` },
filters: []
redactedKeys: []
}
let didLog = false
const log = () => { didLog = true }
Expand Down Expand Up @@ -202,7 +202,7 @@ describe('delivery: expo', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { sessions: 'http://0.0.0.0:9999/sessions/' },
filters: []
redactedKeys: []
}
let didLog = false
const log = () => { didLog = true }
Expand Down Expand Up @@ -238,7 +238,7 @@ describe('delivery: expo', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: `http://0.0.0.0:${server.address().port}/notify/` },
filters: []
redactedKeys: []
}
let didLog = false
const log = () => { didLog = true }
Expand Down Expand Up @@ -276,7 +276,7 @@ describe('delivery: expo', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: `http://0.0.0.0:${server.address().port}/notify/` },
filters: []
redactedKeys: []
}
let didLog = false
const log = () => { didLog = true }
Expand Down Expand Up @@ -306,7 +306,7 @@ describe('delivery: expo', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: 'https://some-address.com' },
filters: []
redactedKeys: []
}
delivery({ _config: config, _logger: noopLogger }, fetch).sendEvent(payload, (err) => {
expect(err).not.toBeTruthy()
Expand Down Expand Up @@ -388,7 +388,7 @@ describe('delivery: expo', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: 'http://some-address.com' },
filters: []
redactedKeys: []
}
let n = 0
const _done = () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/delivery-node/delivery.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (client) => ({
'Bugsnag-Payload-Version': '4',
'Bugsnag-Sent-At': isoDate()
},
body: payload.event(event, client._config.filters),
body: payload.event(event, client._config.redactedKeys),
agent: client._config.agent
}, (err, body) => _cb(err))
} catch (e) {
Expand All @@ -40,7 +40,7 @@ module.exports = (client) => ({
'Bugsnag-Payload-Version': '1',
'Bugsnag-Sent-At': isoDate()
},
body: payload.session(session, client._config.filters),
body: payload.session(session, client._config.redactedKeys),
agent: client._config.agent
}, err => _cb(err))
} catch (e) {
Expand Down
10 changes: 5 additions & 5 deletions packages/delivery-node/test/delivery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('delivery:node', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: `http://0.0.0.0:${server.address().port}/notify/` },
filters: []
redactedKeys: []
}
delivery({ _logger: {}, _config: config }).sendEvent(payload, (err) => {
expect(err).toBe(null)
Expand Down Expand Up @@ -62,7 +62,7 @@ describe('delivery:node', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: 'blah', sessions: `http://0.0.0.0:${server.address().port}/sessions/` },
filters: []
redactedKeys: []
}
delivery({ _logger: {}, _config: config }).sendSession(payload, (err) => {
expect(err).toBe(null)
Expand All @@ -86,7 +86,7 @@ describe('delivery:node', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: 'http://0.0.0.0:9999/notify/' },
filters: []
redactedKeys: []
}
let didLog = false
const log = () => { didLog = true }
Expand All @@ -109,7 +109,7 @@ describe('delivery:node', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: `http://0.0.0.0:${server.address().port}/notify/` },
filters: []
redactedKeys: []
}
let didLog = false
const log = () => { didLog = true }
Expand All @@ -134,7 +134,7 @@ describe('delivery:node', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: `http://0.0.0.0:${server.address().port}/notify/` },
filters: []
redactedKeys: []
}
let didLog = false
const log = () => { didLog = true }
Expand Down
4 changes: 2 additions & 2 deletions packages/delivery-x-domain-request/delivery.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = (client, win = window) => ({
req.open('POST', url)
setTimeout(() => {
try {
req.send(payload.event(event, client._config.filters))
req.send(payload.event(event, client._config.redactedKeys))
} catch (e) {
client._logger.error(e)
cb(e)
Expand All @@ -27,7 +27,7 @@ module.exports = (client, win = window) => ({
req.open('POST', url)
setTimeout(() => {
try {
req.send(payload.session(session, client._config.filters))
req.send(payload.session(session, client._config.redactedKeys))
} catch (e) {
this._logger.error(e)
cb(e)
Expand Down
4 changes: 2 additions & 2 deletions packages/delivery-x-domain-request/test/delivery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('delivery:XDomainRequest', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: '/echo/' },
filters: []
redactedKeys: []
}
delivery({ logger: {}, _config: config }, window).sendEvent(payload, (err) => {
expect(err).toBe(null)
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('delivery:XDomainRequest', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: '/echo/', sessions: '/sessions/' },
filters: []
redactedKeys: []
}
delivery({ logger: {}, _config: config }, window).sendSession(payload, (err) => {
expect(err).toBe(null)
Expand Down
4 changes: 2 additions & 2 deletions packages/delivery-xml-http-request/delivery.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = (client, win = window) => ({
req.setRequestHeader('Bugsnag-Api-Key', event.apiKey || client._config.apiKey)
req.setRequestHeader('Bugsnag-Payload-Version', '4')
req.setRequestHeader('Bugsnag-Sent-At', isoDate())
req.send(payload.event(event, client._config.filters))
req.send(payload.event(event, client._config.redactedKeys))
} catch (e) {
client._logger.error(e)
}
Expand All @@ -31,7 +31,7 @@ module.exports = (client, win = window) => ({
req.setRequestHeader('Bugsnag-Api-Key', client._config.apiKey)
req.setRequestHeader('Bugsnag-Payload-Version', '1')
req.setRequestHeader('Bugsnag-Sent-At', isoDate())
req.send(payload.session(session, client._config.filters))
req.send(payload.session(session, client._config.redactedKeys))
} catch (e) {
client._logger.error(e)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/delivery-xml-http-request/test/delivery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('delivery:XMLHttpRequest', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: '/echo/' },
filters: []
redactedKeys: []
}
delivery({ logger: {}, _config: config }, { XMLHttpRequest }).sendEvent(payload, (err) => {
expect(err).toBe(null)
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('delivery:XMLHttpRequest', () => {
const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: '/', sessions: '/echo/' },
filters: []
redactedKeys: []
}
delivery({ _config: config, logger: {} }, { XMLHttpRequest }).sendSession(payload, (err) => {
expect(err).toBe(null)
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/types/test/fixtures/all-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ Bugsnag.init({
user: null,
metadata: {},
logger: undefined,
filters: ["foo",/bar/]
redactedKeys: ["foo",/bar/]
})
2 changes: 1 addition & 1 deletion test/browser/features/fixtures/redaction/script/b.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Bugsnag.init({
apiKey: API_KEY,
endpoints: { notify: ENDPOINT, sessions: '/noop' },
filters: [ 'api_key', 'secret' ]
redactedKeys: [ 'api_key', 'secret' ]
})
</script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/browser/features/fixtures/redaction/script/c.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Bugsnag.init({
apiKey: API_KEY,
endpoints: { notify: ENDPOINT, sessions: '/noop' },
filters: [ 'stacktrace', 'secret' ]
redactedKeys: [ 'stacktrace', 'secret' ]
})
</script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/browser/features/fixtures/redaction/script/d.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Bugsnag.init({
apiKey: API_KEY,
endpoints: { notify: ENDPOINT, sessions: '/noop' },
filters: [ /details\d/ ]
redactedKeys: [ /details\d/ ]
})
</script>
</head>
Expand Down