Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级1.6.2 后老是提示 注意,值可能存在SQL注入风险 #2032

Closed
lijinlang opened this issue Sep 24, 2023 · 11 comments
Closed

升级1.6.2 后老是提示 注意,值可能存在SQL注入风险 #2032

lijinlang opened this issue Sep 24, 2023 · 11 comments

Comments

@lijinlang
Copy link

lijinlang commented Sep 24, 2023

版本号:1.6.2
问题描述:

升级1.6.2 后老是提示 注意,值可能存在SQL注入风险,没升级前都是正常的,有点搞不懂了,这语句该怎么写才没有注入风险

错误日志&截图:

43

@zhangdaiscott
Copy link
Member

zhangdaiscott commented Sep 24, 2023

sql贴一下
并提供建表SQL

@lijinlang
Copy link
Author

sql贴一下 并提供建表SQL

select cid,cgoods,cgoodsname,famount,fmoney,cmemo from fy_bus_sales where mid='${id}'

建表语句,我用的是Sqlserver

CREATE TABLE [dbo].[fy_bus_sales] (
[id] varchar(36) COLLATE Chinese_PRC_CI_AS NOT NULL,
[create_by] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[create_time] datetime NULL,
[update_by] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[update_time] datetime NULL,
[sys_org_code] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL,
[mid] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[cid] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[cgoods] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[cgoodsname] nvarchar(150) COLLATE Chinese_PRC_CI_AS NULL,
[famount] decimal(10,2) NULL,
[fmoney] decimal(10,2) NULL,
[fwriteoff] decimal(10,2) NULL,
[cmemo] nvarchar(300) COLLATE Chinese_PRC_CI_AS NULL
)
GO

@zhangdaiscott
Copy link
Member

测试无问题,看看后台日志提示的关键词是什么
image

@lijinlang
Copy link
Author

lijinlang commented Sep 25, 2023

我刚看过了是提示字段mid存在SQL注入关键词,这个字段名称都限制,我想应该跟注入关系不大吧

微信图片_20230925100204

@zhangdaiscott
Copy link
Member

zhangdaiscott commented Sep 25, 2023

就是这个关键词导致的
校验的方法存在缺陷

@lijinlang
Copy link
Author

那是要等更新了吗

@zhangdaiscott
Copy link
Member

升级到

<dependency>
  <groupId>org.jeecgframework.jimureport</groupId>
  <artifactId>jimureport-spring-boot-starter</artifactId>
  <version>1.6.3</version>
</dependency>

@Userluckytian
Copy link

Userluckytian commented Oct 17, 2023

same Problem。
sql为pg数据库,
建表语句:

CREATE TABLE "operation"."base_billrule" (
  "f_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "f_encode" varchar(50) COLLATE "pg_catalog"."default",
  "f_creatortime" timestamp(6),
);

语句为:select f_id, to_char(f_creatortime,'yyyy') nian FROM tablename
想要设置日期查询:
image

参考的处理方法:https://help.jeecg.com/jimureport/query/timeControl.html#%E9%97%AE%E9%A2%98

最终得到报错:
image

@zhangdaiscott

@zhangdaiscott
Copy link
Member

使用to_char函数导致的

@Userluckytian
Copy link

Userluckytian commented Oct 19, 2023

使用to_char函数导致的

是的,只是针对日期格式我们需要使用to_char函数。期望能帮忙解决下这个问题。 @zhangdaiscott

@zhangdaiscott
Copy link
Member

下个版本处理

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

No branches or pull requests

3 participants