Skip to content

为什么限制在GETS中使用@combine #425

Closed

Description

@aldag

在GETS请求中使用@combine时得到了这样的提示:
"msg": "StandardAdvice:{} 里的 @combine:value 不合法!DELETE,GETS,HEADS 请求不允许传 @combine:value !"
查代码发现,这个检查逻辑是硬编码在AbstractSQLConfig类中的。

为什么在这些类型的请求中限制@combine的使用呢?

Activity

  1. changed the title [-]combine的限制[/-] [+]为什么限制在GETS中使用@combine[/+] on Jul 22, 2022
  2. TommyLemon commented on Jul 22, 2022

    @TommyLemon
    Member

    防止前端传参越权操作,例如把后端设置的条件 AND 连接改为 OR 连接

  3. aldag commented on Jul 22, 2022

    @aldag
    Author

    防止前端传参越权操作,例如把后端设置的条件 AND 连接改为 OR 连接

    有些业务场景需要OR连接的查询。在AbstractSQLConfig做检查,后端也无法添加@combine,检查点能否前移呢?

  4. TommyLemon commented on Jul 22, 2022

    @TommyLemon
    Member

    可以的,把 AbstractSQLConfig 里的检查移到 AbstractVerifier,判断 JSONRequest.KEY_COMBINE.equals(rk) 就抛异常
    https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java#L1006
    image

    这样就可以实现前端不能传,但后端能在 Request 表指定 @combine 了

  5. TommyLemon commented on Feb 16, 2023

    @TommyLemon
    Member

    @aldag
    6.0.0 已支持后端在 Request 表中为 GETS/PUT/DELTE 的请求配置 @combine,感谢 @cloudAndMonkey 的贡献
    #493

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions