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 27, 2024
1 parent 8b32e53 commit a06d83d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 40 deletions.
36 changes: 18 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,30 @@ List logger = [
]

dependencies {
compile logger
compile 'com.moandjiezana.toml:toml4j:0.7.2'
compile 'com.google.code.gson:gson:2.8.9'
compile 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
compile ('org.springframework.boot:spring-boot-starter-web:2.7.18'){
implementation logger
implementation 'com.moandjiezana.toml:toml4j:0.7.2'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
implementation ('org.springframework.boot:spring-boot-starter-web:2.7.18'){
exclude group: 'org.springframework', module: 'spring-core'
}
compile 'org.springframework.boot:spring-boot-starter-aop:2.7.18'
compile 'org.springframework.boot:spring-boot-starter-security:2.7.18'
compile 'org.springframework:spring-aspects:5.3.32'
compile 'org.springframework:spring-core:5.3.32'
compile 'org.springframework:spring-web:5.3.32'
compile 'org.springframework:spring-webmvc:5.3.32'
compile 'org.springframework:spring-aop:5.3.32'
implementation 'org.springframework.boot:spring-boot-starter-aop:2.7.18'
implementation ('org.springframework.boot:spring-boot-starter-security:2.7.18')
implementation 'org.springframework:spring-aspects:5.3.32'
implementation 'org.springframework:spring-web:5.3.32'
implementation 'org.springframework:spring-webmvc:5.3.32'
implementation 'org.springframework:spring-core:5.3.32'
implementation 'org.springframework:spring-aop:5.3.32'
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 'commons-codec:commons-codec:1.14'
compile 'org.bouncycastle:bcprov-jdk18on:1.77'
compile 'junit:junit:4.13.1'
compile 'org.aspectj:aspectjrt:1.9.7'
compile 'org.aspectj:aspectjweaver:1.9.7'
implementation 'commons-codec:commons-codec:1.14'
implementation 'org.bouncycastle:bcprov-jdk18on:1.77'
implementation 'junit:junit:4.13.1'
implementation 'org.aspectj:aspectjrt:1.9.7'
implementation 'org.aspectj:aspectjweaver:1.9.7'
}
configurations.compile.exclude(group: 'ch.qos.logback')
jar {
Expand Down Expand Up @@ -153,7 +153,7 @@ jar {
into 'dist/conf'
}
copy {
from configurations.runtime
from configurations.runtimeClasspath
into 'dist/lib'
}
copy {
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 a06d83d

Please sign in to comment.