From 39c1f61e0dd42b929911441685a8a74b606e44c7 Mon Sep 17 00:00:00 2001 From: Michael O'Dea <117770721+modea-sl@users.noreply.github.com> Date: Thu, 22 Dec 2022 11:33:27 -0500 Subject: [PATCH 1/2] Create shiftleft.yml Added ShiftLeft GitHub workflow --- .github/workflows/shiftleft.yml | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/shiftleft.yml diff --git a/.github/workflows/shiftleft.yml b/.github/workflows/shiftleft.yml new file mode 100644 index 00000000..b7a32222 --- /dev/null +++ b/.github/workflows/shiftleft.yml @@ -0,0 +1,38 @@ +# This workflow integrates ShiftLeft NG SAST with GitHub +# Visit https://docs.shiftleft.io for help +name: ShiftLeft + +on: + pull_request: + workflow_dispatch: + push: + # We recommend triggering a scan when merging to your default branch + # as a best practice, especially if you'd like to compare the results + # of two scans (e.g., a feature branch against the default branch) + branches: + - main + - master +jobs: + ngsast-build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Download the ShiftLeft CLI and set permissions + run: | + curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl + + # ShiftLeft requires Java 1.8 + - name: Set up Java + uses: actions/setup-java@v1.4.3 + with: + java-version: 1.8 + + - name: Package with Maven + run: mvn clean package + + - name: NextGen Static Analysis + run: ${GITHUB_WORKSPACE}/sl analyze --app ShiftLeftJava --tag branch=${{ github.head_ref || steps.extract_branch.outputs.branch }} --vcs-prefix-correction "io/shiftleft=src/main/java/" --java $(pwd)/target/java-sec-code-1.0.0.jar + + env: + SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }} From ab8009be7a0771c014fdb679594a40e381e74a2a Mon Sep 17 00:00:00 2001 From: Michael O'Dea <117770721+modea-sl@users.noreply.github.com> Date: Thu, 22 Dec 2022 11:39:59 -0500 Subject: [PATCH 2/2] Update shiftleft.yml Corrected application name --- .github/workflows/shiftleft.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shiftleft.yml b/.github/workflows/shiftleft.yml index b7a32222..4870c3a8 100644 --- a/.github/workflows/shiftleft.yml +++ b/.github/workflows/shiftleft.yml @@ -32,7 +32,7 @@ jobs: run: mvn clean package - name: NextGen Static Analysis - run: ${GITHUB_WORKSPACE}/sl analyze --app ShiftLeftJava --tag branch=${{ github.head_ref || steps.extract_branch.outputs.branch }} --vcs-prefix-correction "io/shiftleft=src/main/java/" --java $(pwd)/target/java-sec-code-1.0.0.jar + run: ${GITHUB_WORKSPACE}/sl analyze --app java-sec-code --tag branch=${{ github.head_ref || steps.extract_branch.outputs.branch }} --vcs-prefix-correction "io/shiftleft=src/main/java/" --java $(pwd)/target/java-sec-code-1.0.0.jar env: SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }}