Skip to content

Commit 11539ae

Browse files
committed
Merge branch 'dev-1.1.19' of github.com:WeDataSphere/DataSphereStudio into dev-1.1.19
2 parents fb68864 + eec3bcd commit 11539ae

File tree

7 files changed

+44
-13
lines changed

7 files changed

+44
-13
lines changed

conf/dss-framework-orchestrator-server.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ wds.linkis.server.version=v1
6060
wds.linkis.server.socket.mode=true
6161

6262
wds.linkis.client.flow.adminuser=ws
63-
wds.linkis.client.flow.author.user.token=WS-AUTH
6463

6564
wds.linkis.server.component.exclude.classes=org.apache.linkis.entranceclient.conf.ClientForEntranceSpringConfiguration,org.apache.linkis.entranceclient.conf.ClientSpringConfiguration
6665

dss-appconn/dss-appconn-manager/dss-appconn-manager-core/src/main/java/com/webank/wedatasphere/dss/appconn/manager/impl/AbstractAppConnManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ public abstract class AbstractAppConnManager implements AppConnManager {
5353
private final AppConnLoader appConnLoader = AppConnLoaderFactory.getAppConnLoader();
5454

5555
private final Map<String, AppConn> appConns = new HashMap<>();
56-
private boolean isLoaded = false;
56+
private volatile boolean isLoaded = false;
5757
private List<AppConn> appConnList = null;
5858
AppConnInfoService appConnInfoService;
5959
private AppConnResourceService appConnResourceService;
6060
private AppConnRefreshThread appConnRefreshThread;
6161

62-
private static AppConnManager appConnManager;
62+
private static volatile AppConnManager appConnManager;
6363
private static boolean lazyLoad = false;
6464

6565
public static void setLazyLoad() {
@@ -87,8 +87,8 @@ public static AppConnManager getAppConnManager() {
8787
LOGGER.info("The instance of AppConnManager is {}.", appConnManager.getClass().getName());
8888
appConnManager.init();
8989
}
90+
return appConnManager;
9091
}
91-
return appConnManager;
9292
}
9393

9494
@Override

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/service/impl/ApiServiceQueryServiceImpl.java

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@
2323
import com.webank.wedatasphere.dss.apiservice.core.bo.LinkisExecuteResult;
2424
import com.webank.wedatasphere.dss.apiservice.core.config.ApiServiceConfiguration;
2525
import com.webank.wedatasphere.dss.apiservice.core.constant.ParamType;
26-
import com.webank.wedatasphere.dss.apiservice.core.constant.ParamTypeEnum;
2726
import com.webank.wedatasphere.dss.apiservice.core.constant.RequireEnum;
2827
import com.webank.wedatasphere.dss.apiservice.core.dao.*;
29-
import com.webank.wedatasphere.dss.apiservice.core.exception.ApiExecuteException;
3028
import com.webank.wedatasphere.dss.apiservice.core.exception.ApiServiceQueryException;
3129
import com.webank.wedatasphere.dss.apiservice.core.execute.ApiServiceExecuteJob;
3230
import com.webank.wedatasphere.dss.apiservice.core.execute.DefaultApiServiceJob;
@@ -72,6 +70,8 @@
7270
import java.sql.SQLException;
7371
import java.util.*;
7472
import java.util.concurrent.TimeUnit;
73+
import java.util.regex.Matcher;
74+
import java.util.regex.Pattern;
7575
import java.util.stream.Collectors;
7676

