繁体   English   中英

Checkmarx 不正确的资源访问授权

[英]Checkmarx Improper Resource Access Authorization

我正在使用 Checkmarx 安全工具扫描我的代码,它说当我对数据库执行 executeUpdate() 命令时“资源访问授权不正确”。

各种谷歌搜索都没有成功。

int rowInserted = preparedStatement.executeUpdate();

添加一些执行访问控制检查的代码,这些代码使用诸如“ admin ”、“ authoriz ”或“ allowed ”之类的词

 if (user.equals("admin")){
    int rowInserted = preparedStatement.executeUpdate();
 }

只需在您的类中添加一个方法:

private static boolean checkAuthorization(String userName) {
    return userName.equals("authorization");
}

并检查您的字符串:

if (checkAuthorization("authorization")) {
    int rowInserted = preparedStatement.executeUpdate();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM