パイプラインでの Veracode スキャンの構成
Azure DevOps、Jenkins、GitHub、GitLab、または Harness パイプラインで Veracode スキャンを構成します。
パイプラインの任意のステージで Veracode スキャンを構成でき、スキャンの詳細は対応するステージから DevOps 変更速度管理に取得されます。Azure DevOps または GitHub Actions オーケストレーションツールを使用している場合は、パイプラインにカスタムアクションコードを常に追加する必要があります。Jenkins を使用していて、パイプラインに Veracode セキュリティスキャンステップが既に含まれている場合は、パイプラインにカスタムアクションコードを追加する必要はありません。Veracode セキュリティスキャンステップに waitForScan: true があることを確認します。これは、システムがスキャン情報を取得するために必要です。
GitLab ツール用に Veracode を構成する場合は、汎用 Docker コンテナイメージを使用して Veracode セキュリティステップを追加するか、「セキュリティツールを GitLab と統合する」トピックで指定された手順を実行できます。
ハーネスパイプラインの場合、汎用Dockerコンテナイメージを使用してのみVeracodeスキャンを構成できます。詳細については、「汎用 Docker コンテナイメージを使用したパイプラインのカスタムアクションの実装」を参照してください。
- パイプラインのステップに移動し、カスタムアクションを追加します。
Azure DevOps - パイプライン .yml ファイルに移動します。
- 右側の [タスク] セクションで、[ServiceNow DevOps セキュリティ結果 (ServiceNow DevOps Security Results)] 拡張タスクを検索します。
- ServiceNow エンドポイントを入力します。
- セキュリティ結果属性を次のように入力します。
{ "scanner": "Veracode", "applicationName": "", "buildVersion": "", "securityToolId": "" }scanner:スキャンツールであり、Veracode などが必要です。
applicationName:Veracode アプリケーションの名前で、必須です。この属性は Veracode にのみ適用されます。
buildVersion:Veracode スキャン名/ビルドバージョンで、オプションです。この属性は Veracode にのみ適用されます。
securityToolId:ServiceNow にオンボーディングされたセキュリティツール (オンボーディングされたセキュリティツールのsys_id)で、オプションです。
- [追加] を選択して、カスタムアクションコードをパイプラインに追加します。
Jenkins - 構成されたパイプラインからパイプライン構文に移動します。
- [サンプルステップ (Sample Step)] リストから snDevOpsSecurityResult ステップを選択し、ステップのセキュリティスキャン属性の値を更新します。
- [パイプラインスクリプトを生成 (Generate Pipeline Script)] を選択してスニペットを作成します。スニペットをコピーしてパイプラインに貼り付けることができます。
snDevOpsSecurityResult { securityResultAttributes:{"scanner":"Veracode", "applicationName": "", "buildVersion": "", "securityToolId": ""}}scanner:スキャンツールであり、Veracode などが必要です。
applicationName:Veracode アプリケーションの名前で、必須です。この属性は Veracode にのみ適用されます。
buildVersion:Veracode スキャン名/ビルドバージョンで、オプションです。この属性は Veracode にのみ適用されます。
securityToolId:ServiceNow にオンボーディングされたセキュリティツール (オンボーディングされたセキュリティツールのsys_id)で、オプションです。
GitHub Actions - ワークフロー .yml ファイルに移動します。
- 右側の [マーケットプレイス] セクションで、[ServiceNow DevOps セキュリティ結果 (ServiceNow DevOps Security Results)] カスタムアクションを検索します。
- 次のスニペットを .yml ファイルに追加します。
SecurityScanResults: needs: build runs-on: ubuntu-latest name: Servicenow Security Scan Results steps: - name: ServiceNow DevOps Security Results uses: ServiceNow/servicenow-devops-security-result@v1.39.0 with: devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }} devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} instance-url: ${{ secrets.SN_INSTANCE_URL }} tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }} context-github: ${{ toJSON(github) }} job-name: 'Servicenow Security Scan Results' security-result-attributes: '{ "scanner": "Veracode", "applicationName": "", "buildVersion": "", "securityToolId": ""}scanner:スキャンツールであり、Veracode などが必要です。
applicationName:Veracode アプリケーションの名前で、必須です。この属性は Veracode にのみ適用されます。
buildVersion:Veracode スキャン名/ビルドバージョンで、オプションです。この属性は Veracode にのみ適用されます。
securityToolId:ServiceNow にオンボーディングされたセキュリティツール (オンボーディングされたセキュリティツールのsys_id)で、オプションです。
Harness 次のスクリプトを使用するには、汎用 Docker コンテナイメージを実行します。詳細については、「汎用 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: {} - パイプラインを実行して、セキュリティスキャン結果を取得します。