cl
8 小时以前 c4bba32b20f0869b45ed14be04543869dd91ee6c
rsf-http-audit/src/main/java/com/vincent/rsf/httpaudit/props/HttpAuditProperties.java
@@ -17,11 +17,24 @@
    private boolean enabled = true;
    /**
     * true:入站/出站是否落库由 {@code sys_http_audit_rule} 决定(含 record_all=1 全量、方向 IN/OUT/BOTH、截断长度);false:排除路径外入站与全部出站均记录,截断用本配置 + 规则中「全量」行的 request/response_max_chars(若有)
     */
    private boolean whitelistOnly = true;
    /** 规则缓存定时刷新间隔(毫秒) */
    private long ruleCacheRefreshMs = 60_000L;
    /** 查询类响应最多保留字符数 */
    private int queryResponseMaxChars = 500;
    /** 非查询类响应最多入库字节(超出截断并标记) */
    private int maxResponseStoreChars = 65535;
    /**
     * 规则未指定 request_max_chars 时的默认:字符数;-1 表示入库不截断请求体
     */
    private int defaultRequestStoreChars = 65535;
    /** 请求体缓存上限(字节) */
    private int maxRequestCacheBytes = 2 * 1024 * 1024;
@@ -31,6 +44,20 @@
    /** 不落库的路径前缀 */
    private List<String> excludePathPrefixes = defaultExcludes();
    /**
     * true:默认排除中的 /httpAuditLog、/httpAuditRule 仍生效;false:不再排除这两项(便于调试;record_all 也无法绕过 true 时的排除)
     */
    private boolean excludeAuditSelfPaths = true;
    /** Filter 实际使用的前缀(受 excludeAuditSelfPaths 影响) */
    public List<String> getEffectiveExcludePrefixes() {
        List<String> list = excludePathPrefixes == null ? new ArrayList<>() : new ArrayList<>(excludePathPrefixes);
        if (!excludeAuditSelfPaths) {
            list.removeIf(p -> "/httpAuditLog".equals(p) || "/httpAuditRule".equals(p));
        }
        return list;
    }
    /** 视为外部调用的路径前缀(其余为内部) */
    private List<String> externalPathPrefixes = defaultExternal();
@@ -51,6 +78,7 @@
        list.add("/favicon.ico");
        list.add("/static/");
        list.add("/httpAuditLog");
        list.add("/httpAuditRule");
        return list;
    }