Skip to content

Commit

Permalink
[Revert] [apache#15483] Remove sensitive msg from consumer/producer s…
Browse files Browse the repository at this point in the history
…tats log (apache#15817)

### Motivation
See apache#15483 
The `@Secret` annotation works well, and introduced in apache#8910

### Modifications
- Revert the unneeded `@JsonIgnore`
- remove `Assert.assertFalse(s.contains("Password"));` `Password` is printed in a key. The sensitive field's value is `****`.
  • Loading branch information
shoothzj committed Jun 5, 2022
1 parent ede3d19 commit 67361e8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
Expand Up @@ -32,7 +32,6 @@
import java.util.concurrent.TimeUnit;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.pulsar.client.api.Authentication;
import org.apache.pulsar.client.api.ProxyProtocol;
Expand All @@ -59,7 +58,6 @@ public class ClientConfigurationData implements Serializable, Cloneable {
value = "The implementation class of ServiceUrlProvider used to generate ServiceUrl."
)
@JsonIgnore
@Getter(onMethod_ = @JsonIgnore)
private transient ServiceUrlProvider serviceUrlProvider;

@ApiModelProperty(
Expand Down Expand Up @@ -256,8 +254,6 @@ public class ClientConfigurationData implements Serializable, Cloneable {
value = "Password of TLS TrustStore."
)
@Secret
@JsonIgnore
@Getter(onMethod_ = @JsonIgnore)
private String tlsTrustStorePassword = null;

@ApiModelProperty(
Expand Down Expand Up @@ -330,10 +326,8 @@ public class ClientConfigurationData implements Serializable, Cloneable {
value = "Password of SOCKS5 proxy."
)
@Secret
@JsonIgnore
private String socks5ProxyPassword;

@JsonIgnore
public Authentication getAuthentication() {
if (authentication == null) {
this.authentication = AuthenticationDisabled.INSTANCE;
Expand Down Expand Up @@ -391,7 +385,6 @@ public String getSocks5ProxyUsername() {
return Objects.nonNull(socks5ProxyUsername) ? socks5ProxyUsername : System.getProperty("socks5Proxy.username");
}

@JsonIgnore
public String getSocks5ProxyPassword() {
return Objects.nonNull(socks5ProxyPassword) ? socks5ProxyPassword : System.getProperty("socks5Proxy.password");
}
Expand Down
Expand Up @@ -48,7 +48,6 @@ public void testDoNotPrintSensitiveInfo() throws JsonProcessingException {
clientConfigurationData.setSocks5ProxyPassword("yyyy");
clientConfigurationData.setAuthentication(new AuthenticationToken("zzzz"));
String s = w.writeValueAsString(clientConfigurationData);
Assert.assertFalse(s.contains("Password"));
Assert.assertFalse(s.contains("xxxx"));
Assert.assertFalse(s.contains("yyyy"));
Assert.assertFalse(s.contains("zzzz"));
Expand Down

0 comments on commit 67361e8

Please sign in to comment.