Skip to content
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3d06a86
Adding Redacted Keys
clr182 Jul 1, 2024
bce2bc4
Fixed check tests
clr182 Jul 1, 2024
6ec55a3
Fixed conflicting filters and redacted keys tests
clr182 Jul 1, 2024
9ac6180
update AutoRedactedKeysScenario.java
clr182 Jul 1, 2024
fc657ac
altered default filters string array in the configuration
clr182 Jul 4, 2024
6f774b4
update CHANGELOG
clr182 Jul 4, 2024
42ec37b
Changes to RedactedKeysMap
clr182 Jul 5, 2024
0fd5542
remove duplicate filter config
clr182 Jul 12, 2024
088aa21
fix fixed reference errors
clr182 Jul 12, 2024
1c840e1
config option broken
clr182 Jul 12, 2024
16760f5
Added tests to check regex matching
clr182 Jul 12, 2024
415f03e
scenario syntax fix
clr182 Jul 12, 2024
9b2e42d
Changes to add back public filters
clr182 Jul 17, 2024
4dab99e
updated variable names
clr182 Jul 18, 2024
9e9e84b
Update bugsnag/src/test/resources/logback.xml
clr182 Jul 18, 2024
c17fb7c
Merge branch 'next' into PLAT-4543-AddRedactedKeys
clr182 Jul 18, 2024
2fc8d1c
Converting to Patterns
clr182 Jul 23, 2024
a536540
update javadoc reference
clr182 Jul 23, 2024
a3e5fd0
setRedactedKey to string parameter rather than pattern for logback
clr182 Jul 24, 2024
cae37b6
adding in scenarios
clr182 Jul 24, 2024
0fc2727
Adding Pattern import to scenario
clr182 Jul 24, 2024
089e3a8
filters are appended to setRedactedKeys
clr182 Jul 25, 2024
d1dbada
Update bugsnag/src/main/java/com/bugsnag/Bugsnag.java
clr182 Jul 26, 2024
51203d1
Added concat list
clr182 Aug 8, 2024
b663e58
fix(redacted keys): changed RedactedKeysMap to retain logic for `filt…
lemnik Jun 30, 2025
7b2b506
Merge branch 'next' into PLAT-4543-AddRedactedKeys
lemnik Jun 30, 2025
17d7fda
chore(changelog): fixed the changelog after next sync
lemnik Jun 30, 2025
1b7b28c
chore(checkstyle): fixed checkstyle errors
lemnik Jun 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## TBD

### Changed

- Renamed the configuration option `filters` to `redactedKeys`. `filters` is now marked as deprecated and will be removed in the next major release. [#217](https://github.com/bugsnag/bugsnag-java/pull/217)

### Bug Fixes

* Update `BugsnagImportSelector` to allow major versions that do not have a minor version.
fixes [issue #211](https://github.com/bugsnag/bugsnag-java/issues/211).
[#213](https://github.com/bugsnag/bugsnag-java/pull/213)
Expand Down
20 changes: 19 additions & 1 deletion bugsnag/src/main/java/com/bugsnag/Bugsnag.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,32 @@ public void setEndpoint(String endpoint) {
* Use this when you want to ensure sensitive information, such as passwords
* or credit card information is stripped from metaData you send to Bugsnag.
* Any keys in metaData which contain these strings will be marked as
* [FILTERED] when send to Bugsnag.
* [REDACTED] when send to Bugsnag.
* @deprecated to be removed and replaced with setRedactedKeys
*
* @param filters a list of String keys to filter from metaData
*/
@Deprecated
public void setFilters(String... filters) {
config.filters = filters;
setRedactedKeys(filters);
}

/**
* Set which keys should be redacted when sending metaData to Bugsnag.
* Use this when you want to ensure sensitive information, such as passwords
* or credit card information is stripped from metaData you send to Bugsnag.
* Any keys in metaData which contain these strings will be marked as
* [REDACTED] when send to Bugsnag.
*
* @param redactedKeys a list of String keys to be redacted from metaData
*/
public void setRedactedKeys(String... redactedKeys) {
config.redactedKeys = redactedKeys;
}



/**
* Set which exception classes should be ignored (not sent) by Bugsnag.
*
Expand Down
42 changes: 34 additions & 8 deletions bugsnag/src/main/java/com/bugsnag/BugsnagAppender.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class BugsnagAppender extends UnsynchronizedAppenderBase<ILoggingEvent> {
/** Bugsnag error server endpoint. */
private String endpoint;

/** Property names that should be filtered out before sending to Bugsnag servers. */
private Set<String> filteredProperties = new HashSet<String>();
/** Property names that should be redacted out before sending to Bugsnag servers. */
private Set<String> redactedKeys = new HashSet<String>();

/** Exception classes to be ignored. */
private Set<String> ignoredClasses = new HashSet<String>();
Expand Down Expand Up @@ -254,8 +254,8 @@ private Bugsnag createBugsnag() {
bugsnag.setTimeout(timeout);
}

if (filteredProperties.size() > 0) {
bugsnag.setFilters(filteredProperties.toArray(new String[0]));
if (redactedKeys.size() > 0) {
bugsnag.setRedactedKeys(redactedKeys.toArray(new String[0]));
}

bugsnag.setIgnoreClasses(ignoredClasses.toArray(new String[0]));
Expand Down Expand Up @@ -375,23 +375,49 @@ public void setEndpoint(String endpoint) {

/**
* @see Bugsnag#setFilters(String...)
* @deprecated use #setRedactedKey(String) instead
*/
@Deprecated
public void setFilteredProperty(String filter) {
this.filteredProperties.add(filter);
this.redactedKeys.add(filter);

if (bugsnag != null) {
bugsnag.setFilters(this.filteredProperties.toArray(new String[0]));
bugsnag.setRedactedKeys(this.redactedKeys.toArray(new String[0]));
}
}

/**
* @see Bugsnag#setFilters(String...)
* @deprecated use #setRedactedKeys(String) instead
*/
@Deprecated
public void setFilteredProperties(String filters) {
this.filteredProperties.addAll(split(filters));
this.redactedKeys.addAll(split(filters));

if (bugsnag != null) {
bugsnag.setFilters(this.filteredProperties.toArray(new String[0]));
bugsnag.setRedactedKeys(this.redactedKeys.toArray(new String[0]));
}
}

/**
* @see Bugsnag#setRedactedKeys(String...)
*/
public void setRedactedKey(String redactedKey) {
this.redactedKeys.add(redactedKey);

if (bugsnag != null) {
bugsnag.setRedactedKeys(this.redactedKeys.toArray(new String[0]));
}
}

/**
* @see Bugsnag#setRedactedKeys(String...)
*/
public void setRedactedKeys(String redactedKeys) {
this.redactedKeys.addAll(split(redactedKeys));

if (bugsnag != null) {
bugsnag.setRedactedKeys(this.redactedKeys.toArray(new String[0]));
}
}

Expand Down
1 change: 1 addition & 0 deletions bugsnag/src/main/java/com/bugsnag/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class Configuration {
public Delivery delivery = new AsyncHttpDelivery(SyncHttpDelivery.DEFAULT_NOTIFY_ENDPOINT);
public Delivery sessionDelivery =
new AsyncHttpDelivery(SyncHttpDelivery.DEFAULT_SESSION_ENDPOINT);
public String[] redactedKeys = new String[]{"password", "secret", "Authorization", "Cookie"};
public String[] filters = new String[]{"password", "secret", "Authorization", "Cookie"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be appropriate to set this to the same instance rather than a different array with the same content. Just in case anyone is amending elements in the array.

Suggested change
public String[] redactedKeys = new String[]{"password", "secret", "Authorization", "Cookie"};
public String[] filters = new String[]{"password", "secret", "Authorization", "Cookie"};
public String[] redactedKeys = new String[]{"password", "secret", "Authorization", "Cookie"};
public String[] filters = redactedKeys;

public String[] ignoreClasses;
public String[] notifyReleaseStages = null;
Expand Down
4 changes: 2 additions & 2 deletions bugsnag/src/main/java/com/bugsnag/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.bugsnag.serialization.Expose;

import com.bugsnag.util.FilteredMap;
import com.bugsnag.util.RedactedKeysMap;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -126,7 +126,7 @@ public Map<String, String> getUser() {

@Expose
public Map<String, Object> getMetaData() {
return new FilteredMap(diagnostics.metaData, Arrays.asList(config.filters));
return new RedactedKeysMap(diagnostics.metaData, Arrays.asList(config.redactedKeys));
}

@Expose
Expand Down
122 changes: 0 additions & 122 deletions bugsnag/src/main/java/com/bugsnag/util/FilteredMap.java

This file was deleted.

Loading