Configurer les analyses Checkmarx sur votre pipeline
Configurez les analyses Checkmarx sur vos pipelines Azure DevOps, Jenkins, GitHub, GitLab ou Harness.
Vous pouvez configurer les analyses Checkmarx à n'importe quelle étape du pipeline, et extraire les détails de l'analyse à l'étape correspondante dans Vélocité de changement DevOps. Si vous utilisez des outils d'orchestration Azure DevOps ou GitHub Actions, veillez à toujours ajouter le code d'action personnalisé dans votre pipeline. Si vous utilisez Jenkins et que votre pipeline comporte déjà une étape d'analyse de sécurité Checkmarx One (checkmarxASTScanner), vous n'avez pas besoin d'ajouter le code d'action personnalisé à votre pipeline. Pour Checkmarx SAST, ajoutez le code d'action personnalisé à votre pipeline, même s'il comporte l'étape d'analyse de sécurité (checkmarxASTScanner).
Si vous souhaitez configurer Checkmarx pour l'outil GitLab, vous pouvez soit utiliser l'image de conteneur Docker générique pour ajouter l'étape de sécurité Checkmarx, soit suivre les étapes spécifiées dans la rubrique Intégrer des outils de sécurité à GitLab.
Pour les pipelines Harness, vous pouvez configurer les analyses Checkmarx uniquement via l'image du conteneur Docker générique. Pour plus d'informations, consultez Implémenter des actions personnalisées pour les pipelines utilisant une image de conteneur Docker générique.
- Accédez à l'étape dans votre pipeline et ajoutez l'action personnalisée.
Azure DevOps - Accédez à votre fichier .yml de pipeline.
- Dans la section Tâches sur le côté droit, recherchez la tâche d'extension Résultats de sécurité ServiceNow DevOps.
- Saisissez le point de terminaison ServiceNow.
- Saisissez les attributs des résultats de sécurité comme suit.
- Checkmarx SAST
- 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.
- Checkmarx SAST
- Sélectionnez Ajouter pour ajouter le code d'action personnalisé à votre pipeline.
Jenkins - Accédez à la syntaxe du pipeline à partir d'un pipeline configuré.
- Sélectionnez l'étape snDevOpsSecurityResult dans la liste Exemple d'étape, puis mettez à jour les valeurs des attributs d'analyse de sécurité dans l'étape.
- Sélectionnez Générer un script de pipeline pour créer un extrait. Vous pouvez copier-coller l'extrait dans le pipeline.
- Checkmarx SAST
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.
- Checkmarx SAST
GitHub Actions - Accédez à votre fichier .yml de workflow.
- Dans la section Place de marché sur le côté droit, recherchez l'action personnalisée Résultats de sécurité ServiceNow DevOps.
- Ajoutez l'extrait suivant dans votre fichier .yml.
- Checkmarx SAST
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.
- Checkmarx SAST
Harness Exécutez l'image du conteneur générique Docker pour utiliser le script suivant. Pour plus d'informations, consultez Implémenter des actions personnalisées pour les pipelines utilisant une image de conteneur Docker générique. - 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: {} - Exécutez le pipeline pour récupérer les résultats de l'analyse de sécurité.