@Test void shouldMaskSensitiveFields() { Map<String, Object> data = new HashMap<>(); data.put("param.password", "hunter2"); data.put("myname", "mantis"); Event re = new Event(data); eventProcessor.maskSensitiveFields(re); assertSame("***", re.get("param.password")); assertEquals(re.get("myname"), "mantis"); }
void maskSensitiveFields(Event event) { String blacklistKeys = config.blackListedKeysCSV(); List<String> blacklist = Arrays.stream(blacklistKeys.split(",")) .map(String::trim) .collect(Collectors.toList()); blacklist.stream() .filter(key -> event.get(key) != null) .forEach(key -> event.set(key, "***")); }
EventProcessor { void maskSensitiveFields(Event event) { String blacklistKeys = config.blackListedKeysCSV(); List<String> blacklist = Arrays.stream(blacklistKeys.split(",")) .map(String::trim) .collect(Collectors.toList()); blacklist.stream() .filter(key -> event.get(key) != null) .forEach(key -> event.set(key, "***")); } }
EventProcessor { void maskSensitiveFields(Event event) { String blacklistKeys = config.blackListedKeysCSV(); List<String> blacklist = Arrays.stream(blacklistKeys.split(",")) .map(String::trim) .collect(Collectors.toList()); blacklist.stream() .filter(key -> event.get(key) != null) .forEach(key -> event.set(key, "***")); } EventProcessor(MrePublishConfiguration config, StreamManager streamManager, Tee tee); }
EventProcessor { void maskSensitiveFields(Event event) { String blacklistKeys = config.blackListedKeysCSV(); List<String> blacklist = Arrays.stream(blacklistKeys.split(",")) .map(String::trim) .collect(Collectors.toList()); blacklist.stream() .filter(key -> event.get(key) != null) .forEach(key -> event.set(key, "***")); } EventProcessor(MrePublishConfiguration config, StreamManager streamManager, Tee tee); Event process(String stream, Event event); }
EventProcessor { void maskSensitiveFields(Event event) { String blacklistKeys = config.blackListedKeysCSV(); List<String> blacklist = Arrays.stream(blacklistKeys.split(",")) .map(String::trim) .collect(Collectors.toList()); blacklist.stream() .filter(key -> event.get(key) != null) .forEach(key -> event.set(key, "***")); } EventProcessor(MrePublishConfiguration config, StreamManager streamManager, Tee tee); Event process(String stream, Event event);  }