parent
c4bba95fad
commit
32ddade22f
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>opsli-plugins</artifactId>
|
||||||
|
<groupId>org.opsliframework.boot</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>opsli-plugins-waf</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2020 OPSLI 快速开发平台 https://www.opsli.com
|
||||||
|
* <p>
|
||||||
|
* 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
|
||||||
|
* <p>
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p>
|
||||||
|
* 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 org.opsli.plugins.waf.msg;
|
||||||
|
|
||||||
|
import org.opsli.common.base.msg.BaseMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: opsli-boot
|
||||||
|
* @BelongsPackage: org.opsli.plugins.mail.msg
|
||||||
|
* @Author: Parker
|
||||||
|
* @CreateTime: 2020-09-13 19:54
|
||||||
|
* @Description: Excel 消息
|
||||||
|
*/
|
||||||
|
public enum WafMsg implements BaseMsg {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防火墙
|
||||||
|
*/
|
||||||
|
WAF_EXCEPTION_XSS(10500, "包含非法字符!"),
|
||||||
|
WAF_EXCEPTION_SQL(10501, "包含非法字符!"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String message;
|
||||||
|
|
||||||
|
WafMsg(int code, String message){
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return this.message;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package org.opsli.plugins.waf.properties;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 软防火墙
|
||||||
|
*
|
||||||
|
* @author Parker
|
||||||
|
* @date 2020-12-19
|
||||||
|
*/
|
||||||
|
@ConfigurationProperties(prefix = WafProperties.PROP_PREFIX)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class WafProperties {
|
||||||
|
|
||||||
|
public static final String PROP_PREFIX = "opsli.waf";
|
||||||
|
|
||||||
|
|
||||||
|
/** 是否生效 */
|
||||||
|
private boolean enable;
|
||||||
|
|
||||||
|
/** xss 过滤 */
|
||||||
|
private boolean xssFilter;
|
||||||
|
|
||||||
|
/** sql 过滤 */
|
||||||
|
private boolean sqlFilter;
|
||||||
|
|
||||||
|
/** 过滤器需要过滤的路径 */
|
||||||
|
private Set<String> urlPatterns;
|
||||||
|
|
||||||
|
/** 过滤器需要排除过滤的路径 */
|
||||||
|
private Set<String> urlExclusion;
|
||||||
|
|
||||||
|
/** 过滤器的优先级,值越小优先级越高 */
|
||||||
|
private int order;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "opsli.waf.enable",
|
||||||
|
"sourceType": "org.opsli.plugins.waf.properties.WafProperties",
|
||||||
|
"type": "java.lang.Boolean",
|
||||||
|
"defaultValue": false,
|
||||||
|
"description": "软防火墙是否开启."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "opsli.waf.xss-filter",
|
||||||
|
"sourceType": "org.opsli.plugins.waf.properties.WafProperties",
|
||||||
|
"type": "java.lang.Boolean",
|
||||||
|
"defaultValue": false,
|
||||||
|
"description": "软防火墙 xss 过滤开启状态."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "opsli.waf.sql-filter",
|
||||||
|
"sourceType": "org.opsli.plugins.waf.properties.WafProperties",
|
||||||
|
"type": "java.lang.Boolean",
|
||||||
|
"defaultValue": false,
|
||||||
|
"description": "软防火墙 sql 过滤开启状态."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "opsli.waf.url-patterns",
|
||||||
|
"sourceType": "org.opsli.plugins.waf.properties.WafProperties",
|
||||||
|
"type": "java.util.Set<java.lang.String>",
|
||||||
|
"defaultValue": [
|
||||||
|
"/*"
|
||||||
|
],
|
||||||
|
"description": "软防火墙 过滤器需要过滤的路径."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "opsli.waf.url-exclusion",
|
||||||
|
"sourceType": "org.opsli.plugins.waf.properties.WafProperties",
|
||||||
|
"type": "java.util.Set<java.lang.String>",
|
||||||
|
"description": "软防火墙 过滤器需要排除过滤的路径."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "opsli.waf.order",
|
||||||
|
"sourceType": "org.opsli.plugins.waf.properties.WafProperties",
|
||||||
|
"type": "java.lang.Integer",
|
||||||
|
"defaultValue": 0,
|
||||||
|
"description": "软防火墙 过滤器的优先级,值越小优先级越高."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=org.opsli.plugins.waf.conf.WafConfig
|
Loading…
Reference in new issue