Skip to content

QaController BlogController 中多个函数存在权限检查缺失问题 #254

Description

@kingkingkingson

问题描述

QaController.java:question BlogController.java:category BlogController.java:details QaController.java:category QaController.java:tag BlogController.java:tag 中存在权限不足问题。比如在 QaController.java:question中,缺少对于输入参数articleId的校验,可能导致水平越权问题。

相关代码

  • question中会根据Id查询CmsArticle 并作为返回参数返回。然而,CmsArticleCmsArticleController.java:list中需要@RequiresPermissions(\"cms:article:read\")权限,说明CmsArticle 是敏感资源,可能通过爆破articleId间接获得到全部的CmsArticleController.java:list返回值,导致敏感资源泄露
    @RequestMapping(value = "/question/{articleId}", method = RequestMethod.GET)
    public String question(@PathVariable("articleId") int articleId, Model model) {
        CmsArticle article = cmsArticleService.selectByPrimaryKey(articleId);
        model.addAttribute("article", article);
        // 系统id
        CmsSystemExample cmsSystemExample = new CmsSystemExample();
        cmsSystemExample.createCriteria()
                .andCodeEqualTo(CODE);
        CmsSystem system = cmsSystemService.selectFirstByExample(cmsSystemExample);
        model.addAttribute("system", system);
        // 评论列表
        CmsCommentExample cmsCommentExample = new CmsCommentExample();
        cmsCommentExample.createCriteria()
                .andSystemIdEqualTo(system.getSystemId())
                .andArticleIdEqualTo(articleId)
                .andStatusEqualTo((byte) 1);
        cmsCommentExample.setOrderByClause("ctime desc");
        List<CmsComment> comments = cmsCommentService.selectByExampleWithBLOBs(cmsCommentExample);
        model.addAttribute("comments", comments);
        return thymeleaf("/qa/question/index");
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions