From b773cb19b2933705f170d074414a8076ac7153c9 Mon Sep 17 00:00:00 2001 From: Julian <82032362+jurosens@users.noreply.github.com> Date: Thu, 20 May 2021 09:48:53 +0200 Subject: [PATCH] Feat/dep check (#67) * feat: weekly dependency checking and on push to main * fix: code smells --- .github/workflows/ci-dependency-check.yml | 40 +++++++++++++++++++ owasp/suppressions.xml | 14 ++++++- pom.xml | 18 ++++----- .../btp/SapCredentialStoreCfEnvProcessor.java | 5 ++- .../restapi/controller/CertController.java | 7 +--- 5 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/ci-dependency-check.yml diff --git a/.github/workflows/ci-dependency-check.yml b/.github/workflows/ci-dependency-check.yml new file mode 100644 index 0000000..4f2b4f3 --- /dev/null +++ b/.github/workflows/ci-dependency-check.yml @@ -0,0 +1,40 @@ +name: ci-main +on: + schedule: + - cron: '0 1 * * 0' # Each Sunday at 01:00 UTC + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: adopt + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/cache@v2 + with: + path: | + ~/.m2/repository + key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }} + - name: version + run: |- + APP_SHA=$(git rev-parse --short ${GITHUB_SHA}) + APP_LATEST_REV=$(git rev-list --tags --max-count=1) + APP_LATEST_TAG=$(git describe --tags ${APP_LATEST_REV} 2> /dev/null || echo 0.0.0) + echo "APP_VERSION=${APP_LATEST_TAG}-${APP_SHA}" >> ${GITHUB_ENV} + - name: mvn + run: |- + mvn dependency-check:check \ + --batch-mode \ + --file ./pom.xml \ + --settings ./settings.xml \ + --define app.packages.username="${APP_PACKAGES_USERNAME}" \ + --define app.packages.password="${APP_PACKAGES_PASSWORD}" \ + env: + APP_PACKAGES_USERNAME: ${{ github.actor }} + APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} diff --git a/owasp/suppressions.xml b/owasp/suppressions.xml index 3aac6ff..9b62800 100644 --- a/owasp/suppressions.xml +++ b/owasp/suppressions.xml @@ -11,7 +11,19 @@ CVE-2012-5055 - see https://tomcat.apache.org/security-9.html#Apache_Tomcat_9.x_vulnerabilities vulnerability is fixed in tomcat 9.0.38 + see https://tomcat.apache.org/security-9.html#Apache_Tomcat_9.x_vulnerabilities vulnerability is fixed in + tomcat 9.0.38 + CVE-2020-13943 + + + + da214a6f44ee5811c97f3b53a6dda31edf25ac9e + CVE-2016-9878 + CVE-2018-1270 + CVE-2018-1271 + CVE-2018-1272 + CVE-2020-5421 + diff --git a/pom.xml b/pom.xml index 5373e46..2a78b18 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ UTF-8 0.4.0 - 6.1.1 + 6.1.6 2.4.4 2020.0.2 5.3.5 @@ -262,6 +262,12 @@ io.pivotal.cfenv java-cfenv-boot 2.3.0 + + + org.springframework.boot + spring-boot + + com.google.code.gson @@ -332,19 +338,9 @@ dependency-check-maven ${owasp.version} - true ./owasp/suppressions.xml true - - - check - validate - - check - - - org.apache.maven.plugins diff --git a/src/main/java/eu/europa/ec/dgc/issuance/config/btp/SapCredentialStoreCfEnvProcessor.java b/src/main/java/eu/europa/ec/dgc/issuance/config/btp/SapCredentialStoreCfEnvProcessor.java index f34454e..ddea994 100644 --- a/src/main/java/eu/europa/ec/dgc/issuance/config/btp/SapCredentialStoreCfEnvProcessor.java +++ b/src/main/java/eu/europa/ec/dgc/issuance/config/btp/SapCredentialStoreCfEnvProcessor.java @@ -30,8 +30,9 @@ public class SapCredentialStoreCfEnvProcessor implements CfEnvProcessor { @Override public boolean accept(CfService service) { - return service.existsByTagIgnoreCase("credstore", "securestore", "keystore", "credentials") - || service.existsByLabelStartsWith("credstore") || service.existsByUriSchemeStartsWith(CRED_STORE_SCHEME); + return service.existsByTagIgnoreCase(CRED_STORE_SCHEME, "securestore", "keystore", "credentials") + || service.existsByLabelStartsWith(CRED_STORE_SCHEME) + || service.existsByUriSchemeStartsWith(CRED_STORE_SCHEME); } @Override diff --git a/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/CertController.java b/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/CertController.java index 644da39..1496fea 100644 --- a/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/CertController.java +++ b/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/CertController.java @@ -39,9 +39,7 @@ import org.springframework.web.bind.annotation.RestController; /** - * The endpoint here are not public API and should be used only for developing testing - * purposes. - * Only available for spring dev profile + * The endpoint here are not public API and should be used only for developing testing purposes. */ @RestController @RequestMapping("/cert") @@ -74,7 +72,6 @@ public ResponseEntity decodeCbor(@RequestBody String cbor) throws IOExce * * @param prefixedEncodedCompressedCose edgc * @return decode result - * @throws IOException IOException */ @Operation( summary = "decode edgc, developing tool", @@ -82,7 +79,7 @@ public ResponseEntity decodeCbor(@RequestBody String cbor) throws IOExce ) @PostMapping(value = "decodeEGC", consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity decodeEgCert( - @RequestBody String prefixedEncodedCompressedCose) throws IOException { + @RequestBody String prefixedEncodedCompressedCose) { EgcDecodeResult egcDecodeResult = edgcValidator.decodeEdgc(prefixedEncodedCompressedCose); return ResponseEntity.ok(egcDecodeResult);