---
sourceDocument: Gestion des services IT Australie
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/fr-FR/it-service-management

 Release :

    - australia

ft:locale :

    - fr-FR

ft:publication_title :

    - Gestion des services IT Australie

ft:clusterId :

    - itsm

bundleId :

    - itsm

workflow :

    - Technology


---

# Intégrer des outils de sécurité à GitLab

# Intégrer des outils de sécurité à GitLab {#ariaid-title1}

* Rversion finale: Australia
* 
* Mis à jour 12 mars 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes de lecture

Configurez un outil de sécurité pour GitLab qui n'est pas pris en charge dans le système de base.

## Avant de commencer

Rôle requis : sn_devops.admin

## Procédure

1. Accédez à la DevOps \> intégrations \> des intégrations d'outils et ouvrez l'enregistrement d'intégration de l'outil d'orchestration GitLab.
2. Accédez à la liste connexe Mappages de l'aptitude d'intégration de l'outil.
3. Sélectionnez Nouveau, puis saisissez les valeurs suivantes dans les champs de formulaire.  
   {#configure-security-tool-for-gitlab__simpletable_pcl_x3f_cyb__entry__2}

   | Champ | Valeur |
   |-|-|
   | Intégration d'outils | GitLab |
   | Aptitude du type d'outil | Sécurité |
   [ ]

   {#configure-security-tool-for-gitlab__simpletable_pcl_x3f_cyb}
4. Sélectionnez Soumettre.
5. Accédez à la liste connexe Options d'intégration et sélectionnez Nouveau.
6. Saisissez les valeurs suivantes dans les champs de formulaire.  
   {#configure-security-tool-for-gitlab__simpletable_lsy_fjf_cyb__entry__2}

   | Champ | Valeur |
   |-|-|
   | Intégration d'outils | GitLab |
   | Mappage d'aptitudes | Enregistrement de mappage d'aptitudes créé à l'étape 4. |
   | Action | Notification Remarque : ne modifiez pas les enregistrements d'actions de l'outil. |
   | Actif | Sélectionné |
   | Délai d'expiration (ms) | Délai d'expiration du flux secondaire correspondant. Si l'exécution du flux secondaire dépasse cette valeur, une exception du délai d'expiration se produit. La valeur est exprimée en millisecondes (ms). La valeur par défaut est 45 000 (45 secondes). |
   | Nom de flux secondaire | sn_devops_vul_ints.devops_security_notification |
   | Domaine | global |
   [ ]

   {#configure-security-tool-for-gitlab__simpletable_lsy_fjf_cyb}  
   Remarque :  
   désactivez la règle métier BR Seeded tool integrations not editable pour intégrer les outils de sécurité à GitLab.
7. Modifiez l'include de script sn_devops_ints.DevOpsGitLabIntegrationHandler en accédant à Définitions du système \> Include de script, puis en recherchant le script DevOpsGitLabIntegrationHandler.  
   1. Modifiez la méthode handleEvent pour traiter les résultats de l'analyse de sécurité du pipeline GitLab. Assurez-vous que le nom de l'étape de sécurité dans votre pipeline GitLab est identique au nom que vous mettez à jour dans la variable VERACODE_STAGE_NAME, CMARX_ONE_STAGE_NAME ou CMARX_SAST_STAGE_NAME dans la méthode handleEvent. Remplacez le code de la méthode handleEvent par l'extrait de code ci-dessous.

           handleEvent: function(eventGr) {
              try {
                  var renameHandler = new sn_devops.DevOpsPipelineRenameHandler(this.refTable, this.appContext, this.relatedRecord);
                  renameHandler.handlePipelineRename(eventGr);
                  var payload = JSON.parse(eventGr.getValue("original_payload"));
                  this._logger.debug("typeof payload >>" + typeof payload);
                  if (!gs.nil(payload) && typeof payload === 'object') {
                      var status = this.getTaskExecutionStatus(payload);
                      this._logger.debug("Task Execution status -> " + status);
                      if (gs.nil(status))
                          this.updateInboundEvent(eventGr, {
                              processing_details: gs.getMessage('Task execution status [{0}] is not handled', payload.build_status),
                              state: sn_devops.DevOpsCommonConstants.INBOUND_EVENT_STATE_IGNORED
                          });
                      else {
                          // create fake start event for cancelled job
                          if (status == 'cancelled') {
                              this.createFakeEvent(eventGr, payload, 'running');
                          }
                          var normalizedObject = {};
                          normalizedObject.taskExecution = this.getTaskExecutionObject(eventGr, payload, status);
                          normalizedObject.orchestrationTask = this.getOrchestrationTaskObject(normalizedObject.taskExecution, payload);
                          normalizedObject.callback = this.getCallbackObject(normalizedObject.taskExecution, payload);
                          var devopsUtil = new sn_devops.DevOpsUtil(this.refTable, this.appContext, this.relatedRecord);
                          normalizedObject = devopsUtil.schemaValidationForTransformedPayload(normalizedObject);
                          var VERACODE_STAGE_NAME = 'SN_VERACODE';
                          var CMARX_ONE_STAGE_NAME = 'SN_CMARX_ONE_STAGE_NAME';
                          var CMARX_SAST_STAGE_NAME = 'SN_CMARX_SAST_STAGE_NAME';
                          if (!gs.nil(payload.build_stage) && 
                              (   
                                  payload.build_stage == VERACODE_STAGE_NAME ||
                                  payload.build_stage == CMARX_ONE_STAGE_NAME ||
                                  payload.build_stage == CMARX_SAST_STAGE_NAME 
                              )
                              && this.isCompleted(normalizedObject.taskExecution)) {
                              var queryParams = sn_devops.DevOpsQueryParamsHelper.convertToSingular(JSON.parse(eventGr.getValue('query_params')));
                              if (gs.nil(normalizedObject.taskExecution.securityScan)) {
                                  normalizedObject.taskExecution.securityScan = {
                                      securityScanSummaryCount: 0
                                  };
                              }
                              normalizedObject.taskExecution.securityScan.securityScanSummaryCount += 1;
                          }
                          this._logger.debug("Normalized Object: " + JSON.stringify(normalizedObject));
                          return JSON.stringify(normalizedObject);
                      }
                  } else
                      this.updateInboundEvent(eventGr, {
                          processing_details: gs.getMessage('Payload is missing or invalid'),
                          state: sn_devops.DevOpsCommonConstants.INBOUND_EVENT_STATE_ERROR
                      });
              } catch (error) {
                  throw sn_devops.DevOpsErrorHelper.createDevOpsScriptIncludeError(error, sn_devops_ints.DevOpsIntegrationsCommonMessages.GITLAB_INBOUND_EVENT_PROCESS_ISSUE, "DevOpsGitLabIntegrationHandler.handleEvent", "handleEvent");
              }
          },

      Dans les exemples suivants, le pipeline GitLab montre que le nom de l'étape de sécurité est le même que celui des variables VERACODE_STAGE_NAME, CMARX_ONE_STAGE_NAME ou CMARX_SAST_STAGE_NAME dans la méthode handleEvent.  
      VERACODE_STAGE_NAME correspond à Veracode.

          image: maven:latest
          stages:
            - build
            - SN_VERACODE
            - Deploy

          build_1:
            stage: build
            tags:
              - local-runner1
            script:
              - echo "build"
              
          security_test:
            stage: SN_VERACODE
            tags:
              - local-runner1
            script:
              - |
                curl "https://<instance>.service-now.com/api/sn_devops/v1/devops/tool/security?toolId=<gitlab_tool_sys_id> " \
                  --request POST \
                  --header "Accept:application/json" \
                  --header "Content-Type:application/json" \
                  --data "{
                        \"pipelineInfo\": {
                          \"buildNumber\": \"${CI_JOB_ID}\",
                          \"taskExecutionUrl\": \"${CI_JOB_URL}/\"
                        },
                        \"securityResultAttributes\": {
                          \"scanner\": \"Veracode\",
                          \"applicationName\": \"Application\"
                        }
                      }" \
                  --user 'devops.system':'password'

      CMARX_ONE_STAGE_NAME correspond à Checkmarx One.  

          image: maven:latest
          stages:
            - build
            - SN_CMARX_ONE_STAGE_NAME
            - Deploy

          build_1:
            stage: build
            tags:
              - local-runner1
            script:
              - echo "build"
              
          security_test:
            stage: SN_CMARX_ONE_STAGE_NAME
            tags:
              - local-runner1
            script:
              - |
                curl "https://<instance>.service-now.com/api/sn_devops/v1/devops/tool/security?toolId=<gitlab_tool_sys_id> " \
                  --request POST \
                  --header "Accept:application/json" \
                  --header "Content-Type:application/json" \
                  --data "{
                        \"pipelineInfo\": {
                          \"buildNumber\": \"${CI_JOB_ID}\",
                          \"taskExecutionUrl\": \"${CI_JOB_URL}/\"
                        },
                        \"securityResultAttributes\": {
                          \"scanner\": \"Checkmarx One\",
                          \"projectId\": \"projectId\",
                          \"scanId\": \"scanId\",
                        }
                      }" \
                  --user 'devops.system':'password'

      CMARX_SAST_STAGE_NAME correspond à Checkmarx SAST.  

          image: maven:latest
          stages:
            - build
            - SN_CMARX_SAST_STAGE_NAME
            - Deploy

          build_1:
            stage: build
            tags:
              - local-runner1
            script:
              - echo "build"
              
          security_test:
            stage: SN_CMARX_SAST_STAGE_NAME
            tags:
              - local-runner1
            script:
              - |
                curl "https://<instance>.service-now.com/api/sn_devops/v1/devops/tool/security?toolId=<gitlab_tool_sys_id> " \
                  --request POST \
                  --header "Accept:application/json" \
                  --header "Content-Type:application/json" \
                  --data "{
                        \"pipelineInfo\": {
                          \"buildNumber\": \"${CI_JOB_ID}\",
                          \"taskExecutionUrl\": \"${CI_JOB_URL}/\"
                        },
                        \"securityResultAttributes\": {
                          \"scanner\": \"Checkmarx\",
                          \"projectId\": \"projectId\"
                        }
                      }" \
                  --user 'devops.system':'password'

   2. Ajoutez la méthode getPipelineWithSecurityEventPayload au script DevOpsGitLabIntegrationHandler.

          getPipelineWithSecurityEventPayload: function(payload) {
                  var gr = new GlideRecordSecure('sn_devops_task_execution');
                  gr.addEncodedQuery("execution_url=" + payload.pipelineInfo.taskExecutionUrl);
                  gr.query();
                  var task = null;
                  if (gr.next()) {
                      task = gr;
                  }
                  if (gs.nil(task) || gs.nil(task.orchestration_task) || gs.nil(task.orchestration_task.step)) {
                      throw "Pipeline Info not found";
                  }
                  var step = task.orchestration_task.step.getRefRecord();
                  var pipelineDAO = new sn_devops.DevOpsPipelineDAO();
                  var query = 'sys_id=' + step.pipeline;
                  var pipeline = pipelineDAO.getLimitedRecordsByEncodedQuery(query);
                  return pipeline;
              },

   {#configure-security-tool-for-gitlab__ol_dgs_zjf_cyb}

