diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp index 3f318c1..2cd5b4a 100644 --- a/plugin/business/pangu-http/src/pangu_http.cpp +++ b/plugin/business/pangu-http/src/pangu_http.cpp @@ -1178,6 +1178,12 @@ static enum pangu_action decide_ctrl_action(const struct Maat_rule_t * hit_rules if (prior_action == PG_ACTION_WHITELIST) { + if(*n_enforce==0) + { + *enforce_rules=ALLOC(struct Maat_rule_t, 1); + } + *enforce_rules[0]=*prior_rule; + *n_enforce=1; return PG_ACTION_WHITELIST; } @@ -1908,8 +1914,12 @@ enum pangu_action http_scan(const struct tfe_http_session * session, enum tfe_ht if (hit_cnt > 0) { ctx->action = decide_ctrl_action(result, hit_cnt, &ctx->enforce_rules, &ctx->n_enforce, &ctx->param); - if (ctx->action == PG_ACTION_WHITELIST) goto __out; - + if (ctx->action == PG_ACTION_WHITELIST) + { + TFE_LOG_INFO(g_pangu_rt->local_logger, "Bypass rules matched: url=%s policy id=%d.", + session->req->req_spec.url, ctx->enforce_rules[0].config_id); + goto __out; + } if (hit_cnt > 1) { p = buff; @@ -2283,6 +2293,8 @@ void pangu_on_http_begin(const struct tfe_stream * stream, } if (ctx->action == PG_ACTION_WHITELIST) { + TFE_LOG_INFO(g_pangu_rt->local_logger, "Bypass rules matched on http begin: url=%s policy id=%d.", + session->req->req_spec.url, ctx->enforce_rules[0].config_id); tfe_http_session_detach(session); } diff --git a/plugin/business/pangu-http/src/pangu_logger.cpp b/plugin/business/pangu-http/src/pangu_logger.cpp index a016ea1..335bed1 100644 --- a/plugin/business/pangu-http/src/pangu_logger.cpp +++ b/plugin/business/pangu-http/src/pangu_logger.cpp @@ -333,7 +333,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg) per_hit_obj=cJSON_Duplicate(common_obj, 1); cJSON_AddNumberToObject(per_hit_obj, "policy_id", log_msg->result[i].config_id); cJSON_AddNumberToObject(per_hit_obj, "service", log_msg->result[i].service_id); - cJSON_AddNumberToObject(per_hit_obj, "action", log_msg->result[i].action); + cJSON_AddNumberToObject(per_hit_obj, "action", (unsigned char)log_msg->result[i].action); log_payload = cJSON_PrintUnformatted(per_hit_obj); TFE_LOG_DEBUG(handle->local_logger, "%s", log_payload);