Sanitize EPP XML requests and responses

Masks user credentials (tags 'pw' and 'newPW') in EPP XML messages.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207953894
This commit is contained in:
weiminyu 2018-08-08 15:13:02 -07:00 committed by jianglai
parent 9eec70729f
commit 81fce674d2
11 changed files with 415 additions and 3 deletions

View file

@ -190,12 +190,13 @@ public class FlowRunnerTest extends ShardableTestCase {
@Test
public void testRun_loggingStatement_complexEppInput() throws Exception {
String domainCreateXml = loadFile(getClass(), "domain_create_prettyprinted.xml");
String sanitizedDomainCreateXml = domainCreateXml.replace("2fooBAR", "*******");
flowRunner.inputXmlBytes = domainCreateXml.getBytes(UTF_8);
flowRunner.run(eppMetricBuilder);
String logMessage = findFirstLogMessageByPrefix(handler, "EPP Command\n\t");
List<String> lines = Splitter.on("\n\t").splitToList(logMessage);
assertThat(lines.size()).named("number of lines in log message").isAtLeast(9);
String xml = Joiner.on('\n').join(lines.subList(3, lines.size() - 4));
assertThat(xml).isEqualTo(domainCreateXml);
assertThat(xml).isEqualTo(sanitizedDomainCreateXml);
}
}