Skip to content

Commit 7884ebd

Browse files
gally47patrickmannkolin-newbykodjo-anipah
authored
Rename "URL Whitelist" to "URL Allowlist" (#22903)
* Rename "URL Whitelist" to "URL Allowlist" * fix build * rename whitelist to allowlist * CL and upgrading.md * rename telemtry event to URL_ALLOW_LIST_UPDATED * fix eslint issues * back-compat support --------- Co-authored-by: Patrick Mann <[email protected]> Co-authored-by: patrickmann <[email protected]> Co-authored-by: Kolin Newby <[email protected]> Co-authored-by: Maxwell <[email protected]>
1 parent 37044d8 commit 7884ebd

File tree

66 files changed

+699
-651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+699
-651
lines changed

UPGRADING.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ is now used as the primary color for elements like buttons and badges in the UI.
8585

8686
The following REST API changes have been made.
8787

88-
| Endpoint | Description |
89-
|-----------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
90-
| `GET /<endpoint>` | description |
91-
| `GET /<endpoint>` | description |
88+
| Endpoint | Description |
89+
|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
90+
| `GET /system/urlallowlist` | Renamed from `GET /system/urlwhitelist`. The corresponding REST API permission is renamed to `urlallowlist:read`. |
91+
| `PUT /system/urlallowlist` | Renamed from `PUT /system/urlwhitelist` . The corresponding REST API permission is renamed to `urlallowlist:write` |
92+
| `POST /system/urlallowlist/check` | Renamed from `POST /system/urlwhitelist/check` |
93+
| `POST /system/urlallowlist/generate_regex` | Renamed from `POST /system/urlwhitelist/generate_regex` |
94+
| `GET /<endpoint>` | description |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type = "f"
2+
message = "Rename `whitelist` to `allowlist` in UI, API, and codebase."
3+
4+
pulls = ["22903", "Graylog2/graylog-plugin-enterprise#11590"]
5+
issues = ["21034"]

full-backend-tests/src/test/java/org/graylog/events/processor/aggregation/EventNotificationsResourceIT.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@
1717
package org.graylog.events.processor.aggregation;
1818

1919
import com.github.rholder.retry.RetryException;
20-
import org.assertj.core.api.Assertions;
2120
import org.graylog.testing.completebackend.Lifecycle;
22-
import org.graylog.testing.completebackend.WebhookRequest;
2321
import org.graylog.testing.completebackend.WebhookServerInstance;
2422
import org.graylog.testing.completebackend.apis.GraylogApis;
2523
import org.graylog.testing.containermatrix.SearchServer;
2624
import org.graylog.testing.containermatrix.annotations.ContainerMatrixTest;
2725
import org.graylog.testing.containermatrix.annotations.ContainerMatrixTestsConfiguration;
2826
import org.junit.jupiter.api.BeforeEach;
2927

30-
import java.util.List;
3128
import java.util.concurrent.ExecutionException;
3229

3330
@ContainerMatrixTestsConfiguration(serverLifecycle = Lifecycle.CLASS, searchVersions = {SearchServer.DATANODE_DEV}, withWebhookServerEnabled = true)
@@ -42,7 +39,7 @@ public EventNotificationsResourceIT(GraylogApis graylogApis) {
4239

4340
@BeforeEach
4441
void setUp() {
45-
graylogApis.system().urlWhitelist(webhookTester.getContainerizedCollectorURI());
42+
graylogApis.system().urlAllowlist(webhookTester.getContainerizedCollectorURI());
4643
}
4744

4845
@ContainerMatrixTest

full-backend-tests/src/test/java/org/graylog/events/processor/aggregation/PivotAggregationSearchIT.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void tearDown() {
8181

8282
@ContainerMatrixTest
8383
void testPivotAggregationSearchAllKnownFields() throws ExecutionException, RetryException {
84-
apis.system().urlWhitelist(webhookTester.getContainerizedCollectorURI());
84+
apis.system().urlAllowlist(webhookTester.getContainerizedCollectorURI());
8585

8686
final String notificationID = apis.eventsNotifications().createHttpNotification(webhookTester.getContainerizedCollectorURI());
8787

@@ -100,7 +100,7 @@ void testPivotAggregationSearchAllKnownFields() throws ExecutionException, Retry
100100

101101
@ContainerMatrixTest
102102
void testPivotAggregationSearchOneUnknownField() throws ExecutionException, RetryException {
103-
apis.system().urlWhitelist(webhookTester.getContainerizedCollectorURI());
103+
apis.system().urlAllowlist(webhookTester.getContainerizedCollectorURI());
104104

105105
final String notificationID = apis.eventsNotifications().createHttpNotification(webhookTester.getContainerizedCollectorURI());
106106

@@ -120,7 +120,7 @@ void testPivotAggregationSearchOneUnknownField() throws ExecutionException, Retr
120120

121121
@ContainerMatrixTest
122122
void testPivotAggregationSearchAllUnknownFields() throws ExecutionException, RetryException {
123-
apis.system().urlWhitelist(webhookTester.getContainerizedCollectorURI());
123+
apis.system().urlAllowlist(webhookTester.getContainerizedCollectorURI());
124124

125125
final String notificationID = apis.eventsNotifications().createHttpNotification(webhookTester.getContainerizedCollectorURI());
126126

@@ -140,7 +140,7 @@ void testPivotAggregationSearchAllUnknownFields() throws ExecutionException, Ret
140140

141141
@ContainerMatrixTest
142142
void testPivotAggregationIsolatedToStream() throws ExecutionException, RetryException {
143-
apis.system().urlWhitelist(webhookTester.getContainerizedCollectorURI());
143+
apis.system().urlAllowlist(webhookTester.getContainerizedCollectorURI());
144144

145145
final String notificationID = apis.eventsNotifications().createHttpNotification(webhookTester.getContainerizedCollectorURI());
146146

@@ -165,7 +165,7 @@ void testPivotAggregationIsolatedToStream() throws ExecutionException, RetryExce
165165

166166
@ContainerMatrixTest
167167
void testPivotAggregationWithGroupingIsIsolatedToStream() throws ExecutionException, RetryException {
168-
apis.system().urlWhitelist(webhookTester.getContainerizedCollectorURI());
168+
apis.system().urlAllowlist(webhookTester.getContainerizedCollectorURI());
169169

170170
final String notificationID = apis.eventsNotifications().createHttpNotification(webhookTester.getContainerizedCollectorURI());
171171

graylog2-server/src/main/java/org/graylog/events/notifications/types/HTTPEventNotification.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.fasterxml.jackson.core.JsonProcessingException;
2020
import com.fasterxml.jackson.databind.ObjectMapper;
2121
import com.google.common.collect.ImmutableList;
22+
import jakarta.inject.Inject;
2223
import okhttp3.HttpUrl;
2324
import okhttp3.MediaType;
2425
import okhttp3.OkHttpClient;
@@ -37,13 +38,11 @@
3738
import org.graylog2.plugin.system.NodeId;
3839
import org.graylog2.security.encryption.EncryptedValueService;
3940
import org.graylog2.shared.bindings.providers.ParameterizedHttpClientProvider;
40-
import org.graylog2.system.urlwhitelist.UrlWhitelistNotificationService;
41-
import org.graylog2.system.urlwhitelist.UrlWhitelistService;
41+
import org.graylog2.system.urlallowlist.UrlAllowlistNotificationService;
42+
import org.graylog2.system.urlallowlist.UrlAllowlistService;
4243
import org.slf4j.Logger;
4344
import org.slf4j.LoggerFactory;
4445

45-
import jakarta.inject.Inject;
46-
4746
import java.io.IOException;
4847

4948
import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
@@ -65,14 +64,14 @@ public interface Factory extends EventNotification.Factory<HTTPEventNotification
6564

6665
@Inject
6766
public HTTPEventNotification(EventNotificationService notificationCallbackService, ObjectMapper objectMapper,
68-
UrlWhitelistService whitelistService,
69-
UrlWhitelistNotificationService urlWhitelistNotificationService,
67+
UrlAllowlistService allowlistService,
68+
UrlAllowlistNotificationService urlAllowlistNotificationService,
7069
EncryptedValueService encryptedValueService,
7170
EventsConfigurationProvider configurationProvider,
7271
NotificationService notificationService,
7372
NodeId nodeId,
7473
final ParameterizedHttpClientProvider parameterizedHttpClientProvider) {
75-
super(whitelistService, urlWhitelistNotificationService, encryptedValueService, notificationService, nodeId);
74+
super(allowlistService, urlAllowlistNotificationService, encryptedValueService, notificationService, nodeId);
7675
this.notificationCallbackService = notificationCallbackService;
7776
this.objectMapper = objectMapper;
7877
this.configurationProvider = configurationProvider;

graylog2-server/src/main/java/org/graylog/events/notifications/types/HTTPEventNotificationV2.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
import org.graylog2.security.encryption.EncryptedValueService;
4646
import org.graylog2.shared.bindings.providers.ObjectMapperProvider;
4747
import org.graylog2.shared.bindings.providers.ParameterizedHttpClientProvider;
48-
import org.graylog2.system.urlwhitelist.UrlWhitelistNotificationService;
49-
import org.graylog2.system.urlwhitelist.UrlWhitelistService;
48+
import org.graylog2.system.urlallowlist.UrlAllowlistNotificationService;
49+
import org.graylog2.system.urlallowlist.UrlAllowlistService;
5050
import org.slf4j.Logger;
5151
import org.slf4j.LoggerFactory;
5252

@@ -103,16 +103,16 @@ public interface Factory extends EventNotification.Factory<HTTPEventNotification
103103

104104
@Inject
105105
public HTTPEventNotificationV2(EventNotificationService notificationCallbackService, ObjectMapperProvider objectMapperProvider,
106-
UrlWhitelistService whitelistService,
107-
UrlWhitelistNotificationService urlWhitelistNotificationService,
106+
UrlAllowlistService allowlistService,
107+
UrlAllowlistNotificationService urlAllowlistNotificationService,
108108
EncryptedValueService encryptedValueService,
109109
EventsConfigurationProvider configurationProvider,
110110
Engine templateEngine,
111111
@Named("JsonSafe") Engine jsonTemplateEngine,
112112
NotificationService notificationService,
113113
NodeId nodeId,
114114
final ParameterizedHttpClientProvider parameterizedHttpClientProvider) {
115-
super(whitelistService, urlWhitelistNotificationService, encryptedValueService, notificationService, nodeId);
115+
super(allowlistService, urlAllowlistNotificationService, encryptedValueService, notificationService, nodeId);
116116
this.notificationCallbackService = notificationCallbackService;
117117
this.objectMapperProvider = objectMapperProvider;
118118
this.configurationProvider = configurationProvider;

graylog2-server/src/main/java/org/graylog/events/notifications/types/HTTPNotification.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@
2828
import org.graylog2.plugin.system.NodeId;
2929
import org.graylog2.security.encryption.EncryptedValue;
3030
import org.graylog2.security.encryption.EncryptedValueService;
31-
import org.graylog2.system.urlwhitelist.UrlWhitelistNotificationService;
32-
import org.graylog2.system.urlwhitelist.UrlWhitelistService;
31+
import org.graylog2.system.urlallowlist.UrlAllowlistNotificationService;
32+
import org.graylog2.system.urlallowlist.UrlAllowlistService;
3333

3434
import java.nio.charset.StandardCharsets;
3535

3636
public class HTTPNotification {
37-
private final UrlWhitelistService whitelistService;
38-
private final UrlWhitelistNotificationService urlWhitelistNotificationService;
37+
private final UrlAllowlistService allowlistService;
38+
private final UrlAllowlistNotificationService urlAllowlistNotificationService;
3939
private final EncryptedValueService encryptedValueService;
4040
private final NotificationService notificationService;
4141
private final NodeId nodeId;
4242

43-
public HTTPNotification(UrlWhitelistService whitelistService,
44-
UrlWhitelistNotificationService urlWhitelistNotificationService,
43+
public HTTPNotification(UrlAllowlistService allowlistService,
44+
UrlAllowlistNotificationService urlAllowlistNotificationService,
4545
EncryptedValueService encryptedValueService,
4646
NotificationService notificationService, NodeId nodeId) {
47-
this.whitelistService = whitelistService;
48-
this.urlWhitelistNotificationService = urlWhitelistNotificationService;
47+
this.allowlistService = allowlistService;
48+
this.urlAllowlistNotificationService = urlAllowlistNotificationService;
4949
this.encryptedValueService = encryptedValueService;
5050
this.notificationService = notificationService;
5151
this.nodeId = nodeId;
@@ -58,11 +58,11 @@ public HttpUrl validateUrl(String url, String notificationId, String eventDefTit
5858
throw new TemporaryEventNotificationException(
5959
"Malformed URL: <" + url + "> in notification <" + notificationId + ">");
6060
}
61-
if (!whitelistService.isWhitelisted(url)) {
61+
if (!allowlistService.isAllowlisted(url)) {
6262
if (!NotificationTestData.TEST_NOTIFICATION_ID.equals(notificationId)) {
63-
publishSystemNotificationForWhitelistFailure(url, eventDefTitle);
63+
publishSystemNotificationForAllowlistFailure(url, eventDefTitle);
6464
}
65-
throw new TemporaryEventNotificationException("URL <" + url + "> is not whitelisted.");
65+
throw new TemporaryEventNotificationException("URL <" + url + "> is not allowlisted.");
6666
}
6767
return httpUrl;
6868
}
@@ -113,11 +113,11 @@ private String getApiKeyValue(EncryptedValue apiSecret) {
113113
return encryptedValueService.decrypt(apiSecret);
114114
}
115115

116-
private void publishSystemNotificationForWhitelistFailure(String url, String eventNotificationTitle) {
116+
private void publishSystemNotificationForAllowlistFailure(String url, String eventNotificationTitle) {
117117
final String description = "The alert notification \"" + eventNotificationTitle +
118-
"\" is trying to access a URL which is not whitelisted. Please check your configuration. [url: \"" +
118+
"\" is trying to access a URL which is not allowlisted. Please check your configuration. [url: \"" +
119119
url + "\"]";
120-
urlWhitelistNotificationService.publishWhitelistFailure(description);
120+
urlAllowlistNotificationService.publishAllowlistFailure(description);
121121
}
122122

123123
void createSystemErrorNotification(String message, EventNotificationContext ctx) {

graylog2-server/src/main/java/org/graylog/plugins/views/search/Query.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Query applyExecutionState(ExecutionStateGlobalOverride state) {
165165

166166
if (!state.searchTypes().isEmpty() || !state.keepSearchTypes().isEmpty()) {
167167
final Set<SearchType> searchTypesToKeep = !state.keepSearchTypes().isEmpty()
168-
? filterForWhiteListFromState(searchTypes(), state)
168+
? filterForAllowListFromState(searchTypes(), state)
169169
: searchTypes();
170170

171171
final Set<SearchType> searchTypesWithOverrides = applyAvailableOverrides(state, searchTypesToKeep);
@@ -178,7 +178,7 @@ Query applyExecutionState(ExecutionStateGlobalOverride state) {
178178
return this;
179179
}
180180

181-
private Set<SearchType> filterForWhiteListFromState(Set<SearchType> previousSearchTypes, ExecutionStateGlobalOverride state) {
181+
private Set<SearchType> filterForAllowListFromState(Set<SearchType> previousSearchTypes, ExecutionStateGlobalOverride state) {
182182
return previousSearchTypes.stream()
183183
.filter(st -> state.keepSearchTypes().contains(st.id()))
184184
.collect(toSet());

graylog2-server/src/main/java/org/graylog2/alarmcallbacks/HTTPAlarmCallback.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.graylog2.plugin.configuration.fields.ConfigurationField;
3737
import org.graylog2.plugin.configuration.fields.TextField;
3838
import org.graylog2.plugin.streams.Stream;
39-
import org.graylog2.system.urlwhitelist.UrlWhitelistService;
39+
import org.graylog2.system.urlallowlist.UrlAllowlistService;
4040

4141
import java.io.IOException;
4242
import java.net.MalformedURLException;
@@ -54,14 +54,14 @@ public class HTTPAlarmCallback implements AlarmCallback {
5454
private final OkHttpClient httpClient;
5555
private final ObjectMapper objectMapper;
5656
private Configuration configuration;
57-
private final UrlWhitelistService whitelistService;
57+
private final UrlAllowlistService allowlistService;
5858

5959
@Inject
6060
public HTTPAlarmCallback(final OkHttpClient httpClient, final ObjectMapper objectMapper,
61-
UrlWhitelistService whitelistService) {
61+
UrlAllowlistService allowlistService) {
6262
this.httpClient = httpClient;
6363
this.objectMapper = objectMapper;
64-
this.whitelistService = whitelistService;
64+
this.allowlistService = allowlistService;
6565
}
6666

6767
@Override
@@ -88,8 +88,8 @@ public void call(final Stream stream, final AlertCondition.CheckResult result) t
8888
throw new AlarmCallbackException("Malformed URL: " + url);
8989
}
9090

91-
if (!whitelistService.isWhitelisted(url)) {
92-
throw new AlarmCallbackException("URL <" + url + "> is not whitelisted.");
91+
if (!allowlistService.isAllowlisted(url)) {
92+
throw new AlarmCallbackException("URL <" + url + "> is not allowlisted.");
9393
}
9494

9595
final Request request = new Request.Builder()
@@ -140,8 +140,8 @@ public void checkConfiguration() throws ConfigurationException {
140140
throw new ConfigurationException("Malformed URL '" + url + "'", e);
141141
}
142142

143-
if (!whitelistService.isWhitelisted(url)) {
144-
throw new ConfigurationException("URL <" + url + "> is not whitelisted.");
143+
if (!allowlistService.isAllowlisted(url)) {
144+
throw new ConfigurationException("URL <" + url + "> is not allowlisted.");
145145
}
146146
}
147147
}

graylog2-server/src/main/java/org/graylog2/audit/AuditEventTypes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public class AuditEventTypes implements PluginAuditEventTypes {
166166
public static final String SYSTEM_JOB_ACKNOWLEDGE = PREFIX + "system_job:acknowledge";
167167
public static final String SYSTEM_NOTIFICATION_CREATE = PREFIX + "system_notification:create";
168168
public static final String SYSTEM_NOTIFICATION_DELETE = PREFIX + "system_notification:delete";
169-
public static final String URL_WHITELIST_UPDATE = PREFIX + "url_whitelist:update";
169+
public static final String URL_ALLOWLIST_UPDATE = PREFIX + "url_allowlist:update";
170170
public static final String USER_ACCESS_TOKEN_CREATE = PREFIX + "user_access_token:create";
171171
public static final String USER_ACCESS_TOKEN_DELETE = PREFIX + "user_access_token:delete";
172172
public static final String USER_CREATE = PREFIX + "user:create";
@@ -320,7 +320,7 @@ public class AuditEventTypes implements PluginAuditEventTypes {
320320
.add(SYSTEM_JOB_ACKNOWLEDGE)
321321
.add(SYSTEM_NOTIFICATION_CREATE)
322322
.add(SYSTEM_NOTIFICATION_DELETE)
323-
.add(URL_WHITELIST_UPDATE)
323+
.add(URL_ALLOWLIST_UPDATE)
324324
.add(USER_ACCESS_TOKEN_CREATE)
325325
.add(USER_ACCESS_TOKEN_DELETE)
326326
.add(USER_CREATE)

0 commit comments

Comments
 (0)