PromucFlow_constructor/scripts/trivy_vulnerabilities_data.sh

164 lines
6.0 KiB
Bash
Raw Normal View History

chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
#!/bin/bash
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
# Check required environment variables
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
required_vars=("DB_HOST" "DB_NAME" "DB_USER" "DB_PWD")
for var in "${required_vars[@]}"; do
if [ -z "${!var}" ] || [[ "${!var}" == "your_${var,,}" ]]; then
echo "Error: Required environment variable $var is missing or not set correctly."
exit 1
fi
done
DB_HOST="${DB_HOST}"
DB_NAME="${DB_NAME}"
DB_USER="${DB_USER}"
DB_PWD="${DB_PWD}"
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
# Assign parameters from the workflow
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
IMAGE="$1"
GITHUB_PR_ID="$2"
GITHUB_PR_LINK="$3"
GITHUB_RUN_ID="$4"
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
MAX_RETRIES=5
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
# Function to install Trivy with retry logic
install_trivy_with_retry() {
local count=0
local success=false
while [[ $count -lt $MAX_RETRIES ]]; do
echo "Attempting to install Trivy (attempt $((count + 1)))..."
TRIVY_VERSION=$(curl -s https://api.github.com/repos/aquasecurity/trivy/releases/latest | grep '"tag_name"' | sed -E 's/.*"v([^"]+)".*/\1/')
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
TRIVY_URL="https://github.com/aquasecurity/trivy/releases/download/v$TRIVY_VERSION/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
curl -sfL "$TRIVY_URL" | tar -xzf - trivy
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
if [[ $? -eq 0 ]]; then
mkdir -p "$HOME/bin"
mv trivy "$HOME/bin/"
export PATH="$HOME/bin:$PATH"
if command -v trivy &> /dev/null; then
success=true
break
fi
fi
echo "Trivy installation failed. Retrying..."
count=$((count + 1))
done
if [[ $success = false ]]; then
echo "Error: Trivy installation failed after $MAX_RETRIES attempts."
exit 1
fi
echo "Trivy installed successfully."
}
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
# Check if Trivy is installed, if not, install it
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
if ! command -v trivy &> /dev/null; then
install_trivy_with_retry
fi
NEW_VULN_FILE="trivy_vulnerabilities_new.csv"
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
rm -f "$NEW_VULN_FILE"
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
# Determine product name based on the image name
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
case "$IMAGE" in
*appsmith/appsmith-ce:*) product_name="CE" ;;
*appsmith/appsmith-ee:*) product_name="EE" ;;
*appsmith/cloud-services:*) product_name="CLOUD" ;;
*) product_name="UNKNOWN" ;;
esac
# Download Trivy DB if necessary
if [ ! -d "$HOME/.cache/trivy/db" ]; then
echo "Trivy DB not found. Downloading..."
TRIVY_TEMP_DIR=$(mktemp -d)
trivy --cache-dir $TRIVY_TEMP_DIR image --download-db-only
tar -cf ./db.tar.gz -C $TRIVY_TEMP_DIR/db metadata.json trivy.db
rm -rf $TRIVY_TEMP_DIR
fi
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
# Run Trivy scan
echo "Running Trivy scan for image: $IMAGE..."
trivy image --db-repository public.ecr.aws/aquasecurity/trivy-db --java-db-repository public.ecr.aws/aquasecurity/trivy-java-db --insecure --format json "$IMAGE" > "trivy_vulnerabilities.json" || {
echo "Error: Trivy scan failed for image: $IMAGE"
exit 1
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
}
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
# Process vulnerabilities and generate CSV
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
if jq -e '.Results | length > 0' "trivy_vulnerabilities.json" > /dev/null; then
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
jq -r --arg product "$product_name" '.Results[]? | .Vulnerabilities[]? | "\(.VulnerabilityID),\($product),TRIVY,\(.Severity)"' "trivy_vulnerabilities.json" | sort -u > "$NEW_VULN_FILE"
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
echo "Vulnerabilities saved to $NEW_VULN_FILE"
else
echo "No vulnerabilities found for image: $IMAGE"
echo "No vulnerabilities found." > "$NEW_VULN_FILE"
fi
# Compare each vulnerability with the database and store new ones in a CSV file
compare_and_store_vulns() {
local new_vulns_file="trivy_new_vulnerabilities.csv"
echo "vurn_id,product,scanner_tool,priority" > "$new_vulns_file" # CSV header
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
while IFS=, read -r vurn_id product scanner_tool priority; do
if [[ -z "$vurn_id" || -z "$priority" || -z "$product" || -z "$scanner_tool" ]]; then
continue
fi
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
# Remove spaces and redundant commas, and escape single quotes for SQL
vurn_id=$(echo "$vurn_id" | sed "s/'/''/g")
priority=$(echo "$priority" | sed "s/'/''/g")
product=$(echo "$product" | sed "s/'/''/g" | tr -d ' ' | sed 's/,*$//')
scanner_tool=$(echo "$scanner_tool" | sed "s/'/''/g" | tr -d ' ' | sed 's/,*$//')
# Check if vurn_id exists in the database
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
existing_entry=$(psql -t -c "SELECT product, scanner_tool FROM vulnerability_tracking WHERE vurn_id = '$vurn_id'" "postgresql://$DB_USER:$DB_PWD@$DB_HOST/$DB_NAME" 2>/dev/null)
if [ -n "$existing_entry" ]; then
# Parse existing products and tools
existing_product=$(echo "$existing_entry" | cut -d '|' -f 1 | tr -d ' ')
existing_scanner_tool=$(echo "$existing_entry" | cut -d '|' -f 2 | tr -d ' ')
# Merge with new values, ensuring uniqueness
combined_products="$existing_product,$product"
unique_products=$(echo "$combined_products" | tr ',' '\n' | sed '/^$/d' | sort -u | tr '\n' ',' | sed 's/^,//; s/,$//')
combined_scanner_tools="$existing_scanner_tool,$scanner_tool"
unique_scanner_tools=$(echo "$combined_scanner_tools" | tr ',' '\n' | sed '/^$/d' | sort -u | tr '\n' ',' | sed 's/^,//; s/,$//')
else
unique_products="$product"
unique_scanner_tools="$scanner_tool"
fi
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
# If the vulnerability is new, store it in the CSV file
if [[ -z "$existing_entry" ]]; then
echo "$vurn_id,$unique_products,$unique_scanner_tools,$priority" >> "$new_vulns_file"
echo "New vulnerability detected: $vurn_id"
else
echo "Skipping existing vulnerability: $vurn_id"
fi
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
done < "$NEW_VULN_FILE"
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
# Print the contents of new vulnerabilities
if [ -s "$new_vulns_file" ]; then
echo "****************************************************************"
echo "New vulnerabilities stored in $new_vulns_file:"
cat "$new_vulns_file"
echo "****************************************************************"
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
else
echo "No new vulnerabilities to store."
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
fi
}
# Run comparison and storage if vulnerabilities are found
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
if [ -s "$NEW_VULN_FILE" ]; then
compare_and_store_vulns
chore: Added scout & trivy scan to github workflow (#37022) ## Description Run trivy and scout scanner with image name Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11480586298> > Commit: 5ebbcd37ec177c781d8b0be38a83ce695d211c9d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11480586298&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 23 Oct 2024 13:36:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced two new scripts for automated vulnerability scanning of Docker images: `scout_vulnerabilities_data.sh` and `trivy_vulnerabilities_data.sh`. - Added a GitHub Actions workflow to automate vulnerability scanning and update pull requests with results. - **Bug Fixes** - Improved error handling for missing environment variables in the new scripts. - **Documentation** - Added details on the new workflow and its steps for user reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-23 14:31:40 +00:00
else
echo "No vulnerabilities to process."
chore: New schema change for vulnerabilities test (#37204) ## Description optimise the view for large number of records Fixes #`37036` ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11677745846> > Commit: 083266c8bdd82c3ff2aa0d58c1acb57d974cd46d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11677745846&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Tue, 05 Nov 2024 05:12:55 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced error handling and functionality in vulnerability data scripts. - Introduced a new function for inserting vulnerabilities into the database, improving data management. - **Bug Fixes** - Improved reliability of database insertion and handling of existing records. - Streamlined installation processes for Docker Scout and Trivy with increased retry attempts. - **Refactor** - Simplified scripts by removing old vulnerability comparisons and unnecessary comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-05 06:41:51 +00:00
fi
# Cleanup
rm -f "trivy_vulnerabilities.json"