fix: send challenge even if acl is inactive in sec pol profile
@@ -278,7 +278,6 @@ pub fn analyze_finish<GH: Grasshopper>(
};
}
- if blocking {
let acl_block = |reasons: Vec<BlockReason>, tags: &mut Tags| {
secpol
.acl_profile
@@ -286,8 +285,9 @@ pub fn analyze_finish<GH: Grasshopper>(
.to_decision(is_human, mgh, &reqinfo, tags, reasons)
};
- let decision = if decision.challenge {
- match (reqinfo.headers.get("user-agent"), mgh) {
+ // Send challenge, even if the acl is inactive in sec_pol.
+ if decision.challenge {
+ let decision = match (reqinfo.headers.get("user-agent"), mgh) {
(Some(ua), Some(gh)) => challenge_phase01(gh, ua, brs),
(gua, ggh) => {
logs.debug(|| {
@@ -299,10 +299,18 @@ pub fn analyze_finish<GH: Grasshopper>(
});
acl_block(brs, &mut tags)
}
- }
- } else {
- acl_block(brs, &mut tags)
};
+
+ return AnalyzeResult {
+ decision,
+ tags,
+ rinfo: masking(reqinfo),
+ stats: stats.acl_stage_build(),
+ };
+ }
+
+ if blocking {
+ let decision = acl_block(brs, &mut tags);
return AnalyzeResult {
decision,
tags,
