【问题标题】:Checkmarx Improper Resource Access AuthorizationCheckmarx 资源访问授权不当
【发布时间】:2019-09-06 14:44:43
【问题描述】:

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

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

int rowInserted = preparedStatement.executeUpdate();

【问题讨论】:

  • 您的问题是什么?你知道什么是不当的资源访问授权吗?

标签: java sql database authorization checkmarx


【解决方案1】:

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

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

【讨论】:

  • 我也有同样的问题,Checkmarks 是警告cst = conect.prepareCall(ConstantesDAO.FNFA_REFS); .... cst.setString(3, params.get("cycleId")); ..... Just here -> cst.execute(); :( 我试过你的建议,但没有用。
  • 我在您分享的代码 sn-p 中没有看到任何对访问控制的验证检查
  • @securecodeninja 尝试了您的解决方案。但没有工作if(user.equals("admin")) {String endPoint=prop.getProperty("endpoint");}
【解决方案2】:

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

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

并检查您的字符串:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-11
    • 1970-01-01
    • 1970-01-01
    • 2020-01-31
    • 2017-09-23
    • 1970-01-01
    • 1970-01-01
    • 2020-01-20
    相关资源
    最近更新 更多