Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kavitha | upgrade versions to fix trivy vulnerability #217

Open
wants to merge 5 commits into
base: Bahmni-IPD-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions .github/workflows/build_publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: 🏗️ Build and Publish

on:
push:
branches:
Expand All @@ -13,12 +14,12 @@ on:
workflow_dispatch:

jobs:
Trivy:
trivy-scan:
name: 🕵️‍♂️ Trivy Scan
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 🕵️‍♂️ Trivy Scan
run: |
wget -q https://raw.githubusercontent.com/Bahmni/bahmni-infra-utils/main/trivy_scan.sh && chmod +x trivy_scan.sh
Expand All @@ -28,18 +29,24 @@ jobs:
build-publish-docker:
name: 🏗️ Build & Publish Docker Image
runs-on: ubuntu-latest
needs: Trivy
needs: trivy-scan
steps:
- uses: actions/checkout@v2
- name: Set env.ARTIFACT_VERSION
run: |
wget -q https://raw.githubusercontent.com/Bahmni/bahmni-infra-utils/main/setArtifactVersion.sh && chmod +x setArtifactVersion.sh
./setArtifactVersion.sh
rm setArtifactVersion.sh
- uses: actions/checkout@v4
- name: 📥 Use Node.js 14.x
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 14.x
- name: 📥 Install dependencies
run: yarn install
- name: 🏗️ Build
run: yarn build
- name: Test
- name: 🔍 Test
run: yarn test:ci
- name: 🖥️ Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -50,16 +57,23 @@ jobs:
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: 🐳 Docker Build and push
uses: docker/build-push-action@v3
- name: 🐳 Docker Build and Push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
file: package/docker/Dockerfile
push: true
tags: |
bahmni/microfrontend-ipd:ipd-${{ github.run_number }}
bahmni/microfrontend-ipd:ipd
bahmni/microfrontend-ipd:${{ env.ARTIFACT_VERSION }}
bahmni/microfrontend-ipd:latest

push-translations:
name: Push Translations to Transifex
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: Push Translations to Transifex
run: |
curl -o transifex.sh https://raw.githubusercontent.com/Bahmni/bahmni-infra-utils/main/transifex.sh
Expand All @@ -72,16 +86,19 @@ jobs:
trigger-workflow:
name: 🔁 Trigger workflow to deploy to Docker env
needs:
- trivy-scan
- build-publish-docker
- Trivy
- push-translations
runs-on: ubuntu-latest
env:
ORG_NAME: Bahmni
REPOSITORY_NAME: bahmni-docker
EVENT_TYPE: bahmni-ipd-microfrontend-event
steps:
- name: 🔧 Create repository_dispatch
run: |
trigger_result=$(curl -s -o trigger_response.txt -w "%{http_code}" -X POST -H "Accept: application/vnd.github.v3+json" -H 'authorization: Bearer ${{ secrets.IPD_PAT }}' https://api.github.com/repos/${{ secrets.IPD_ORG_NAME }}/${{ secrets.IPD_REPOSITORY_NAME }}/dispatches -d '{"event_type":"'"${EVENT_TYPE}"'"}')
if [ $trigger_result == 204 ];then
trigger_result=$(curl -s -o trigger_response.txt -w "%{http_code}" -X POST -H "Accept: application/vnd.github.v3+json" -H 'authorization: Bearer ${{ secrets.BAHMNI_PAT }}' https://api.github.com/repos/${ORG_NAME}/${REPOSITORY_NAME}/dispatches -d '{"event_type":"'"${EVENT_TYPE}"'"}')
if [ $trigger_result == 204 ]; then
echo "✅ Trigger to $ORG_NAME/$REPOSITORY_NAME Success"
else
echo "❌ Trigger to $ORG_NAME/$REPOSITORY_NAME Failed"
Expand Down
3 changes: 2 additions & 1 deletion .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ CVE-2020-7753
CVE-2023-26115
CVE-2021-3803 #Reported version 1.0.2 is not there in the dependencies
CVE-2023-42282 #Installed version 2.0.0 https://avd.aquasec.com/nvd/cve-2023-42282
CVE-2024-29180
CVE-2024-29180
CVE-2024-29415
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"scripts": {
"preinstall": "git config core.hooksPath .git-hooks",
"start-storybook": "start-storybook -p 6006",
"test": " TZ=UTC jest",
"test": " TZ=UTC jest --coverage",
"test:ci": "yarn test --ci",
"bump:patch": "yarn version --no-git-tag-version --patch",
"bump:minor": "yarn version --no-git-tag-version --minor",
Expand Down Expand Up @@ -97,6 +97,8 @@
"resolutions": {
"@babel/traverse": "7.23.2",
"browserify-sign": "4.2.2",
"follow-redirects": "1.15.4"
"follow-redirects": "1.15.4",
"braces": "^3.0.3",
"ws": "^5.2.4"
}
}
1 change: 1 addition & 0 deletions package/.appversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const CareViewPatientsSummary = ({
const patientUuid = patientData.patientUuid;
const patientTasks = [];
patientData.tasks.forEach(task => {
if (task.taskType.display === "nursing_activity_system" && task.status === "REQUESTED") {
if (task.taskType?.display === "nursing_activity_system" && task.status === "REQUESTED") {

patientTasks.push({
taskName: task.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ViewFormModal = (props) => {
setIsLoading(true);
fetchAllObservations(encounterUuid).then((response) => {
const filteredResponse = response.observations.filter((ob) =>
ob.formFieldPath.includes(formName)
ob.formFieldPath?.includes(formName)
);
const flattenedObs = flattenObservations(filteredResponse);
const groupedObs = _.groupBy(flattenedObs, "concept.name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const IntakeOutput = () => {
callFetchIntakeAndOutputData();
}, []);
return (
<div className="container display-container">
<div className="form-dc-container display-container">
<div className={"navigation"}>
<div className="period-header">
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
grid-row: 2;
}

.container {
.form-dc-container {
display: flex;
flex-direction: column;
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export const disableTaskTilePastNextSlotTime = (
const currentTimeInEpoch = moment().unix();
if (upcomingTaskTimeInEpoch <= currentTimeInEpoch) {
currentTask.isDisabled =
currentTask.taskType.display === "nursing_activity";
currentTask.taskType?.display === "nursing_activity";
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const iconType = (task, nursingTasks) => {
if (status === "Not Done" || status === "missed") return "Not-Administered";
if (
administeredTimeInEpochSeconds ||
(status === "COMPLETED" && taskType.display)
(status === "COMPLETED" && taskType?.display)
) {
const administeredLateWindowInSeconds =
startTimeInEpochSeconds +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const PatientFeedingRecord = () => {
callFetchPatientFeedingRecordData();
}, []);
return (
<div className="container display-container">
<div className="form-dc-container display-container">
<div className={"navigation"}>
<div className="period-header">
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`PatientFeedingRecord should render PatientFeedingRecord 1`] = `
<div>
<div
class="container display-container"
class="form-dc-container display-container"
>
<div
class="navigation"
Expand Down Expand Up @@ -75,7 +75,7 @@ exports[`PatientFeedingRecord should render PatientFeedingRecord 1`] = `
<div
class="period-time"
>
10 May 2024
31 Aug 2021

<span
class="mr-5"
Expand Down Expand Up @@ -109,7 +109,7 @@ exports[`PatientFeedingRecord should render PatientFeedingRecord 1`] = `
to
</span>

11 May 2024
01 Sep 2021

<span
class="mr-5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ describe("PatientFeedingRecordTable", () => {

describe("PatientFeedingRecord", () => {
it("should render PatientFeedingRecord", () => {
MockDate.set("2021-09-01T00:00:00.000Z");
const { container } = render(
<IPDContext.Provider
value={{ config: mockConfig, visitSummary: mockVisitSummaryData }}
Expand Down
Loading