Skip to content

Commit

Permalink
<fix>(build): update build for secure issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay committed Feb 28, 2024
1 parent 8b32e53 commit be592b3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ dependencies {
compile 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
compile ('org.springframework.boot:spring-boot-starter-web:2.7.18'){
exclude group: 'org.springframework', module: 'spring-core'
exclude group: 'org.springframework', module: 'spring-web'
exclude group: 'org.springframework', module: 'spring-webmvc'
}
compile 'org.springframework.boot:spring-boot-starter-aop:2.7.18'
compile 'org.springframework.boot:spring-boot-starter-security:2.7.18'
Expand All @@ -100,8 +102,8 @@ dependencies {
implementation ('org.asynchttpclient:async-http-client:2.12.3'){
exclude group : 'io.netty'
}
implementation 'io.netty:netty-all:4.1.101.Final'
implementation 'com.google.guava:guava:32.0.1-jre'
compile 'io.netty:netty-all:4.1.101.Final'
compile 'com.google.guava:guava:32.0.1-jre'
compile 'commons-codec:commons-codec:1.14'
compile 'org.bouncycastle:bcprov-jdk18on:1.77'
compile 'junit:junit:4.13.1'
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/webank/wecrosssdk/common/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

public class Constant {
public static final String APPLICATION_CONFIG_FILE = "classpath:application.toml";
public static final String TEMPLATE_URL = "http://127.0.0.1:8250/";
public static final String XA_TRANSACTION_ID_KEY = "XA_TRANSACTION_ID";
public static final String XA_TRANSACTION_SEQ_KEY = "XA_TRANSACTION_SEQ";
/** alphabet(upper or lower case) + digit + character("_-") ,length in (4,16) */
Expand Down
16 changes: 6 additions & 10 deletions src/main/java/com/webank/wecrosssdk/rpc/common/RequestUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ public static String buildLoginParams(WeCrossRPC weCrossRPC, String username, St
String confusedPassword = DigestUtils.sha256Hex(LoginSalt.LoginSalt + password);

if (logger.isDebugEnabled()) {
logger.debug(
"login username: {}, pub: {}, randomToken: {}",
username,
pub,
authCode.getRandomToken());
username = username.replace("\n", "");
username = username.replace("\r", "");
logger.debug("login username: {}", username);
}

LoginRequest loginRequest = new LoginRequest();
Expand All @@ -56,11 +54,9 @@ public static String buildRegisterParams(
String confusedPassword = DigestUtils.sha256Hex(LoginSalt.LoginSalt + password);

if (logger.isDebugEnabled()) {
logger.debug(
"register username: {}, pub: {}, randomToken: {}",
username,
pub,
authCode.getRandomToken());
username = username.replace("\n", "");
username = username.replace("\r", "");
logger.debug("login username: {}", username);
}

RegisterRequest registerRequest = new RegisterRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ public <T extends Response> void asyncSend(
} else {
url = server + uri;
}
if (logger.isDebugEnabled()) {
logger.debug("request: {}; url: {}", objectMapper.writeValueAsString(request), url);
if (logger.isTraceEnabled()) {
logger.trace("request: {}; url: {}", objectMapper.writeValueAsString(request), url);
}

checkRequest(request);
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/com/webank/wecrosssdk/utils/RPCUtils.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.webank.wecrosssdk.utils;

import com.webank.wecrosssdk.common.Constant;
import com.webank.wecrosssdk.exception.ErrorCode;
import com.webank.wecrosssdk.exception.WeCrossSDKException;
import java.net.URL;
import java.util.UUID;
import java.util.regex.Pattern;
import org.slf4j.Logger;
Expand All @@ -18,13 +16,6 @@ public static void checkPath(String path) throws WeCrossSDKException {
if (!path.matches("^[A-Za-z]*.[A-Za-z0-9_-]*.[A-Za-z0-9_-]*$") || sp.length != 3) {
throw new WeCrossSDKException(ErrorCode.RESOURCE_ERROR, "Invalid iPath: " + path);
}
String templateUrl = Constant.TEMPLATE_URL + path.replace('.', '/');

try {
new URL(templateUrl);
} catch (Exception e) {
throw new WeCrossSDKException(ErrorCode.ILLEGAL_SYMBOL, "Invalid iPath: " + path);
}
}

public static String uriToUrl(String protocol, String prefix, String path) {
Expand Down

0 comments on commit be592b3

Please sign in to comment.