Configurer les analyses Checkmarx sur votre pipeline

  • Rversion finale: Zurich
  • Mis à jour 31 juil. 2025
  • 5 minutes de lecture
  • Configurez les analyses Checkmarx sur vos pipelines Azure DevOps, Jenkins, GitHub, GitLab ou Harness.

    Vous pouvez configurer des analyses Checkmarx sur n’importe quelle étape du pipeline et les détails de l’analyse sont récupérés à partir de l’étape correspondante à la vélocité de changement DevOps. Si vous utilisez des outils d’orchestration Azure DevOps ou GitHub Actions, vous devez 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é dans votre pipeline. Pour Checkmarx SAST, le code d’action personnalisé doit être ajouté dans 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 générique du conteneur Docker pour ajouter l’étape de sécurité Check Marx, soit effectuer les étapes spécifiées dans la Intégrer des outils de Security dans GitLab rubrique.

    Pour les pipelines exploités, vous pouvez configurer les analyses Checkmarx uniquement via l’image de conteneur générique Docker . Pour plus d'informations, consultez Implémenter des actions personnalisées pour les pipelines utilisant une image de conteneur Docker générique.

    1. Accédez à l’étape dans votre pipeline et ajoutez l’action personnalisée.
      Azure DevOps
      1. Accédez à votre fichier de .yml de pipeline.
      2. Dans la section Tâches sur le côté droit, recherchez la tâche d’extension Résultats de sécurité ServiceNow DevOps .
      3. Entrez le point de terminaison ServiceNow.
      4. Entrez 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.
      5. Sélectionnez Ajouter pour ajouter le code d’action personnalisé à votre pipeline.
      Jenkins
      1. Accédez à la syntaxe du pipeline à partir d’un pipeline configuré.
      2. Sélectionnez l’étape snDevOpsSecurityResult dans la liste d’exemples d’étapes et mettez à jour les valeurs des attributs d’analyse de sécurité dans l’étape.
      3. Sélectionnez Générer un script de pipeline pour créer un extrait. Vous pouvez copier et 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.
      GitHub Actions
      1. Accédez à votre workflow .yml fichier.
      2. Dans la section Place de marché sur le côté droit, recherchez l’action personnalisée Résultats de sécurité ServiceNow DevOps .
      3. 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.
      Pour plus d’informations, consultez GitHub Marketplace.
      Harnais Exécutez l’image de 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: {}
    2. Exécutez le pipeline pour récupérer les résultats de l’analyse de sécurité.