Configurar verificações do Checkmarx no pipeline
Configure as verificações do Checkmarx nos pipelines do Azure DevOps, Jenkins, GitHub, GitLab ou Harness.
Você pode configurar verificações de Checkmarx em qualquer fase do pipeline e os detalhes da verificação são recuperados da fase correspondente à Velocidade de mudança do DevOps. Se você estiver usando as ferramentas de orquestração do Azure DevOps ou do GitHub Actions, deverá sempre adicionar o código de ação personalizado ao pipeline. Se você estiver usando o Jenkins e o pipeline já tiver uma etapa de verificação de segurança Checkmarx One (checkmarxASTScanner), não será necessário adicionar o código de ação personalizado ao pipeline. Para o Checkmarx SAST, o código de ação personalizado deve ser adicionado ao pipeline, mesmo que ele tenha a etapa de verificação de segurança (checkmarxASTScanner).
Se você quiser configurar o Checkmarx para a ferramenta GitLab, poderá usar a imagem genérica do contêiner do Docker para adicionar a etapa de segurança do Checkmarx ou executar as etapas especificadas no tópico Integrar ferramentas de segurança com GitLab.
Para pipelines do Harness, você pode configurar verificações do Checkmarx somente por meio da imagem de contêiner genérica Docker. Para obter mais informações, consulte Implementar ações personalizadas para pipelines usando a imagem de contêiner genérica do Docker.
- Navegue até a etapa no pipeline e adicione a ação personalizada.
Azure DevOps - Navegue até o arquivo .yml do pipeline.
- Na seção Tarefas no lado direito, pesquise a tarefa de extensão Resultados de segurança do ServiceNow DevOps.
- Insira o endpoint da ServiceNow.
- Insira os atributos de resultados de segurança da seguinte forma.
- SAST do Checkmarx
- task: ServiceNow-DevOps-Build-Security-Results@1 inputs: connectedServiceName: "" # ServiceNow DevOps Change Velocity Service Connection securityResultAttributes: | {"scanner": "Checkmarx SAST", "projectId": "", "securityToolId": ""} # scanner: Scanning tool and is required e.g. Checkmarx SAST. # projectId: Id of your Checkmarx SAST project and is required. This attribute is applicable only for Checkmarx SAST. # securityToolId: Security tool onboarded in ServiceNow (sys_id of the onboarded security tool) and is optional. - Checkmarx One
- task: ServiceNow-DevOps-Build-Security-Results@1 inputs: connectedServiceName: "" # ServiceNow DevOps Change Velocity Service Connection securityResultAttributes: | {"scanner": "Checkmarx One", "projectName": "", "projectId": "", "scanId": "", "securityToolId": ""} # scanner: Scanning tool and is required e.g. Checkmarx One. # projectName: Name of your Checkmarx One project and is required. This attribute is applicable only for Checkmarx One. # projectId: Id of your Checkmarx One project and can be used instead of projectName field. This attribute is applicable only for Checkmarx One. # scanId: Checkmarx One scan id and is optional. This attribute is applicable only for Checkmarx One. # securityToolId: Security tool onboarded in ServiceNow (sys_id of the onboarded security tool) and is optional.
- SAST do Checkmarx
- Selecione Adicionar para adicionar o código de ação personalizado ao pipeline.
Jenkins - Navegue até a Sintaxe do Pipeline a partir de um pipeline configurado.
- Selecione a etapa snDevOpsSecurityResult na lista Etapa de Amostra e atualize os valores dos atributos de verificação de segurança na etapa.
- Selecione Gerar script de pipeline para criar um snippet. Você pode copiar e colar o snippet no pipeline.
- SAST do Checkmarx
snDevOpsSecurityResult securityResultAttributes: '{"scanner": "Checkmarx SAST", "projectId": "", "securityToolId": ""}' // scanner: Scanning tool and is required e.g. Checkmarx SAST. // projectId: Id of your Checkmarx SAST project and is required. This attribute is applicable only for Checkmarx SAST. // securityToolId: Security tool onboarded in ServiceNow (sys_id of the onboarded security tool) and is optional. - Checkmarx One
snDevOpsSecurityResult securityResultAttributes: '{"scanner": "Checkmarx One", "projectName": "", "projectId": "", "scanId": "", "securityToolId": ""}' // scanner: Scanning tool and is required e.g. Checkmarx One. // projectName/projectId: Name/Id of your Checkmarx One project and is required. This attribute is applicable only for Checkmarx One. // scanId: Checkmarx One scan id and is optional. This attribute is applicable only for Checkmarx One. // securityToolId: Security tool onboarded in ServiceNow (sys_id of the onboarded security tool) and is optional.
- SAST do Checkmarx
GitHub Actions - Navegue até o arquivo .yml do fluxo de trabalho.
- Na seção Mercado do lado direito, pesquise a ação personalizada Resultados de segurança do ServiceNow DevOps.
- Adicione o seguinte snippet ao arquivo .yml.
- SAST do Checkmarx
ServiceNowSecurityScanResults: # jobs that must complete successfully before this job will run needs: build # type of machine to run the job on runs-on: ubuntu-latest name: ServiceNow Security Scan Results steps: - name: ServiceNow DevOps Security Results uses: ServiceNow/servicenow-devops-security-result@v3.0.0 with: # Devops Integration User Name devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }} # Devops Integration User Password devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} # ServiceNow Instance URL instance-url: ${{ secrets.SN_INSTANCE_URL }} # Orchestration Tool Id tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }} # GitHub Context context-github: ${{ toJSON(github) }} # Display Name of the Job job-name: 'ServiceNow Security Scan Results' security-result-attributes: '{"scanner": "Checkmarx SAST", "projectId": "", "securityToolId": ""}' # scanner: Scanning tool and is required e.g. Checkmarx SAST. # projectId: Id of your Checkmarx SAST project and is required. This attribute is applicable only for Checkmarx SAST. # securityToolId: Security tool onboarded in ServiceNow (sys_id of the onboarded security tool) and is optional. - Checkmarx One
ServiceNowSecurityScanResults: # jobs that must complete successfully before this job will run needs: build # type of machine to run the job on runs-on: ubuntu-latest name: ServiceNow Security Scan Results steps: - name: ServiceNow DevOps Security Results uses: ServiceNow/servicenow-devops-security-result@v3.0.0 with: # Devops Integration User Name devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }} # Devops Integration User Password devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} # ServiceNow Instance URL instance-url: ${{ secrets.SN_INSTANCE_URL }} # Orchestration Tool Id tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }} # GitHub Context context-github: ${{ toJSON(github) }} # Display Name of the Job job-name: 'ServiceNow Security Scan Results' security-result-attributes: '{"scanner": "Checkmarx One", "projectName": "", "projectId": "", "scanId": "", "securityToolId": ""}' # scanner: Scanning tool and is required e.g. Checkmarx One. # projectName/projectId: Name/Id of your Checkmarx One project and is required. This attribute is applicable only for Checkmarx One. # scanId: Checkmarx One scan id and is optional. This attribute is applicable only for Checkmarx One. # securityToolId: Security tool onboarded in ServiceNow (sys_id of the onboarded security tool) and is optional.
- SAST do Checkmarx
Arnês Execute a imagem de contêiner Docker genérica para usar o script a seguir. Para obter mais informações, consulte Implementar ações personalizadas para pipelines usando a imagem de contêiner genérica do Docker. - stage: name: ServiceNow DevOps Security Result identifier: Security description: "" type: Custom spec: execution: steps: - stepGroup: name: Security identifier: Security steps: - step: type: Run name: ServiceNow DevOps Security Result identifier: ServiceNow_DevOps_Security_Result spec: connectorRef: docker_hub_connector_for_harness image: servicenowdocker/sndevops:5.0.0 shell: Sh command: |- sndevopscli create securityScan -p "{"pipelineInfo":{ "buildNumber":"<+stage.nodeExecutionId>", "taskExecutionUrl":"<+pipeline.executionUrl>?stage=<+stage.nodeExecutionId>", "orchestrationPipeline":"<+org.identifier>/<+project.identifier>/<+pipeline.name>" }, "securityResultAttributes":{ "scanner":"Veracode", "applicationName":"", "buildVersion":"", "securityToolId":"" } }" envVariables: SNOW_URL: <+variable.SNOW_URL> SNOW_TOOLID: <+variable.SNOW_TOOLID> SNOW_TOKEN: <+variable.SNOW_TOKEN> stepGroupInfra: type: KubernetesDirect spec: connectorRef: kubernates_connector namespace: harness-delegate-ng tags: {} - Execute o pipeline para recuperar os resultados da verificação de segurança.