Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion launchdarkly-android-client-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ext.versions = [
"jacksonDatabind": "2.10.5.1",
"junit": "4.13",
"launchdarklyJavaSdkCommon": "2.4.0",
"launchdarklyJavaSdkInternal": "1.12.1",
"launchdarklyJavaSdkInternal": "1.12.2",
"launchdarklyLogging": "1.1.1",
"okhttp": "4.12.0",
"testHelpers": "2.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,33 @@ public void allAttributesPrivateLeavesOnlyTheKey() throws Exception {
}
}

@Test
public void allAttributesPrivateReportsEachNameAsTheReferenceThatNamesIt() throws Exception {
// redactedAttributes holds attribute references. An attribute literally named "/ssn" is
// the reference "/~1ssn"; "/ssn" would be the path to an attribute named "ssn". A name
// without a leading slash is already a reference to itself, so it is reported unchanged.
LDContext context = LDContext.builder("user-key")
.set("/ssn", "123-45-6789")
.set("/a~b", "secret")
.set("c/d", "value")
.build();
try (HttpServer server = startEventsServer()) {
EventProcessor eventProcessor = makeEventProcessor(server,
eventsBuilder(DEFAULT_CAPACITY).allAttributesPrivate(true), true);
try {
eventProcessor.recordIdentifyEvent(context);

LDValue delivered = requireEventOfKind(flushAndCollect(eventProcessor, server),
"identify").get("context");

assertEquals(LDValue.ofNull(), delivered.get("/ssn"));
assertEquals(redacted("/~1a~0b", "/~1ssn", "c/d"), redactedAttributes(delivered));
} finally {
eventProcessor.close();
}
}
}

@Test
public void aPrivateSubAttributeRedactsOnlyThatProperty() throws Exception {
try (HttpServer server = startEventsServer()) {
Expand Down
2 changes: 1 addition & 1 deletion shared-test-code/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ext.versions = [
"androidAnnotation": "1.2.0",
"gson": "2.13.2",
"junit": "4.13",
"launchdarklyJavaSdkInternal": "1.12.1",
"launchdarklyJavaSdkInternal": "1.12.2",
"launchdarklyLogging": "1.1.1",
]

Expand Down
Loading