Skip to content

Commit e96f5b7

Browse files
committed
Ensure that other url params stay unredacted
Signed-off-by: Craig Perkins <cwperx@amazon.com>
1 parent 161639b commit e96f5b7

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/integrationTest/java/org/opensearch/security/http/JwtAuthenticationWithUrlParamTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public void shouldAuthenticateWithJwtTokenInUrl_positive() {
101101
Header jwtToken = tokenFactory.generateValidToken(ADMIN_USER.getName());
102102
String jwtTokenValue = jwtToken.getValue();
103103
try (TestRestClient client = cluster.getRestClient()) {
104-
HttpResponse response = client.getAuthInfo(Map.of(TOKEN_URL_PARAM, jwtTokenValue));
104+
HttpResponse response = client.getAuthInfo(Map.of(TOKEN_URL_PARAM, jwtTokenValue, "verbose", "true"));
105105

106106
response.assertStatusCode(200);
107107
String username = response.getTextFromJsonBody(POINTER_USERNAME);
108108
assertThat(username, equalTo(ADMIN_USER.getName()));
109-
Map<String, String> expectedParams = Map.of("token", "REDACTED");
109+
Map<String, String> expectedParams = Map.of("token", "REDACTED", "verbose", "true");
110110

111111
auditLogsRule.assertExactlyOne(
112112
userAuthenticated(ADMIN_USER).withRestRequest(GET, "/_opendistro/_security/authinfo").withRestParams(expectedParams)

src/main/java/org/opensearch/security/auth/BackendRegistry.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public class BackendRegistry {
7777
protected final Logger log = LogManager.getLogger(this.getClass());
7878
private SortedSet<AuthDomain> restAuthDomains;
7979
private Set<AuthorizationBackend> restAuthorizers;
80+
8081
private List<AuthFailureListener> ipAuthFailureListeners;
8182
private Multimap<String, AuthFailureListener> authBackendFailureListeners;
8283
private List<ClientBlockRegistry<InetAddress>> ipClientBlockRegistries;
@@ -180,8 +181,6 @@ public void onDynamicConfigModelChanged(DynamicConfigModel dcm) {
180181
ipClientBlockRegistries = dcm.getIpClientBlockRegistries();
181182
authBackendClientBlockRegistries = dcm.getAuthBackendClientBlockRegistries();
182183

183-
SortedSet<AuthDomain> authDomains = Collections.unmodifiableSortedSet(dcm.getRestAuthDomains());
184-
185184
// OpenSearch Security no default authc
186185
initialized = !restAuthDomains.isEmpty() || anonymousAuthEnabled || injectedUserEnabled;
187186
}

src/main/java/org/opensearch/security/rest/SecurityInfoAction.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public List<Route> routes() {
8888

8989
@Override
9090
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
91+
final boolean verbose = request.paramAsBoolean("verbose", false);
9192
return new RestChannelConsumer() {
9293

9394
@Override
@@ -97,8 +98,6 @@ public void accept(RestChannel channel) throws Exception {
9798

9899
try {
99100

100-
final boolean verbose = request.paramAsBoolean("verbose", false);
101-
102101
final X509Certificate[] certs = threadContext.getTransient(ConfigConstants.OPENDISTRO_SECURITY_SSL_PEER_CERTIFICATES);
103102
final User user = threadContext.getTransient(ConfigConstants.OPENDISTRO_SECURITY_USER);
104103
final TransportAddress remoteAddress = threadContext.getTransient(ConfigConstants.OPENDISTRO_SECURITY_REMOTE_ADDRESS);

0 commit comments

Comments
 (0)