Skip to content

Commit

Permalink
Anonymize password in subscription query (#1752)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasmar00 authored Oct 19, 2023
1 parent 4e9f8c7 commit cfa050f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ public List<Subscription> getAllSubscriptions() {
.map(Topic::getName)
.map(this::listSubscriptions)
.flatMap(List::stream)
.map(Subscription::anonymize)
.collect(toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public static Object[][] subscriptionData() {
{"{\"query\": {\"or\": [{\"name\": \"subscription1\"}, {\"endpoint\": \"http://endpoint1\"}]}}", asList(1, 3)},
{"{\"query\": {\"owner.id\": \"Team Alpha\"}}", asList(4)},
{"{\"query\": {\"owner.id\": {\"like\": \".*Alph.*\"}}}", asList(4)},
{"{\"query\": {\"endpoint\": \".*password.*\"}}", asList()},
};
}

Expand All @@ -147,13 +148,13 @@ topic, enrichSubscription(subscription(topic.getName(), "subscription1"), "http:
topic, enrichSubscription(subscription(topic.getName(), "subscription2"), "http://endpoint2")
);
Subscription subscription3 = operations.createSubscription(
topic, enrichSubscription(subscription(topic.getName(), "subTestScription3"), "http://endpoint1")
topic, enrichSubscription(subscription(topic.getName(), "subTestScription3"), "http://login:password@endpoint1")
);
Subscription subscription4 = operations.createSubscription(topic, enrichSubscription(subscription(topic.getName(), "subscription4")
.withOwner(new OwnerId("Plaintext", "Team Alpha")), "http://endpoint2")
);

List<Subscription> subscriptions = asList(subscription1, subscription2, subscription3, subscription4);
List<Subscription> subscriptions = asList(subscription1, subscription2, subscription3.anonymize(), subscription4);

// when
List<Subscription> found = management.query().querySubscriptions(query);
Expand Down

0 comments on commit cfa050f

Please sign in to comment.