Skip to content

Commit 3d5c2e7

Browse files
committed
Mitigate possible injection attack
1 parent 08e5507 commit 3d5c2e7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/org/observabilitystack/geoip/web/InetAdressPropertyEditor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@
22

33
import java.beans.PropertyEditorSupport;
44

5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
7+
58
import com.google.common.net.InetAddresses;
69

710
import static com.google.common.base.Preconditions.checkNotNull;
811

912
public class InetAdressPropertyEditor extends PropertyEditorSupport {
1013

14+
private final Logger logger = LoggerFactory.getLogger(getClass());
15+
1116
@Override
1217
public void setAsText(String text) {
1318
checkNotNull(text, "Pre-condition violated: text must not be null.");
1419

1520
try {
1621
setValue(InetAddresses.forString(text));
1722
} catch (IllegalArgumentException e) {
18-
throw new InvalidIpAddressException(e.getMessage());
23+
logger.info("Invalid IP address given: {}", e.getMessage());
24+
throw new InvalidIpAddressException("Invalid IP address given");
1925
}
2026
}
2127
}

0 commit comments

Comments
 (0)