Skip to content

Commit

Permalink
Rename "Sanitized" -> "Escaped"?
Browse files Browse the repository at this point in the history
  • Loading branch information
arturobernalg committed Sep 20, 2024
1 parent 521d77b commit 33b7c54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,11 @@ void verifySession(
final X509Certificate x509 = (X509Certificate) cert;
// Sanitize and log peer principal
final X500Principal peer = x509.getSubjectX500Principal();
LOG.debug("Sanitized peer principal: {}", toEscapedString(peer));
LOG.debug("Escaped peer principal: {}", toEscapedString(peer));

// Sanitize and log issuer principal
final X500Principal issuer = x509.getIssuerX500Principal();
LOG.debug("Sanitized issuer principal: {}", toEscapedString(issuer));
LOG.debug("Escaped issuer principal: {}", toEscapedString(issuer));


final Collection<List<?>> altNames1 = x509.getSubjectAlternativeNames();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ public void testToEscapedString_withControlCharacters() {
// Create a X500Principal with control characters
final X500Principal principal = new X500Principal("CN=Test\b\bName\n,O=TestOrg");

// Call the sanitizeX500Principal method
// Call the toEscapedString method
final SSLConnectionSocketFactory factory = new SSLConnectionSocketFactory(SSLContexts.createDefault());
final String sanitized = factory.toEscapedString(principal);
final String escaped = factory.toEscapedString(principal);

// Assert that control characters are properly escaped
assertEquals("CN=Test\\x08\\x08Name\\x0a,O=TestOrg", sanitized);
assertEquals("CN=Test\\x08\\x08Name\\x0a,O=TestOrg", escaped);
}

@Test
public void testVerifySession_sanitizesPeerAndIssuer() throws Exception {
public void testVerifySession_escapedPeerAndIssuer() throws Exception {
// Mock SSLSession and X509Certificate
final SSLSession mockSession = mock(SSLSession.class);
final X509Certificate mockCert = mock(X509Certificate.class);
Expand Down

0 comments on commit 33b7c54

Please sign in to comment.