7777
import static java.util.stream.Collectors.toMap;
@@ -80,7 +80,8 @@
8080
@Service
8181
public class ApiServiceQueryServiceImpl implements ApiServiceQueryService {
8282
private static final Logger LOG = LoggerFactory.getLogger(ApiServiceQueryServiceImpl.class);
83-
83+
private static final Pattern pattern = Pattern.compile("--+");
84+
private static final String REPLACEMENT = "\\-";
8485

8586
Map<String, ApiServiceJob> runJobs = new HashMap<>();
8687

@@ -215,9 +216,14 @@ public LinkisExecuteResult query(String path,
215216
}
216217

217218
// 用户请求的参数值注入检查,排除token
218-
for(String k: reqParams.keySet()){
219+
for(Map.Entry<String, Object> entry: reqParams.entrySet()){
220+
String k = entry.getKey();
221+
String v = String.valueOf(entry.getValue());
222+
if (v.contains("--")){
223+
entry.setValue(replaceSymbol(v));
224+
}
219225
if(!k.equals(ApiServiceConfiguration.API_SERVICE_TOKEN_KEY.getValue())
220-
&& SQLCheckUtil.doParamInjectionCheck(reqParams.get(k).toString())) {
226+
&& SQLCheckUtil.doParamInjectionCheck((String) reqParams.get(k))) {
221227
// 如果注入直接返回null
222228
LOG.warn("用户参数存在非法的关键字{}", reqParams.get(k).toString());
223229
return null;
@@ -543,4 +549,21 @@ private static String getRunTypeFromScriptsPath(String scriptsPath) {
543549
return res;
544550

545551
}
552+
553+
private static String replaceSymbol(String str) {
554+
StringBuffer sb = new StringBuffer();
555+
Matcher matcher = pattern.matcher(str);
556+
while (matcher.find()){
557+
String match = matcher.group();
558+
int length = match.length();
559+
StringBuilder replacement = new StringBuilder();
560+
for (int i = 0; i < length; i++) {
561+
replacement.append(REPLACEMENT);
562+
}
563+
//避免将replacement识别为正则,将替换字符追加到sb中
564+
matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement.toString()));
565+
}
566+
matcher.appendTail(sb);
567+
return sb.toString();
568+
}
546569
}

dss-framework/dss-framework-project-server/src/main/java/com/webank/wedatasphere/dss/framework/project/service/impl/DSSProjectServiceImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ public List<ProjectResponse> getListByParam(ProjectQueryRequest projectRequest)
192192
String editPriv = projectVo.getId() + KEY_SPLIT + ProjectUserPrivEnum.PRIV_EDIT.getRank()
193193
+ KEY_SPLIT + projectRequest.getUsername();
194194

195+
LOGGER.info("user:{} get project privilege info ,workspaceId:{}, projectId:{}, projectName:{}, pusername:{}, editPriv:{}",
196+
projectRequest.getUsername(), projectRequest.getWorkspaceId(), projectVo.getId(), projectVo.getName(), pusername, editPriv);
197+
195198
Map<String, List<String>> userPricMap = new HashMap<>();
196199
String[] tempstrArr = pusername.split(MODE_SPLIT);
197200

@@ -212,6 +215,9 @@ public List<ProjectResponse> getListByParam(ProjectQueryRequest projectRequest)
212215
projectResponse.setEditUsers(CollectionUtils.isEmpty(editUsers) ? new ArrayList<>() : editUsers.stream().distinct().collect(Collectors.toList()));
213216
projectResponse.setReleaseUsers(CollectionUtils.isEmpty(releaseUsers) ? new ArrayList<>() : releaseUsers.stream().distinct().collect(Collectors.toList()));
214217

218+
LOGGER.info("user:{} get project access users info, workspaceId:{}, projectId:{}, projectName:{}, accessUsers:{}, editUsers:{}, releaseUsers:{}",
219+
projectRequest.getUsername(), projectRequest.getWorkspaceId(), projectVo.getId(), projectVo.getName(), accessUsers, editUsers, releaseUsers);
220+
215221
// 用户是否具有编辑权限 编辑权限和创建者都有
216222
if (!StringUtils.isEmpty(pusername) &&
217223
(pusername.contains(editPriv) ||

dss-orchestrator/orchestrators/dss-workflow/dss-linkis-node-execution/src/main/java/com/webank/wedatasphere/dss/linkis/node/execution/conf/LinkisJobExecutionConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class LinkisJobExecutionConfiguration {
6161
public final static CommonVars<String> LINKIS_ADMIN_USER = CommonVars.apply("wds.linkis.client.flow.adminuser","ws");
6262

6363

64-
public final static CommonVars<String> LINKIS_AUTHOR_USER_TOKEN = CommonVars.apply("wds.linkis.client.flow.author.user.token","WS-AUTH");
64+
public final static CommonVars<String> LINKIS_AUTHOR_USER_TOKEN = CommonVars.apply("wds.linkis.client.flow.author.user.token","admin-kmsnd");
6565

6666
public final static CommonVars<String> LINKIS_JOB_CREATOR = CommonVars.apply("wds.linkis.flow.job.creator","nodeexecution");
6767

dss-orchestrator/orchestrators/dss-workflow/dss-linkis-node-execution/src/main/java/com/webank/wedatasphere/dss/linkis/node/execution/service/impl/BuildJobActionImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,18 @@ public JobSubmitAction getSubmitAction(Job job) throws LinkisJobExecutionErrorEx
148148

149149
JobSubmitAction.Builder builder = JobSubmitAction.builder()
150150
.addExecuteCode(code)
151-
.setUser(job.getUser())
152151
.addExecuteUser(job.getUser())
153152
.setParams(paramMapCopy)
154153
.setLabels(labels)
155154
.setRuntimeParams(job.getRuntimeParams());
156155
if (job instanceof LinkisJob) {
156+
LinkisJob linkisJob = (LinkisJob) job;
157+
builder = builder.setUser(linkisJob.getSubmitUser());
157158
Map<String, Object> source = new HashMap<>();
158-
source.putAll(((LinkisJob) job).getSource());
159+
source.putAll(linkisJob.getSource());
159160
builder = builder.setSource(source);
161+
}else{
162+
builder = builder.setUser(job.getUser());
160163
}
161164
// 将execute接口带来的额外variable参数,带进来 todo check
162165
Map<String, Object> propMap = new HashMap<>();

plugins/azkaban/linkis-jobtype/src/main/resources/plugin.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
wds.linkis.gateway.url.v1=http://127.0.0.1:9001
1818
wds.linkis.gateway.url.v0=http://127.0.0.1:9001
19-
wds.linkis.client.flow.author.user.token=WS-AUTH
19+
wds.linkis.client.flow.author.user.token=admin-kmsnd
2020
wds.linkis.flow.job.creator=scheduler
2121
wds.linkis.flow.job.creator.v1=schedulis

0 commit comments

Comments
 (0)