From 553f5b558fbd0cf8af942791977d7ecf7bb6d6c4 Mon Sep 17 00:00:00 2001 From: user <8352767+zhegu123@user.noreply.gitee.com> Date: Wed, 19 Apr 2023 17:41:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0jenkins=E9=9B=86=E6=88=90code?= =?UTF-8?q?Check=E5=92=8CVSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 60 ++++ .../huawei/jenkins/codeCheck/CustomInput.java | 70 ++++ .../codeCheck/codeCheckPipelineStep.java | 159 +++++++++ .../jenkins/codeCheck/codeCheckService.java | 182 ++++++++++ .../com/huawei/jenkins/vss/CustomInput.java | 221 +++++++++++++ .../jenkins/vss/vssCheckPipelineStep.java | 313 ++++++++++++++++++ .../com/huawei/jenkins/vss/vssService.java | 220 ++++++++++++ .../jenkins/codeCheck/Messages.properties | 7 + .../codeCheck/Messages_zh_CN.properties | 11 + .../codeCheckPipelineStep/config.jelly | 36 ++ .../codeCheckPipelineStep/help-ak.html | 19 ++ .../help-project_id.html | 18 + .../codeCheckPipelineStep/help-region.html | 18 + .../codeCheckPipelineStep/help-sk.html | 19 ++ .../codeCheckPipelineStep/help-task_id.html | 18 + .../codeCheckPipelineStep/help-topicUrn.html | 18 + .../codeCheck/codeCheckPipelineStep/help.html | 20 ++ .../huawei/jenkins/vss/Messages.properties | 8 + .../jenkins/vss/Messages_zh_CN.properties | 11 + .../vss/vssCheckPipelineStep/config.jelly | 125 +++++++ .../vss/vssCheckPipelineStep/help-ak.html | 19 ++ .../vssCheckPipelineStep/help-cve_check.html | 18 + .../help-malicious_code.html | 18 + .../help-malicious_link.html | 18 + .../help-picture_check.html | 18 + .../vssCheckPipelineStep/help-port_scan.html | 18 + .../vss/vssCheckPipelineStep/help-region.html | 18 + .../vssCheckPipelineStep/help-scan_mode.html | 21 ++ .../vss/vssCheckPipelineStep/help-sk.html | 19 ++ .../vssCheckPipelineStep/help-task_name.html | 20 ++ .../help-task_period_timer.html | 22 ++ .../vssCheckPipelineStep/help-task_type.html | 20 ++ .../vssCheckPipelineStep/help-text_check.html | 18 + .../vss/vssCheckPipelineStep/help-timer.html | 20 ++ .../vssCheckPipelineStep/help-topicUrn.html | 18 + .../help-trigger_timer.html | 20 ++ .../vssCheckPipelineStep/help-upgrade.html | 18 + .../vss/vssCheckPipelineStep/help-url.html | 20 ++ .../help-weak_pwd_scan.html | 18 + .../vss/vssCheckPipelineStep/help.html | 20 ++ 40 files changed, 1934 insertions(+) create mode 100644 src/main/java/com/huawei/jenkins/codeCheck/CustomInput.java create mode 100644 src/main/java/com/huawei/jenkins/codeCheck/codeCheckPipelineStep.java create mode 100644 src/main/java/com/huawei/jenkins/codeCheck/codeCheckService.java create mode 100644 src/main/java/com/huawei/jenkins/vss/CustomInput.java create mode 100644 src/main/java/com/huawei/jenkins/vss/vssCheckPipelineStep.java create mode 100644 src/main/java/com/huawei/jenkins/vss/vssService.java create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/Messages.properties create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/Messages_zh_CN.properties create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/config.jelly create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-ak.html create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-project_id.html create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-region.html create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-sk.html create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-task_id.html create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-topicUrn.html create mode 100644 src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/Messages.properties create mode 100644 src/main/resources/com/huawei/jenkins/vss/Messages_zh_CN.properties create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/config.jelly create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-ak.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-cve_check.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-malicious_code.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-malicious_link.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-picture_check.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-port_scan.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-region.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-scan_mode.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-sk.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_name.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_period_timer.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_type.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-text_check.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-timer.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-topicUrn.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-trigger_timer.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-upgrade.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-url.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-weak_pwd_scan.html create mode 100644 src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help.html diff --git a/pom.xml b/pom.xml index 9e67400..2baae4b 100644 --- a/pom.xml +++ b/pom.xml @@ -129,6 +129,66 @@ plain-credentials 139.ved2b_9cf7587b + + com.huaweicloud.sdk + huaweicloud-sdk-vss + 3.1.35 + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-core + + + + + + com.huaweicloud.sdk + huaweicloud-sdk-codecheck + 3.1.35 + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + + + + + com.huaweicloud.sdk + huaweicloud-sdk-smn + 3.1.36 + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.huaweicloud.sdk + huaweicloud-sdk-core + + + org.openeuler + bgmprovider + + + diff --git a/src/main/java/com/huawei/jenkins/codeCheck/CustomInput.java b/src/main/java/com/huawei/jenkins/codeCheck/CustomInput.java new file mode 100644 index 0000000..a9a4ea6 --- /dev/null +++ b/src/main/java/com/huawei/jenkins/codeCheck/CustomInput.java @@ -0,0 +1,70 @@ +package com.huawei.jenkins.codeCheck; + +import java.io.Serializable; + +/** + * 用户自定义输出参数 + */ +public class CustomInput implements Serializable { + private static final long serialVersionUID = 1L; + + private String ak; + + private String sk; + + private String region; + + private String task_id; + + private String project_id; + + private String topicUrn; + + public String getAk() { + return ak; + } + + public void setAk(String ak) { + this.ak = ak; + } + + public String getSk() { + return sk; + } + + public void setSk(String sk) { + this.sk = sk; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getTask_id() { + return task_id; + } + + public void setTask_id(String task_id) { + this.task_id = task_id; + } + + public String getProject_id() { + return project_id; + } + + public void setProject_id(String project_id) { + this.project_id = project_id; + } + + public String getTopicUrn() { + return topicUrn; + } + + public void setTopicUrn(String topicUrn) { + this.topicUrn = topicUrn; + } +} diff --git a/src/main/java/com/huawei/jenkins/codeCheck/codeCheckPipelineStep.java b/src/main/java/com/huawei/jenkins/codeCheck/codeCheckPipelineStep.java new file mode 100644 index 0000000..7e9ba13 --- /dev/null +++ b/src/main/java/com/huawei/jenkins/codeCheck/codeCheckPipelineStep.java @@ -0,0 +1,159 @@ +/* + * Copyright 2022. Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huawei.jenkins.codeCheck; + +import hudson.EnvVars; +import hudson.Extension; +import hudson.FilePath; +import hudson.model.TaskListener; +import org.jenkinsci.plugins.workflow.steps.*; +import org.kohsuke.stapler.DataBoundConstructor; +import org.kohsuke.stapler.DataBoundSetter; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * pipeline语法支持obs文件上传 + */ +public class codeCheckPipelineStep extends Step { + + private String ak; + + private String sk; + + private String region; + + private String task_id; + + private String project_id; + + private String topicUrn; + + public String getAk() { + return ak; + } + + @DataBoundSetter + public void setAk(String ak) { + this.ak = ak; + } + + public String getSk() { + return sk; + } + + @DataBoundSetter + public void setSk(String sk) { + this.sk = sk; + } + + public String getRegion() { + return region; + } + + @DataBoundSetter + public void setRegion(String region) { + this.region = region; + } + + public String getTask_id() { + return task_id; + } + + @DataBoundSetter + public void setTask_id(String task_id) { + this.task_id = task_id; + } + + public String getProject_id() { + return project_id; + } + @DataBoundSetter + public void setProject_id(String project_id) { + this.project_id = project_id; + } + + public String getTopicUrn() { + return topicUrn; + } + + @DataBoundSetter + public void setTopicUrn(String topicUrn) { + this.topicUrn = topicUrn; + } + + @DataBoundConstructor + public codeCheckPipelineStep(String region) { + this.region = region; + } + + @Override + public StepExecution start(StepContext context) throws Exception { + return new codeCheckPipelineStep.Execution(this, context); + } + + @Extension + public static class DescriptorImpl extends StepDescriptor { + + @Override + public Set extends Class>> getRequiredContext() { + return requires(TaskListener.class, EnvVars.class, FilePath.class); + } + + @Override + public String getFunctionName() { + return "runTask"; + } + + @Override + public String getDisplayName() { + return "run Code check with Pipeline"; + } + } + + public static > Set requires(T... classes) { + return new HashSet<>(Arrays.asList(classes)); + } + + public static class Execution extends SynchronousNonBlockingStepExecution { + + protected static final long serialVersionUID = 1L; + + protected final transient codeCheckPipelineStep step; + + public Execution(codeCheckPipelineStep step, StepContext context) { + super(context); + this.step = step; + + } + + @Override + public String run() throws Exception { + CustomInput customInput = new CustomInput(); + customInput.setAk(step.getAk()); + customInput.setSk(step.getSk()); + customInput.setRegion(step.getRegion()); + customInput.setProject_id(step.getProject_id()); + customInput.setTask_id(step.getTask_id()); + customInput.setTopicUrn(step.getTopicUrn()); + TaskListener listener = codeCheckPipelineStep.Execution.this.getContext().get(TaskListener.class); + return codeCheckService.runTask(listener, customInput); + } + } +} diff --git a/src/main/java/com/huawei/jenkins/codeCheck/codeCheckService.java b/src/main/java/com/huawei/jenkins/codeCheck/codeCheckService.java new file mode 100644 index 0000000..5993de0 --- /dev/null +++ b/src/main/java/com/huawei/jenkins/codeCheck/codeCheckService.java @@ -0,0 +1,182 @@ +package com.huawei.jenkins.codeCheck; + +import com.google.common.base.Preconditions; +import com.huaweicloud.sdk.codecheck.v2.CodeCheckClient; +import com.huaweicloud.sdk.codecheck.v2.model.*; +import com.huaweicloud.sdk.codecheck.v2.region.CodeCheckRegion; +import com.huaweicloud.sdk.core.auth.BasicCredentials; +import com.huaweicloud.sdk.core.auth.ICredential; +import com.huaweicloud.sdk.core.exception.ConnectionException; +import com.huaweicloud.sdk.core.exception.RequestTimeoutException; +import com.huaweicloud.sdk.core.exception.ServiceResponseException; +import com.huaweicloud.sdk.smn.v2.SmnClient; +import com.huaweicloud.sdk.smn.v2.model.PublishMessageRequest; +import com.huaweicloud.sdk.smn.v2.model.PublishMessageRequestBody; +import com.huaweicloud.sdk.smn.v2.model.PublishMessageResponse; +import com.huaweicloud.sdk.smn.v2.region.SmnRegion; +import hudson.model.TaskListener; +import org.apache.commons.lang.StringUtils; + +import java.io.Serializable; + + +public class codeCheckService implements Serializable { + private static final long serialVersionUID = 1; + + + public static String runTask(TaskListener listener, CustomInput customInput) { + inputValidate(customInput); + ICredential auth = new BasicCredentials() + .withAk(customInput.getAk()) + .withSk(customInput.getSk()); + + CodeCheckClient client = CodeCheckClient.newBuilder() + .withCredential(auth) + .withRegion(CodeCheckRegion.valueOf(customInput.getRegion())) + .build(); + + RunTaskRequest request = new RunTaskRequest(); + request.withTaskId(customInput.getTask_id()); + RunRequestV2 body = new RunRequestV2(); + request.withBody(body); + String message = ""; + try { + RunTaskResponse response = client.runTask(request); + if (response.getHttpStatusCode() == 200) { + message = "执行检查任务成功"; + listener.getLogger().println(message); + Integer status = 0; + while (status == 0) { + status = showTasks(client, customInput.getTask_id(), listener); + try { + Thread.currentThread().sleep(30000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + listener.getLogger().println("检查任务执行完成!!!!"); + + CheckRecord(client,customInput,listener); + + } else if (response.getHttpStatusCode() == 400) { + listener.getLogger().println("网络繁忙,请稍后再试"); + } else { + listener.getLogger().println("认证信息过期"); + } + + } catch (ConnectionException e) { + e.printStackTrace(); + } catch (RequestTimeoutException e) { + e.printStackTrace(); + } catch (ServiceResponseException e) { + e.printStackTrace(); + listener.getLogger().println("错误信息:" + e.getErrorMsg()); + message = e.getErrorMsg(); + } + return message; + } + + + public static Integer showTasks(CodeCheckClient client, String taskId, TaskListener listener) { + ShowProgressDetailRequest request = new ShowProgressDetailRequest(); + request.withTaskId(taskId); + ShowProgressDetailResponse response = null; + try { + response = client.showProgressDetail(request); + if(StringUtils.isNotBlank(response.getProgress().getRatio())){ + listener.getLogger().println("任务进度:" + response.getProgress().getRatio()); + } + } catch (ConnectionException e) { + e.printStackTrace(); + } catch (RequestTimeoutException e) { + e.printStackTrace(); + } catch (ServiceResponseException e) { + e.printStackTrace(); + listener.getLogger().println("错误信息:" + e.getErrorMsg()); + } + return response.getTaskStatus(); + } + + + public static void CheckRecord(CodeCheckClient client, CustomInput customInput, TaskListener listener){ + CheckRecordRequest request = new CheckRecordRequest(); + request.withProjectId(customInput.getProject_id()); + request.withTaskId(customInput.getTask_id()); + request.withOffset(1); + request.withLimit(1); + try { + CheckRecordResponse response = client.checkRecord(request); + CheckRecordDataInfo info = response.getData().get(0); + if(info!=null){ + listener.getLogger().println("致命问题数:" + info.getIssueCounts().getCritical()); + listener.getLogger().println("严重问题数:" + info.getIssueCounts().getSerious()); + listener.getLogger().println("常规问题数:" + info.getIssueCounts().getNormal()); + listener.getLogger().println("提示问题数:" + info.getIssueCounts().getPrompt()); + String url = "https://devcloud."+customInput.getRegion()+".huaweicloud.com/codecheck/project/"+customInput.getProject_id()+"/codecheck/task/"+customInput.getTask_id()+"/detail"; + listener.getLogger().println("关于具体详情,可在:"+url+"\n中查看"); + //发送钉钉微信通知 + if(StringUtils.isNotBlank(customInput.getTopicUrn())){ + //发送钉钉微信通知 + publishMessage(customInput,info, listener); + } + } + } catch (ConnectionException e) { + e.printStackTrace(); + } catch (RequestTimeoutException e) { + e.printStackTrace(); + } catch (ServiceResponseException e) { + e.printStackTrace(); + listener.getLogger().println("错误信息:" + e.getErrorMsg()); + } + } + + + public static void publishMessage(CustomInput customInput,CheckRecordDataInfo info,TaskListener listener) { + ICredential auth = new BasicCredentials() + .withAk(customInput.getAk()) + .withSk(customInput.getSk()); + + SmnClient client = SmnClient.newBuilder() + .withCredential(auth) + .withRegion(SmnRegion.valueOf(customInput.getRegion())) + .build(); + PublishMessageRequest request = new PublishMessageRequest(); + request.withTopicUrn(customInput.getTopicUrn()); + PublishMessageRequestBody body = new PublishMessageRequestBody(); + String url = "https://devcloud."+customInput.getRegion()+".huaweicloud.com/codecheck/project/"+customInput.getProject_id()+"/codecheck/task/"+customInput.getTask_id()+"/detail"; + String message = "尊敬的华为云用户,您好:\n本次执行代码检查的结果:"; + message+="\n致命问题数:" + info.getIssueCounts().getCritical(); + message+="\n严重问题数:" + info.getIssueCounts().getSerious(); + message+="\n常规问题数:" + info.getIssueCounts().getNormal(); + message+="\n提示问题数:" + info.getIssueCounts().getPrompt(); + message+="\n关于具体详情,可在:"+url+"\n中查看" ; + body.withMessage(message); + request.withBody(body); + try { + PublishMessageResponse response = client.publishMessage(request); + } catch (ConnectionException e) { + e.printStackTrace(); + } catch (RequestTimeoutException e) { + e.printStackTrace(); + } catch (ServiceResponseException e) { + e.printStackTrace(); + listener.getLogger().println("SMN服务消息发生失败,错误信息:" + e.getErrorMsg()); + } + } + + + + private static void inputValidate(CustomInput customInput) { + final String ak = customInput.getAk(); + final String sk = customInput.getSk(); + final String region = customInput.getRegion(); + final String projectId = customInput.getProject_id(); + final String taskId = customInput.getTask_id(); + Preconditions.checkArgument(StringUtils.isNotBlank(projectId), "projectId id can not be blank"); + Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "task id can not be blank"); + Preconditions.checkArgument(StringUtils.isNotBlank(region), "region can not be blank"); + Preconditions.checkArgument(StringUtils.isNotBlank(ak) && StringUtils.isNotBlank(sk), "Ak, Sk can not be blank"); + } + + +} diff --git a/src/main/java/com/huawei/jenkins/vss/CustomInput.java b/src/main/java/com/huawei/jenkins/vss/CustomInput.java new file mode 100644 index 0000000..8e2b7a1 --- /dev/null +++ b/src/main/java/com/huawei/jenkins/vss/CustomInput.java @@ -0,0 +1,221 @@ +package com.huawei.jenkins.vss; + +import org.apache.commons.lang.StringUtils; +import org.kohsuke.stapler.DataBoundSetter; + +import java.io.Serializable; + +/** + * 用户自定义输出参数 + */ +public class CustomInput implements Serializable { + private static final long serialVersionUID = 1L; + + private String ak; + + private String sk; + + private String region; + + //是否将本次扫描升级为专业版规格(¥99.00/次) + private String upgrade; + + //扫描任务的名称 + private String task_name; + + //被扫描的目标网址 + private String url; + + //扫描任务类型 + private String task_type; + + //普通任务的定时启动时间 + private String timer; + + //监测任务的定时触发时间 + private String trigger_time; + + //监测任务的定时触发周期 + private String task_period; + + //扫描模式:fast - 快速扫描 normal - 标准扫描 deep - 深度扫描 + private String scan_mode; + + //是否进行端口扫描 + private String port_scan; + + //是否进行弱密码扫描 + private String weak_pwd_scan; + + //是否进行CVE漏洞扫描 + private String cve_check; + + //是否进行网站内容合规文字检测 + private String text_check; + + //是否进行网站内容合规图片检测 + private String picture_check; + + //是否进行网站挂马检测 + private String malicious_code; + + //是否进行链接健康检测(死链、暗链、恶意外链) + private String malicious_link; + + private String topicUrn; + + public String getAk() { + return ak; + } + + public void setAk(String ak) { + this.ak = ak; + } + + public String getSk() { + return sk; + } + + public void setSk(String sk) { + this.sk = sk; + } + + public String getRegion() { + return region; + } + public void setRegion(String region) { + this.region = region; + } + + public String getUpgrade() { + return upgrade; + } + + public void setUpgrade(String upgrade) { + this.upgrade = upgrade; + } + + public String getTask_name() { + return task_name; + } + + public void setTask_name(String task_name) { + this.task_name = task_name; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getTask_type() { + return task_type; + } + + public void setTask_type(String task_type) { + this.task_type = task_type; + } + + public String getTimer() { + return timer; + } + + public void setTimer(String timer) { + this.timer = timer; + } + + public String getTrigger_time() { + return trigger_time; + } + + public void setTrigger_time(String trigger_time) { + this.trigger_time = trigger_time; + } + + public String getTask_period() { + return task_period; + } + + public void setTask_period(String task_period) { + this.task_period = task_period; + } + + public static long getSerialVersionUID() { + return serialVersionUID; + } + + public String getScan_mode() { + return scan_mode; + } + + public void setScan_mode(String scan_mode) { + this.scan_mode = scan_mode; + } + + public String getPort_scan() { + return port_scan; + } + + public void setPort_scan(String port_scan) { + this.port_scan = port_scan; + } + + public String getWeak_pwd_scan() { + return weak_pwd_scan; + } + + public void setWeak_pwd_scan(String weak_pwd_scan) { + this.weak_pwd_scan = weak_pwd_scan; + } + + public String getCve_check() { + return cve_check; + } + + public void setCve_check(String cve_check) { + this.cve_check = cve_check; + } + + public String getText_check() { + return text_check; + } + + public void setText_check(String text_check) { + this.text_check = text_check; + } + + public String getPicture_check() { + return picture_check; + } + + public void setPicture_check(String picture_check) { + this.picture_check = picture_check; + } + + public String getMalicious_code() { + return malicious_code; + } + + public void setMalicious_code(String malicious_code) { + this.malicious_code = malicious_code; + } + + public String getMalicious_link() { + return malicious_link; + } + + public void setMalicious_link(String malicious_link) { + this.malicious_link = malicious_link; + } + + public String getTopicUrn() { + return topicUrn; + } + + public void setTopicUrn(String topicUrn) { + this.topicUrn = topicUrn; + } +} diff --git a/src/main/java/com/huawei/jenkins/vss/vssCheckPipelineStep.java b/src/main/java/com/huawei/jenkins/vss/vssCheckPipelineStep.java new file mode 100644 index 0000000..9340ef0 --- /dev/null +++ b/src/main/java/com/huawei/jenkins/vss/vssCheckPipelineStep.java @@ -0,0 +1,313 @@ +/* + * Copyright 2022. Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huawei.jenkins.vss; + +import hudson.EnvVars; +import hudson.Extension; +import hudson.FilePath; +import hudson.model.TaskListener; +import org.jenkinsci.plugins.workflow.steps.*; +import org.kohsuke.stapler.DataBoundConstructor; +import org.kohsuke.stapler.DataBoundSetter; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * pipeline语法支持obs文件上传 + */ +public class vssCheckPipelineStep extends Step { + + private String ak; + + private String sk; + + private String region; + + //是否将本次扫描升级为专业版规格(¥99.00/次) + private String upgrade; + + //扫描任务的名称 + private String task_name; + + //被扫描的目标网址 + private String url; + + //扫描任务类型 + private String task_type; + + //普通任务的定时启动时间 + private String timer; + + //监测任务的定时触发时间 + private String trigger_time; + + //监测任务的定时触发周期 + private String task_period; + + //扫描模式:fast - 快速扫描 normal - 标准扫描 deep - 深度扫描 + private String scan_mode; + + //是否进行端口扫描 + private String port_scan; + + //是否进行弱密码扫描 + private String weak_pwd_scan; + + //是否进行CVE漏洞扫描 + private String cve_check; + + //是否进行网站内容合规文字检测 + private String text_check; + + //是否进行网站内容合规图片检测 + private String picture_check; + + //是否进行网站挂马检测 + private String malicious_code; + + //是否进行链接健康检测(死链、暗链、恶意外链) + private String malicious_link; + + private String topicUrn; + + public String getAk() { + return ak; + } + + @DataBoundSetter + public void setAk(String ak) { + this.ak = ak; + } + + public String getSk() { + return sk; + } + @DataBoundSetter + public void setSk(String sk) { + this.sk = sk; + } + + public String getRegion() { + return region; + } + @DataBoundSetter + public void setRegion(String region) { + this.region = region; + } + + public String getUpgrade() { + return upgrade; + } + @DataBoundSetter + public void setUpgrade(String upgrade) { + this.upgrade = upgrade; + } + + public String getTask_name() { + return task_name; + } + @DataBoundSetter + public void setTask_name(String task_name) { + this.task_name = task_name; + } + + public String getUrl() { + return url; + } + @DataBoundSetter + public void setUrl(String url) { + this.url = url; + } + + public String getTask_type() { + return task_type; + } + @DataBoundSetter + public void setTask_type(String task_type) { + this.task_type = task_type; + } + + public String getTimer() { + return timer; + } + @DataBoundSetter + public void setTimer(String timer) { + this.timer = timer; + } + + public String getTrigger_time() { + return trigger_time; + } + @DataBoundSetter + public void setTrigger_time(String trigger_time) { + this.trigger_time = trigger_time; + } + + public String getTask_period() { + return task_period; + } + @DataBoundSetter + public void setTask_period(String task_period) { + this.task_period = task_period; + } + + public String getScan_mode() { + return scan_mode; + } + @DataBoundSetter + public void setScan_mode(String scan_mode) { + this.scan_mode = scan_mode; + } + + public String getPort_scan() { + return port_scan; + } + @DataBoundSetter + public void setPort_scan(String port_scan) { + this.port_scan = port_scan; + } + + public String getWeak_pwd_scan() { + return weak_pwd_scan; + } + @DataBoundSetter + public void setWeak_pwd_scan(String weak_pwd_scan) { + this.weak_pwd_scan = weak_pwd_scan; + } + + public String getCve_check() { + return cve_check; + } + @DataBoundSetter + public void setCve_check(String cve_check) { + this.cve_check = cve_check; + } + + public String getText_check() { + return text_check; + } + @DataBoundSetter + public void setText_check(String text_check) { + this.text_check = text_check; + } + + public String getPicture_check() { + return picture_check; + } + @DataBoundSetter + public void setPicture_check(String picture_check) { + this.picture_check = picture_check; + } + + public String getMalicious_code() { + return malicious_code; + } + @DataBoundSetter + public void setMalicious_code(String malicious_code) { + this.malicious_code = malicious_code; + } + + public String getMalicious_link() { + return malicious_link; + } + @DataBoundSetter + public void setMalicious_link(String malicious_link) { + this.malicious_link = malicious_link; + } + + public String getTopicUrn() { + return topicUrn; + } + + @DataBoundSetter + public void setTopicUrn(String topicUrn) { + this.topicUrn = topicUrn; + } + + @DataBoundConstructor + public vssCheckPipelineStep(String region) { + this.region = region; + } + + @Override + public StepExecution start(StepContext context) throws Exception { + return new vssCheckPipelineStep.Execution(this, context); + } + + @Extension + public static class DescriptorImpl extends StepDescriptor { + + @Override + public Set extends Class>> getRequiredContext() { + return requires(TaskListener.class, EnvVars.class, FilePath.class); + } + + @Override + public String getFunctionName() { + return "CreateTasks"; + } + + @Override + public String getDisplayName() { + return "VSS check with Pipeline"; + } + } + + public static > Set requires(T... classes) { + return new HashSet<>(Arrays.asList(classes)); + } + + public static class Execution extends SynchronousNonBlockingStepExecution { + + protected static final long serialVersionUID = 1L; + + protected final transient vssCheckPipelineStep step; + + public Execution(vssCheckPipelineStep step, StepContext context) { + super(context); + this.step = step; + + } + + @Override + public String run() throws Exception { + CustomInput customInput = new CustomInput(); + customInput.setAk(step.getAk()); + customInput.setSk(step.getSk()); + customInput.setRegion(step.getRegion()); + customInput.setUpgrade(step.getUpgrade()); + customInput.setTask_name(step.getTask_name()); + customInput.setUrl(step.getUrl()); + customInput.setTask_type(step.getTask_type()); + customInput.setTrigger_time(step.getTrigger_time()); + customInput.setTask_period(step.getTask_period()); + customInput.setScan_mode(step.getScan_mode()); + customInput.setPort_scan(step.getPort_scan()); + customInput.setWeak_pwd_scan(step.getWeak_pwd_scan()); + customInput.setCve_check(step.getCve_check()); + customInput.setText_check(step.getText_check()); + customInput.setPicture_check(step.getPicture_check()); + customInput.setMalicious_code(step.getMalicious_code()); + customInput.setMalicious_link(step.getMalicious_link()); + customInput.setTopicUrn(step.getTopicUrn()); + TaskListener listener = vssCheckPipelineStep.Execution.this.getContext().get(TaskListener.class); + return vssService.CreateTasks(listener, customInput); + } + } +} diff --git a/src/main/java/com/huawei/jenkins/vss/vssService.java b/src/main/java/com/huawei/jenkins/vss/vssService.java new file mode 100644 index 0000000..ac16885 --- /dev/null +++ b/src/main/java/com/huawei/jenkins/vss/vssService.java @@ -0,0 +1,220 @@ +package com.huawei.jenkins.vss; + +import com.cloudbees.plugins.credentials.CredentialsProvider; +import com.cloudbees.plugins.credentials.matchers.IdMatcher; +import com.google.common.base.Preconditions; +import com.huaweicloud.sdk.codecheck.v2.model.CheckRecordDataInfo; +import com.huaweicloud.sdk.core.auth.BasicCredentials; +import com.huaweicloud.sdk.core.auth.ICredential; +import com.huaweicloud.sdk.core.exception.ConnectionException; +import com.huaweicloud.sdk.core.exception.RequestTimeoutException; +import com.huaweicloud.sdk.core.exception.ServiceResponseException; +import com.huaweicloud.sdk.smn.v2.SmnClient; +import com.huaweicloud.sdk.smn.v2.model.PublishMessageRequest; +import com.huaweicloud.sdk.smn.v2.model.PublishMessageRequestBody; +import com.huaweicloud.sdk.smn.v2.model.PublishMessageResponse; +import com.huaweicloud.sdk.smn.v2.region.SmnRegion; +import com.huaweicloud.sdk.vss.v3.VssClient; +import com.huaweicloud.sdk.vss.v3.model.*; +import com.huaweicloud.sdk.vss.v3.region.VssRegion; +import org.apache.commons.lang.StringUtils; +import hudson.model.TaskListener; + +import java.io.Serializable; + + +public class vssService implements Serializable { + private static final long serialVersionUID = 1; + + public static String CreateTasks(TaskListener listener, CustomInput customInput) { + inputValidate(customInput); + ICredential auth = new BasicCredentials() + .withAk(customInput.getAk()) + .withSk(customInput.getSk()); + + VssClient client = VssClient.newBuilder() + .withCredential(auth) + .withRegion(VssRegion.valueOf(customInput.getRegion())) + .build(); + CreateTasksRequest request = new CreateTasksRequest(); + if (StringUtils.isNotBlank(customInput.getUpgrade())) { + request.withUpgrade(Boolean.valueOf(customInput.getUpgrade())); + } + + + CreateTasksRequestBody body = new CreateTasksRequestBody(); + + TaskSettingsTaskConfig taskConfigbody = new TaskSettingsTaskConfig(); + + body.withUrl(customInput.getUrl()); + body.withTaskName(customInput.getTask_name()); + + if (StringUtils.isNotBlank(customInput.getTask_type())) { + body.withTaskType(CreateTasksRequestBody.TaskTypeEnum.fromValue(customInput.getTask_type())); + } + + if (StringUtils.isNotBlank(customInput.getTask_period())) { + body.withTaskPeriod(CreateTasksRequestBody.TaskPeriodEnum.fromValue(customInput.getTask_period())); + } + + if (StringUtils.isNotBlank(customInput.getTimer())) { + body.withTimer(customInput.getTimer()); + } + + if (StringUtils.isNotBlank(customInput.getTimer())) { + body.withTimer(customInput.getTimer()); + } + + if (StringUtils.isNotBlank(customInput.getTrigger_time())) { + body.withTriggerTime(customInput.getTrigger_time()); + } + + if (StringUtils.isNotBlank(customInput.getScan_mode())) { + taskConfigbody.withScanMode(TaskSettingsTaskConfig.ScanModeEnum.fromValue(customInput.getScan_mode())); + } + + if (StringUtils.isNotBlank(customInput.getPort_scan())) { + taskConfigbody.withPortScan(Boolean.valueOf(customInput.getPort_scan())); + } + + if (StringUtils.isNotBlank(customInput.getWeak_pwd_scan())) { + taskConfigbody.withWeakPwdScan(Boolean.valueOf(customInput.getWeak_pwd_scan())); + } + + if (StringUtils.isNotBlank(customInput.getCve_check())) { + taskConfigbody.withCveCheck(Boolean.valueOf(customInput.getCve_check())); + } + + if (StringUtils.isNotBlank(customInput.getText_check())) { + taskConfigbody.withTextCheck(Boolean.valueOf(customInput.getText_check())); + } + + if (StringUtils.isNotBlank(customInput.getPicture_check())) { + taskConfigbody.withPictureCheck(Boolean.valueOf(customInput.getPicture_check())); + } + + if (StringUtils.isNotBlank(customInput.getMalicious_code())) { + taskConfigbody.withMaliciousCode(Boolean.valueOf(customInput.getMalicious_code())); + } + + if (StringUtils.isNotBlank(customInput.getMalicious_link())) { + taskConfigbody.withMaliciousLink(Boolean.valueOf(customInput.getMalicious_link())); + } + + body.withTaskConfig(taskConfigbody); + request.withBody(body); + String message = ""; + try { + CreateTasksResponse response = client.createTasks(request); + listener.getLogger().println("创建扫描任务并执行:" + response.getInfoCode()); + + listener.getLogger().println("任务状态:" + response.getTaskStatus()); + String taskStatus = response.getTaskStatus().toString(); + ShowTasksResponse showTasksResponse = null; + while (taskStatus.equals("running") || taskStatus.equals("waiting")) { + showTasksResponse = showTasks(client, response.getTaskId(), listener); + taskStatus = showTasksResponse.getTaskStatus().toString(); + try { + if(taskStatus.equals("running")){ + Thread.currentThread().sleep(30000); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + if(taskStatus.equals("success")){ + listener.getLogger().println("安全分数:" + showTasksResponse.getScore()); + listener.getLogger().println("安全等级:" + showTasksResponse.getSafeLevel()); + listener.getLogger().println("高危漏洞数:" + showTasksResponse.getStatistics().getHigh()); + listener.getLogger().println("中危漏洞数:" + showTasksResponse.getStatistics().getMiddle()); + listener.getLogger().println("低危漏洞数:" + showTasksResponse.getStatistics().getLow()); + listener.getLogger().println("提示危漏洞数:" + showTasksResponse.getStatistics().getHint()); + + if(StringUtils.isNotBlank(customInput.getTopicUrn())){ + //发送钉钉微信通知 + publishMessage(customInput,showTasksResponse, listener); + } + + } + + + } catch (ConnectionException e) { + e.printStackTrace(); + } catch (RequestTimeoutException e) { + e.printStackTrace(); + } catch (ServiceResponseException e) { + e.printStackTrace(); + listener.getLogger().println("错误信息:" + e.getErrorMsg()); + } + return message; + } + + private static void inputValidate(CustomInput customInput) { + final String ak = customInput.getAk(); + final String sk = customInput.getSk(); + final String region = customInput.getRegion(); + final String task_name = customInput.getTask_name(); + final String url = customInput.getUrl(); + Preconditions.checkArgument(StringUtils.isNotBlank(task_name), "task name can not be blank"); + Preconditions.checkArgument(StringUtils.isNotBlank(url), "url can not be blank"); + Preconditions.checkArgument(StringUtils.isNotBlank(region), "region can not be blank"); + Preconditions.checkArgument(StringUtils.isNotBlank(ak) && StringUtils.isNotBlank(sk), "Ak, Sk can not be blank"); + } + + + public static ShowTasksResponse showTasks(VssClient client, String taskId, TaskListener listener) { + ShowTasksRequest request = new ShowTasksRequest(); + request.withTaskId(taskId); + ShowTasksResponse response = null; + try { + response = client.showTasks(request); + listener.getLogger().println("任务进度:" + response.getProgress()+"%"); + listener.getLogger().println("任务状态:" + response.getTaskStatus()); + } catch (ConnectionException e) { + e.printStackTrace(); + } catch (RequestTimeoutException e) { + e.printStackTrace(); + } catch (ServiceResponseException e) { + e.printStackTrace(); + listener.getLogger().println("错误信息:" + e.getErrorMsg()); + } + return response; + } + + public static void publishMessage(CustomInput customInput, ShowTasksResponse info, TaskListener listener) { + ICredential auth = new BasicCredentials() + .withAk(customInput.getAk()) + .withSk(customInput.getSk()); + + SmnClient client = SmnClient.newBuilder() + .withCredential(auth) + .withRegion(SmnRegion.valueOf(customInput.getRegion())) + .build(); + PublishMessageRequest request = new PublishMessageRequest(); + request.withTopicUrn(customInput.getTopicUrn()); + PublishMessageRequestBody body = new PublishMessageRequestBody(); + String url = "https://console.huaweicloud.com/vss/?region="+customInput.getRegion()+"#/vss/manager/assetlist/domain"; + String message = "尊敬的华为云用户,您好:\n本次执行VSS漏洞扫描的结果:"; + message+="\n安全分数:" + info.getScore(); + message+="\n安全等级:" + info.getSafeLevel(); + message+="\n高危漏洞数:" + info.getStatistics().getHigh(); + message+="\n中危漏洞数:" + info.getStatistics().getMiddle(); + message+="\n低危漏洞数:" + info.getStatistics().getLow() ; + message+="\n提示危漏洞数:" + info.getStatistics().getHint() ; + message+="\n关于具体详情,可在:"+url+"\n中查看" ; + body.withMessage(message); + request.withBody(body); + try { + PublishMessageResponse response = client.publishMessage(request); + } catch (ConnectionException e) { + e.printStackTrace(); + } catch (RequestTimeoutException e) { + e.printStackTrace(); + } catch (ServiceResponseException e) { + e.printStackTrace(); + listener.getLogger().println("SMN服务消息发生失败,错误信息:" + e.getErrorMsg()); + } + } + + +} diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/Messages.properties b/src/main/resources/com/huawei/jenkins/codeCheck/Messages.properties new file mode 100644 index 0000000..8d738f6 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/Messages.properties @@ -0,0 +1,7 @@ +codeCheckPublish.DisplayName=HuaweiCloud code Check + +codeCheckPublish.MissingAccessKey=Please set AccessKey +codeCheckPublish.MissingSecretKey=Please set SecretKey +codeCheckPublish.MissingRegion=Please set Region +codeCheckPublish.MissingProjectId=Please set ProjectId +codeCheckPublish.MissingTaskId=Please set TaskId diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/Messages_zh_CN.properties b/src/main/resources/com/huawei/jenkins/codeCheck/Messages_zh_CN.properties new file mode 100644 index 0000000..8dd6885 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/Messages_zh_CN.properties @@ -0,0 +1,11 @@ +OBSPublish.DisplayName=\u534e\u4e3a\u4e91OBS\u4e0a\u4f20 + +OBSPublish.MissingEndpoint=\u8bf7\u8bbe\u7f6eEndpoint +OBSPublish.MissingAccessKeyId=\u8bf7\u8bbe\u7f6eAccessKeyId +OBSPublish.MissingAccessKeySecret=\u8bf7\u8bbe\u7f6eAccessKeySecret +OBSPublish.MissingBucketName=\u8bf7\u8bbe\u7f6eBucketName +OBSPublish.MissingLocalPath=\u8bf7\u8bbe\u7f6e\u672c\u5730\u8def\u5f84 +OBSPublish.MissingPath=\u8bf7\u8bbe\u7f6e\u8fdc\u7a0b\u8def\u5f84 +OBSPublish.MaxRetiesMustBeNumbers=\u6700\u5927\u91cd\u8bd5\u6b21\u6570\u5fc5\u987b\u4e3a\u6570\u5b57 +OBSPublish.MustBeginWithSlash=\u5fc5\u987b\u4ee5`/`\u5f00\u5934 +OBSPublish.IncludeException=\u89e3\u6790\u5f02\u5e38 \ No newline at end of file diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/config.jelly b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/config.jelly new file mode 100644 index 0000000..5b68abc --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/config.jelly @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-ak.html b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-ak.html new file mode 100644 index 0000000..7d9c6d8 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-ak.html @@ -0,0 +1,19 @@ + + + HuaweiCloud Access Key, used only when the credential id is null + 去配置 + diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-project_id.html b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-project_id.html new file mode 100644 index 0000000..fbb0c4d --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-project_id.html @@ -0,0 +1,18 @@ + + + project id + diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-region.html b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-region.html new file mode 100644 index 0000000..3ccb0ee --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-region.html @@ -0,0 +1,18 @@ + + + The currently callable territory + diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-sk.html b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-sk.html new file mode 100644 index 0000000..5944430 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-sk.html @@ -0,0 +1,19 @@ + + + HuaweiCloud Secret Key, used only when the credential id is null + config + diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-task_id.html b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-task_id.html new file mode 100644 index 0000000..59e59ac --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-task_id.html @@ -0,0 +1,18 @@ + + + task id + diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-topicUrn.html b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-topicUrn.html new file mode 100644 index 0000000..74d4ce5 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help-topicUrn.html @@ -0,0 +1,18 @@ + + + Topic URN in the SMN service + diff --git a/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help.html b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help.html new file mode 100644 index 0000000..a8a8e8f --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/codeCheck/codeCheckPipelineStep/help.html @@ -0,0 +1,20 @@ + + + + Code check + + diff --git a/src/main/resources/com/huawei/jenkins/vss/Messages.properties b/src/main/resources/com/huawei/jenkins/vss/Messages.properties new file mode 100644 index 0000000..1730826 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/Messages.properties @@ -0,0 +1,8 @@ +VSSPublish.DisplayName=HuaweiCloud VSS Check + +VSSPublish.MissingAccessKey=Please set AccessKey +VSSPublish.MissingSecretKey=Please set SecretKey +VSSPublish.MissingRegion=Please set Region +VSSPublish.MissingTaskName=Please set task name +VSSPublish.MissingUrl=Please set Url + diff --git a/src/main/resources/com/huawei/jenkins/vss/Messages_zh_CN.properties b/src/main/resources/com/huawei/jenkins/vss/Messages_zh_CN.properties new file mode 100644 index 0000000..8dd6885 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/Messages_zh_CN.properties @@ -0,0 +1,11 @@ +OBSPublish.DisplayName=\u534e\u4e3a\u4e91OBS\u4e0a\u4f20 + +OBSPublish.MissingEndpoint=\u8bf7\u8bbe\u7f6eEndpoint +OBSPublish.MissingAccessKeyId=\u8bf7\u8bbe\u7f6eAccessKeyId +OBSPublish.MissingAccessKeySecret=\u8bf7\u8bbe\u7f6eAccessKeySecret +OBSPublish.MissingBucketName=\u8bf7\u8bbe\u7f6eBucketName +OBSPublish.MissingLocalPath=\u8bf7\u8bbe\u7f6e\u672c\u5730\u8def\u5f84 +OBSPublish.MissingPath=\u8bf7\u8bbe\u7f6e\u8fdc\u7a0b\u8def\u5f84 +OBSPublish.MaxRetiesMustBeNumbers=\u6700\u5927\u91cd\u8bd5\u6b21\u6570\u5fc5\u987b\u4e3a\u6570\u5b57 +OBSPublish.MustBeginWithSlash=\u5fc5\u987b\u4ee5`/`\u5f00\u5934 +OBSPublish.IncludeException=\u89e3\u6790\u5f02\u5e38 \ No newline at end of file diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/config.jelly b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/config.jelly new file mode 100644 index 0000000..2382047 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/config.jelly @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + true + false + + + + + + + + + + + + normal + monitor + + + + + + + + + + + + + + + everyday + threedays + everyweek + everymonth + + + + + + fast + normal + deep + + + + + + true + false + + + + + + true + false + + + + + + true + false + + + + + + true + false + + + + + + true + false + + + + + + true + false + + + + + + true + false + + + + + + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-ak.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-ak.html new file mode 100644 index 0000000..7d9c6d8 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-ak.html @@ -0,0 +1,19 @@ + + + HuaweiCloud Access Key, used only when the credential id is null + 去配置 + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-cve_check.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-cve_check.html new file mode 100644 index 0000000..d851862 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-cve_check.html @@ -0,0 +1,18 @@ + + + Whether to scan for CVE vulnerabilities + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-malicious_code.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-malicious_code.html new file mode 100644 index 0000000..cdb7e5c --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-malicious_code.html @@ -0,0 +1,18 @@ + + + Whether to carry out website hanging horse test + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-malicious_link.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-malicious_link.html new file mode 100644 index 0000000..e7390b2 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-malicious_link.html @@ -0,0 +1,18 @@ + + + Whether to perform link health check (dead link, dark link, malicious external link) + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-picture_check.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-picture_check.html new file mode 100644 index 0000000..c2db426 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-picture_check.html @@ -0,0 +1,18 @@ + + + Whether to conduct website content compliance image detection + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-port_scan.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-port_scan.html new file mode 100644 index 0000000..d90e27d --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-port_scan.html @@ -0,0 +1,18 @@ + + + Whether to scan for ports + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-region.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-region.html new file mode 100644 index 0000000..3ccb0ee --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-region.html @@ -0,0 +1,18 @@ + + + The currently callable territory + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-scan_mode.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-scan_mode.html new file mode 100644 index 0000000..21d5879 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-scan_mode.html @@ -0,0 +1,21 @@ + + + Scanning mode: + fast - Fast scan + normal - Standard scan + Deep-depth scanning + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-sk.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-sk.html new file mode 100644 index 0000000..5944430 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-sk.html @@ -0,0 +1,19 @@ + + + HuaweiCloud Secret Key, used only when the credential id is null + config + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_name.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_name.html new file mode 100644 index 0000000..515d53f --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_name.html @@ -0,0 +1,20 @@ + + + Task name + example + "Test Task 1" + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_period_timer.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_period_timer.html new file mode 100644 index 0000000..4b4da92 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_period_timer.html @@ -0,0 +1,22 @@ + + + Timing trigger period of monitoring task: + everyday - everyday + threedays - every threedays + everyweek - Every week + everymonth - Every month + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_type.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_type.html new file mode 100644 index 0000000..952d5bc --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-task_type.html @@ -0,0 +1,20 @@ + + + Scanning task type: + normal - An ordinary task + monitor - Monitors tasks + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-text_check.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-text_check.html new file mode 100644 index 0000000..08b2fa0 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-text_check.html @@ -0,0 +1,18 @@ + + + Whether to conduct website content compliance text test + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-timer.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-timer.html new file mode 100644 index 0000000..ca3189b --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-timer.html @@ -0,0 +1,20 @@ + + + Regular start time of a common task + example + "2021-09-18 16:26:24" + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-topicUrn.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-topicUrn.html new file mode 100644 index 0000000..74d4ce5 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-topicUrn.html @@ -0,0 +1,18 @@ + + + Topic URN in the SMN service + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-trigger_timer.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-trigger_timer.html new file mode 100644 index 0000000..f7e4273 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-trigger_timer.html @@ -0,0 +1,20 @@ + + + Timed trigger time of a monitoring task + example + "2021-09-18 16:26:24" + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-upgrade.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-upgrade.html new file mode 100644 index 0000000..6b038a1 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-upgrade.html @@ -0,0 +1,18 @@ + + + Whether to upgrade this scan to professional version specifications (¥99.00/ time) + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-url.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-url.html new file mode 100644 index 0000000..58d92c2 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-url.html @@ -0,0 +1,20 @@ + + + The target URL to be scanned + example + "https://127.0.0.1:8080" + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-weak_pwd_scan.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-weak_pwd_scan.html new file mode 100644 index 0000000..73d68a7 --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help-weak_pwd_scan.html @@ -0,0 +1,18 @@ + + + Whether to perform weak password scanning + diff --git a/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help.html b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help.html new file mode 100644 index 0000000..2830ccf --- /dev/null +++ b/src/main/resources/com/huawei/jenkins/vss/vssCheckPipelineStep/help.html @@ -0,0 +1,20 @@ + + + + vss vulnerability scanning + + -- Gitee
+ Code check +
+ vss vulnerability scanning +