Skip to content

Conversation

@0RAJA
Copy link
Collaborator

@0RAJA 0RAJA commented Oct 17, 2025

No description provided.

JetDrag and others added 4 commits October 17, 2025 22:02
1. 新增事件字段筛选及策略相关接口与常量
2. 增加事件合流入库 doris
 - 增加事件 doris 合流表初始化
 - 审计策略-规则审计,模型审计支持 doris 合流入库(已兼容历史策略)
3. 系统初始化
 - 支持策略标签资源纳入权限模型并同步 IAM 初始化
 - 增加事件相关资产反向拉取初始化
 - 定时同步资产快照结果表并完善插件入库任务
 - 移除风险模型标签冗余字段并优化 IAM Provider
4. 优化风险列表筛选条件,增加日志打印
@0RAJA 0RAJA requested a review from JetDrag October 17, 2025 14:29
@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2025

Codecov Report

❌ Patch coverage is 87.01299% with 220 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.30%. Comparing base (fa501b8) to head (fd18e95).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/backend/services/web/risk/resources/risk.py 79.10% 121 Missing ⚠️
src/backend/core/serializers.py 56.00% 33 Missing ⚠️
...trategy_v2/migrations/0018_storage_node_ids_map.py 60.60% 13 Missing ⚠️
.../services/web/databus/collector_plugin/handlers.py 80.32% 12 Missing ⚠️
src/backend/services/web/risk/provider.py 84.12% 10 Missing ⚠️
src/backend/services/web/entry/init/base.py 71.87% 9 Missing ⚠️
src/backend/services/web/analyze/controls/aiops.py 86.20% 4 Missing ⚠️
src/backend/tests/test_risk/test_retrieve_risk.py 98.89% 3 Missing ⚠️
...update_resource_type_ticket_permission_20251020.py 84.61% 2 Missing ⚠️
...ackend/services/web/analyze/controls/rule_audit.py 88.23% 2 Missing ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1106      +/-   ##
==========================================
+ Coverage   77.23%   78.30%   +1.07%     
==========================================
  Files         622      633      +11     
  Lines       27689    29301    +1612     
==========================================
+ Hits        21385    22944    +1559     
- Misses       6304     6357      +53     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines 503 to 516
def _build_event_filter_condition(self, filter_item: Dict[str, Any], index: int) -> str:
alias = f"risk_event_{index}"
join_conditions = [f"{alias}.strategy_id = base_query.strategy_id"]

field_expression = self._build_event_field_expression(alias, filter_item)
if not field_expression:
return ""

comparison = self._build_event_filter_expression(field_expression, filter_item)
if not comparison:
return ""

join_clause = " AND ".join(join_conditions)
table_reference = self._get_risk_event_table_reference()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Event filtering ignores risk identity

The BKBase event filter predicate only joins on strategy_id when determining whether a risk matches the supplied event field filters. If two risks originate from the same strategy but have different event payloads, the EXISTS clause will return true for all of them as soon as any event for that strategy satisfies the filter, because the subquery never correlates on the risk’s raw_event_id (or another risk-specific key). This means filtering by event fields can return unrelated risks. The join should include a risk-specific identifier (e.g. raw_event_id or risk_id) and the column must be selected in the base subquery so that each risk is filtered against its own event record.

Useful? React with 👍 / 👎.

JetDrag and others added 23 commits October 20, 2025 15:54
1. 增加支持过滤的field的id。添加过滤operator支持。
1. 优化时间分区过滤条件。

feat: 新增关联事件字段搜索功能 --story=126826559

1. 使用sqllot重构sql生成逻辑,确保可用性。
2. 优化测试用例。
1. 简化sql语句,修正遗漏。
2. 优化测试用例。
1. 新增资源反向拉取
2. 修复 github 单测异常
3. 资产表反向拉取支持 JSON 字段

(cherry picked from commit eaffc55)
Signed-off-by: raja <[email protected]>
1. 修正兼容性差的*写法。

(cherry picked from commit 1121f8f)
1. 新增工单权限表资源反向拉取的初始化

Signed-off-by: raja <[email protected]>
1. 兼容query某些情况下提前为空的情况。
1. 优化资产反向拉取支持 JSON 字段逻辑

Signed-off-by: raja <[email protected]>
(cherry picked from commit afc3b21)
1. 修复事件表 json 字段入库配置

Signed-off-by: raja <[email protected]>
1. 优化资产反向拉取支持 JSON 字段逻

Signed-off-by: raja <[email protected]>
(cherry picked from commit a633c8b)
1. 移除表标识符格式化中的反引号包裹。
1. 移除表标识符格式化中的反引号包裹。
1. 去掉多余的event risk_id对应。
1. 去掉多余的event risk_id对应。
1. 去掉多余的event risk_id对应。
1. 优化风险资产反向拉取时间判断逻辑

Signed-off-by: raja <[email protected]>
(cherry picked from commit 3791db3)
1. 新增事件和风险raw_event_id约束
1. 修改事件时间戳条件并移除LIKE表达式转义
1. 优化模型审计策略更新逻辑,兼容 doris 存储节点变更

Signed-off-by: raja <[email protected]>
JetDrag and others added 4 commits October 22, 2025 19:56
1. 新增数值过滤器测试及优化数值操作符处理逻辑
1. 新增重复字段处理逻辑及测试,优化类型与格式
1. 新增 BKBase SQL 记录与票权限表替换
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants