Konfigurieren Sie Checkmarx-Scans in Ihrer Pipeline
Konfigurieren Sie Checkmarx-Scans in Ihren Azure DevOps-, Jenkins-, GitHub-, GitLab- oder Harnisch-Pipelines.
Sie können Checkmarx-Scans in jeder Phase der Pipeline konfigurieren. Die Scan-Details werden dann aus der entsprechenden Phase für DevOps Change-Geschwindigkeit abgerufen. Wenn Sie Orchestration-Tools für Azure DevOps oder GitHub Actions verwenden, müssen Sie Ihrer Pipeline immer den anwenderdefinierten Aktionscode hinzufügen. Wenn Sie Jenkins verwenden und Ihre Pipeline bereits einen Checkmarx One-Sicherheitsscan-Schritt (checkmarxASTScanner) enthält, müssen Sie Ihrer Pipeline den anwenderdefinierten Aktionscode nicht hinzufügen. Für Checkmarx SAST muss Ihrer Pipeline der anwenderdefinierte Aktionscode hinzugefügt werden, auch wenn er den Sicherheitsscan-Schritt (checkmarxASTScanner) enthält.
Wenn Sie Checkmarx für das GitLab-Tool konfigurieren möchten, können Sie entweder das generische Docker-Container-Image verwenden, um den Checkmarx-Sicherheitsschritt hinzuzufügen, oder die im Thema Integrieren Sie Sicherheitstools in GitLab angegebenen Schritte ausführen.
Für Harnisch-Pipelines können Sie Checkmarx-Scans nur über das generische Container-Image Docker konfigurieren. Weitere Informationen finden Sie unter Implementieren Sie anwenderdefinierte Aktionen für Pipelines mit dem generischen Docker-Container-Image.
- Navigieren Sie zu dem Schritt in Ihrer Pipeline, und fügen Sie die anwenderdefinierte Aktion hinzu.
Azure DevOps - Navigieren Sie zu Ihrer Pipeline-YML-Datei.
- Suchen Sie im Abschnitt „Aufgaben“ auf der rechten Seite nach der Erweiterungsaufgabe „ServiceNow DevOps-Sicherheitsergebnisse “.
- Geben Sie den ServiceNow-Endpunkt ein.
- Geben Sie die Sicherheitsergebnisattribute wie folgt ein.
- 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. - Checkmark 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
- Wählen Sie Hinzufügen aus, um Ihrer Pipeline den anwenderdefinierten Aktionscode hinzuzufügen.
Jenkins - Navigieren Sie aus einer konfigurierten Pipeline zur Pipeline-Syntax.
- Wählen Sie in der Liste Beispielschritt den Schritt snDevOpsSecurityResult aus, und aktualisieren Sie die Werte für die Sicherheitsscan-Attribute im Schritt.
- Wählen Sie Pipeline-Skript generieren aus, um ein Snippet zu erstellen. Sie können den Ausschnitt kopieren und in die Pipeline einfügen.
- 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. - Checkmark 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-Aktionen - Navigieren Sie zu Ihrer Workflow-YML-Datei.
- Suchen Sie im Abschnitt Marketplace auf der rechten Seite nach der anwenderdefinierten Aktion ServiceNow DevOps-Sicherheitsergebnisse.
- Fügen Sie Ihrer YML-Datei das folgende Snippet hinzu.
- 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. - Checkmark 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
Kabelbaum Führen Sie das generische Container-Image Docker aus, um das folgende Skript zu verwenden. Weitere Informationen finden Sie unter Implementieren Sie anwenderdefinierte Aktionen für Pipelines mit dem generischen Docker-Container-Image. - 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: {} - Führen Sie die Pipeline aus, um die Ergebnisse der Sicherheitsprüfung abzurufen.