【问题标题】:Excluding folders on CheckMarx scan在 CheckMarx 扫描中排除文件夹
【发布时间】:2021-07-23 06:59:00
【问题描述】:

我正在我们的代码存储库中实施 Checkmarx 扫描。我正在使用 Jenkins 和 CheckMarx 插件来完成这项任务。我想从扫描中排除一些文件夹;引用 Jenkins plugin 文档似乎我所要做的就是在“excludeFolders”字段中添加文件夹名称。但是,这似乎不起作用,或者我没有正确输入值。

我已经尝试过 '/test'、'test/'、'!/test//*' 但没有任何效果,并且该文件夹在上传到我们的 CheckMarx 之前仍处于注册和压缩状态服务器。

以下是我的管道中的内容:

stage("Running CheckMarks for Layer"){
            steps{
                script{
                    def layer_dir = readFile file: 'layer-list'
                    def layer_list = layer_dir.split('\\r?\\n')
                    println (layer_list)
                    layer_list.each { layer ->
                        print (layer)
                        dir("${env.WORKSPACE}/layers/layer-name/$layer"){
                            step([
                                $class: 'CxScanBuilder',
                                comment: 'Layer scanning',
                                credentialsId: 'XXXX',
                                excludeFolders: 'test',
                                exclusionsSetting: 'global',
                                failBuildOnNewResults: false,
                                failBuildOnNewSeverity: 'MEDIUM',
                                filterPattern: '''!**/_cvs/**/*, !Checkmarx/Reports/*.*''',
                                fullScanCycle: 10,
                                incremental: true,
                                fullScansScheduled: true,
                                generatePdfReport: true,
                                preset: '36',
                                teamPath: "\\path\\to\\codebase",
                                projectName: "$layer",
                                sastEnabled: true,
                                sourceEncoding: '1',
                                vulnerabilityThresholdResult: 'FAILURE',
                                waitForResultsEnabled: true
                            ])
                        }
                    }
                }
            }
        }

关于如何排除“测试”文件夹有什么建议吗?

【问题讨论】:

    标签: jenkins jenkins-plugins checkmarx sast devsecops


    【解决方案1】:

    您应该将您的 excludesSetting 更改为 'job' 而不是 'global',我们无法覆盖全局配置。

    然后您可以在filterPattern中添加更多过滤器。

    【讨论】:

      【解决方案2】:

      过滤真的很糟糕 - 你有什么运气吗????

      尝试将其添加到 filterPattern 为 !Test/*.* 并尝试使用它...

      【讨论】:

        【解决方案3】:

        如下修改以排除目标和测试文件夹。

        excludeFolders: '目标,测试'

        Jenkins 控制台日志:

        [Cx-Debug]: Excluded Dir: src/test
        [Cx-Debug]: Excluded Dir: target
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-08-13
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-09-22
          相关资源
          最近更新 更多