Skip to content

[driver-sql] 未知查询 operator(is/is_null)静默透传返整表,应报错;缺 $null 处理 #2704

Description

@baozhoutao

概述

列表视图对可空字段做 IS NULL 过滤时,唯一真正生效的是 { field, operator: 'equals', value: null }(映射成查询 op =,引擎把 ["field","=",null] 当 IS NULL)。其余写法静默出错:

  • operator: 'is' / 'is_null' → 引擎发出 op is/isnull,静默忽略 → 返回整表(无报错,只是行数错——比 400 更危险,权限/分配类视图上易出安全问题)。
  • operator: 'is_empty'400 The operator "is_empty" is not permitted → 整个 grid 空白。

定位

  • packages/adapters/driver-sql/src/sql-driver.ts:2683-2684 —— default 分支把未知 operator 原样透传 knex,规格白名单未在数组 where 路径生效。
  • :2742-2776 —— 缺 $null case 处理。

期望

  • 未知 operator 应报错而非静默透传返整表;
  • 或让 is_null / is_empty 成为受支持的 null 判断 op,与 equals+null 语义统一。

来源(项目 dogfood):steedos-labs/os-tianshun-mtc#28

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions