diff --git a/.github/workflows/tfsec-evidence-example.yml b/.github/workflows/tfsec-evidence-example.yml index 3e11297..5ae8359 100644 --- a/.github/workflows/tfsec-evidence-example.yml +++ b/.github/workflows/tfsec-evidence-example.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 with: sparse-checkout: | - examples/tfsec/** + examples/aquasecurity/tfsec/** sparse-checkout-cone-mode: false - name: Publish to JFrog Artifactory run: | @@ -48,7 +48,7 @@ jobs: run: | pwd ls -al - python ./examples/tfsec/tfsec_json_to_markdown_helper.py tfsec.json + python ./examples/aquasecurity/tfsec/tfsec_json_to_markdown_helper.py tfsec.json # Attaching the evidence to associated package - name: Attach evidence using jfrog cli diff --git a/.github/workflows/trivy-evidence-example.yml b/.github/workflows/trivy-evidence-example.yml index f193d47..76d797f 100644 --- a/.github/workflows/trivy-evidence-example.yml +++ b/.github/workflows/trivy-evidence-example.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@v4 - name: Build and publish Docker Image to Artifactory run: | - docker build . --file ./examples/trivy/Dockerfile --tag $REGISTRY_DOMAIN/$REPO_NAME/$IMAGE_NAME:$VERSION + docker build . --file ./examples/aquasecurity/trivy/Dockerfile --tag $REGISTRY_DOMAIN/$REPO_NAME/$IMAGE_NAME:$VERSION echo "Pushing Docker Image to Artifactory" jf rt docker-push $REGISTRY_DOMAIN/$REPO_NAME/$IMAGE_NAME:$VERSION $REPO_NAME --build-name=$BUILD_NAME --build-number=${{ github.run_number }} echo "Pushing Docker Image to Artifactory completed" @@ -48,7 +48,8 @@ jobs: - name: Generate optional custom markdown report if: env.ATTACH_OPTIONAL_CUSTOM_MARKDOWN_TO_EVIDENCE == 'true' run: | - python ./examples/trivy/trivy_json_to_markdown_helper.py trivy-results.json + cat trivy-results.json + python ./examples/aquasecurity/trivy/trivy_json_to_markdown_helper.py trivy-results.json # Attaching the evidence to associated package - name: Attach evidence using jfrog cli diff --git a/examples/tfsec/README.md b/examples/aquasecurity/tfsec/README.md similarity index 96% rename from examples/tfsec/README.md rename to examples/aquasecurity/tfsec/README.md index f11e238..582db0c 100644 --- a/examples/tfsec/README.md +++ b/examples/aquasecurity/tfsec/README.md @@ -59,7 +59,7 @@ You can trigger the workflow manually from the GitHub Actions tab. The workflow ## Key Commands Used - **Publish Terraform Package:** - The workflow begins by configuring the JFrog CLI for Terraform and then publishes the code in the `examples/tfsec` directory as a versioned module to your Artifactory instance. It concludes by publishing the associated build information. + The workflow begins by configuring the JFrog CLI for Terraform and then publishes the code in the `examples/aquasecurity/tfsec` directory as a versioned module to your Artifactory instance. It concludes by publishing the associated build information. ```bash jf tfc --repo-deploy tf-local \ diff --git a/examples/tfsec/module/main.tf b/examples/aquasecurity/tfsec/module/main.tf similarity index 100% rename from examples/tfsec/module/main.tf rename to examples/aquasecurity/tfsec/module/main.tf diff --git a/examples/tfsec/tfsec_json_to_markdown_helper.py b/examples/aquasecurity/tfsec/tfsec_json_to_markdown_helper.py similarity index 100% rename from examples/tfsec/tfsec_json_to_markdown_helper.py rename to examples/aquasecurity/tfsec/tfsec_json_to_markdown_helper.py diff --git a/examples/trivy/Dockerfile b/examples/aquasecurity/trivy/Dockerfile similarity index 100% rename from examples/trivy/Dockerfile rename to examples/aquasecurity/trivy/Dockerfile diff --git a/examples/trivy/README.md b/examples/aquasecurity/trivy/README.md similarity index 98% rename from examples/trivy/README.md rename to examples/aquasecurity/trivy/README.md index e206f3d..ca5eee4 100644 --- a/examples/trivy/README.md +++ b/examples/aquasecurity/trivy/README.md @@ -127,7 +127,7 @@ Once the workflow completes successfully, you can navigate to your repository in * **Build Docker Image:** ``` -docker build . --file ./examples/trivy-verify-example/Dockerfile --tag $REGISTRY_URL/$REPO_NAME/$IMAGE_NAME:$VERSION +docker build . --file ./examples/aquasecurity/trivy-verify-example/Dockerfile --tag $REGISTRY_URL/$REPO_NAME/$IMAGE_NAME:$VERSION ``` * **Run Trivy Scan:** diff --git a/examples/trivy/trivy_json_to_markdown_helper.py b/examples/aquasecurity/trivy/trivy_json_to_markdown_helper.py similarity index 95% rename from examples/trivy/trivy_json_to_markdown_helper.py rename to examples/aquasecurity/trivy/trivy_json_to_markdown_helper.py index 47612eb..97e6f9b 100644 --- a/examples/trivy/trivy_json_to_markdown_helper.py +++ b/examples/aquasecurity/trivy/trivy_json_to_markdown_helper.py @@ -64,6 +64,10 @@ def generate_markdown_report(trivy_output): """ for result in trivy_output['Results']: + # Skip if Results key does not have a "Vulnerabilities" key or if Vulnerabilities is empty + if 'Vulnerabilities' not in result or not result['Vulnerabilities']: + continue + package_class = result['Class'] target = result['Target']