aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2019-10-04 16:12:51 +0200
committerSébastien Determe <sebastien.determe@intl.att.com>2019-10-04 14:14:40 +0000
commitad99ac2d9c4f9c9ea15d7f0b11863bb28b0a7b23 (patch)
tree2fc586dd61ccf290b3d05dab5384cc52ec6f2da8
parentfd200512af757af56b106e158b58f4877a6bd08f (diff)
Fix X509 injection
Url Decode before using the certificate Issue-ID: CLAMP-519 Change-Id: I7b0e9926a7ae6c50f2e5fafa73b20d733725b076 Signed-off-by: sebdet <sebastien.determe@intl.att.com>
-rw-r--r--src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
index 3a9394227..7e104c74b 100644
--- a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
+++ b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
@@ -30,6 +30,8 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
import java.nio.file.StandardCopyOption;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
@@ -142,7 +144,8 @@ public class ClampCadiFilter extends CadiFilter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
try {
- String certHeader = ((HttpServletRequest) request).getHeader("X-SSL-Cert");
+ String certHeader = URLDecoder.decode(((HttpServletRequest) request).getHeader("X-SSL-Cert"),
+ StandardCharsets.UTF_8.toString());
if (certHeader != null) {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");