Skip to content

Increasing security posture of HTC Grid by enforcing and fixing relevant encryption, authentication and RBAC issues #4

Increasing security posture of HTC Grid by enforcing and fixing relevant encryption, authentication and RBAC issues

Increasing security posture of HTC Grid by enforcing and fixing relevant encryption, authentication and RBAC issues #4

Workflow file for this run

# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# Licensed under the Apache License, Version 2.0 https://aws.amazon.com/apache-2-0/
name: Test-Checkov
on: [push, pull_request]
permissions:
contents: read
jobs:
checkov:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
runs-on: ubuntu-latest
env:
NEW_BRANCH: new_branch
MAIN_BRANCH: main_branch
NEW_BRANCH_REPORT_FILE: new_branch_checkov_report_file.sarif
MAIN_BRANCH_REPORT_FILE: main_branch_checkov_report_file.sarif
DIFF_REPORTS_FILE: diff_checkov_reports.txt
steps:
- name: Checkout the new branch
uses: actions/checkout@v3
with:
path: ${{ env.NEW_BRANCH }}
- name: Checkout the main branch
uses: actions/checkout@v3
with:
repository: awslabs/aws-htc-grid
path: ${{ env.MAIN_BRANCH }}
- name: Run checkov on the new branch
uses: bridgecrewio/checkov-action@v12
with:
directory: ${{ env.NEW_BRANCH }}
config_file: "${{ env.NEW_BRANCH }}/.github/workflows/checkov.conf"
output_format: cli,sarif
output_file_path: console,${{ env.NEW_BRANCH_REPORT_FILE }}
- name: Run checkov on the main branch
uses: bridgecrewio/checkov-action@v12
with:
directory: ${{ env.MAIN_BRANCH }}
config_file: "${{ env.NEW_BRANCH }}/.github/workflows/checkov.conf"
output_format: cli,sarif
output_file_path: console,${{ env.MAIN_BRANCH_REPORT_FILE }}
- name: Upload checkov scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: "${{ env.NEW_BRANCH_REPORT_FILE }}"
- name: Save report results for the new branch
uses: actions/upload-artifact@v3
with:
name: ${{ env.NEW_BRANCH_REPORT_FILE }}
path: ${{ env.NEW_BRANCH_REPORT_FILE }}
- name: Save report results for the main branch
uses: actions/upload-artifact@v3
with:
name: ${{ env.MAIN_BRANCH_REPORT_FILE }}
path: ${{ env.MAIN_BRANCH_REPORT_FILE }}
- name: Generate the diff of reports between main and the new branch
run: |-
diff ${{ env.NEW_BRANCH_REPORT_FILE }} ${{ env.MAIN_BRANCH_REPORT_FILE }} >> ${{ env.DIFF_REPORTS_FILE }} || true
- name: Save diff reports
uses: actions/upload-artifact@v3
with:
name: ${{ env.DIFF_REPORTS_FILE }}
path: ${{ env.DIFF_REPORTS_FILE }}
- name: Verify that the number of errors in the new branch does not exceed the number of existing errors in the main branch
run: |-
if [ "$(wc -l < ${{ env.NEW_BRANCH_REPORT_FILE }} )" -gt "$(wc -l < ${{ env.MAIN_BRANCH_REPORT_FILE }} )" ]; then \
echo "Warning: New branch has more errors!"
exit 1
fi