diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a81cbd28..fed6e051 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ on: [push, pull_request] jobs: run: name: Java ${{ matrix.java }} - runs-on: ubuntu-latest + runs-on: self-hosted strategy: matrix: java: [ 8 ] @@ -18,3 +18,4 @@ jobs: - name: Run tests run: mvn -B package + diff --git a/.github/workflows/coverity.sast.yml b/.github/workflows/coverity.sast.yml new file mode 100644 index 00000000..605333e4 --- /dev/null +++ b/.github/workflows/coverity.sast.yml @@ -0,0 +1,61 @@ +name: Synopsys Coverity SAST Scanning + +on: + push: + branches: [ master, main ] + + pull_request: + branches: [ master, main ] + +env: + GITHUB_API_URL: https://api.github.com # explicit API Url for bridge + +jobs: + build: + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Coverity Scan + uses: blackduck-inc/black-duck-security-scan@v2 + with: + ### SCANNING: Required fields + coverity_url: ${{ vars.COVERITY_URL }} + coverity_user: ${{ secrets.COVERITY_USER }} + coverity_passphrase: ${{ secrets.COVERITY_PASSPHRASE }} + coverity_project_name: ${{ vars.COVERITY_PROJECT }} # default overwrite + + ### Coverity Connect users - Uncomment below + coverity_install_directory: ${{ vars.COVERITY_INSTALLDIR }} # default overwrite + coverity_local: true + + ### POLICY ENFORCEMENT: Uncomment to break build on policy + coverity_policy_view: Policy - Java Security + + ### PULL REQUEST COMMENTS: + coverity_prComment_enabled: true + ## Use the parameter below to add comments for issues filtered + ## by impact. Default is High if unset + ## NOTE: Issues matching coverity_policy_view are ignored if set + coverity_prComment_impacts: 'High,Medium,Low,Audit' + github_token: ${{ secrets.GITHUB_TOKEN }} # Required when PR comments is enabled + + ### Mark build status if policy violating issues are found + # mark_build_status: 'success' + + #include_diagnostics: true + + ### Uncomment below configuration to add custom logic based on return status + - name: Postprocessing + id: cmdLine + run: | + EXIT_CODE=${{ steps.black-duck-security-scan.outputs.status }} + echo "Black Duck Security Scan exit status - $EXIT_CODE" + + - name: Save Logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: bridge-logs + path: ${{ github.workspace }}/.bridge + include-hidden-files: true diff --git a/.gitignore b/.gitignore index bec00f88..4496177f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,9 @@ build.xml /.apt_generated_tests/ agent.config hdivAgentLog.hlg +.vscode/ + + +# Coverity +.codesight +.bridge \ No newline at end of file diff --git a/coverity.conf b/coverity.conf new file mode 100644 index 00000000..34f76458 --- /dev/null +++ b/coverity.conf @@ -0,0 +1,20 @@ +{ + "type": "Coverity configuration", + "format_version": 1, + "format_minor_version": 7, + "settings": { + "server": { + "url": "https://poc219.coverity.synopsys.com", + "ssl": true, + "on_new_cert": "trust" + }, + "stream": "insecure-bank-synopsys-master", + "cov_run_desktop": { + "build_cmd": ["mvn", "package"], + "clean_cmd": ["mvn", "clean"] + }, + "ide": { + "build_strategy": "CUSTOM" + } + } +} \ No newline at end of file diff --git a/coverity.yaml b/coverity.yaml new file mode 100644 index 00000000..9178bdf5 --- /dev/null +++ b/coverity.yaml @@ -0,0 +1,10 @@ +capture: + build: + clean-command: mvn clean + build-command: mvn -B -DskipTests package + #build-commnad: mvn -B -DskipTests -DskipITs clean install # default build-command-inference command for Maven projects + # languages: + # include: + # - java + # - javascript + # - configuration \ No newline at end of file diff --git a/scan-polaris.cmd b/scan-polaris.cmd new file mode 100644 index 00000000..c61b0edb --- /dev/null +++ b/scan-polaris.cmd @@ -0,0 +1,18 @@ +@echo off +set BRIDGE_INSTALL_DIR=C:\Products\br\tc +set BRIDGE_CLI=%BRIDGE_INSTALL_DIR%\bridge-cli.exe + +::set BRIDGE_UPDATE=--update +set BRIDGE_UPDATE= + +%BRIDGE_CLI% --stage polaris %BRIDGE_UPDATE% ^ + polaris.serverurl=https://poc.polaris.blackduck.com ^ + polaris.application.name=MKM-Demo-Organization ^ + polaris.project.name=MKM-InsecureBank ^ + polaris.branch.name=master-cli ^ + polaris.assessment.types=SCA,SAST ^ + polaris.test.sca.type=SCA-SIGNATURE ^ + detect.search.depth=10 ^ + polaris.reports.sarif.create=false ^ + polaris.reports.sarif.file.path=results.sarif.json + diff --git a/src/main/java/org/hdivsamples/controllers/ActivityController.java b/src/main/java/org/hdivsamples/controllers/ActivityController.java index 8d3dd27f..57895652 100644 --- a/src/main/java/org/hdivsamples/controllers/ActivityController.java +++ b/src/main/java/org/hdivsamples/controllers/ActivityController.java @@ -117,4 +117,10 @@ public String changeAccount(@Valid @ModelAttribute final CashAccount cashAccount return "accountActivity"; } + public void feature_2_report(Object activity){ + if (activity == null){ + System.out.println(activity.toString()); + } + } + } \ No newline at end of file