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

Tracking pull request to merge release-1.65.0 to master #2358

Merged
merged 56 commits into from
Feb 6, 2025

Conversation

kuanfandevops
Copy link
Collaborator

No description provided.

kuanfandevops and others added 30 commits November 19, 2024 14:44
…re isnt an empty box when agreements dont have comments (#2359)

chore: modifies proptypes in vehicle supplier tabs due to console messages appearing
* Create unit-tests for ComplianceObligationContainer

* Refactor ComplianceObligationContainer for unit-test edge case

* Grouping some tests

* Refactor compliance unit-tests to reduce duplicated codes

* Refactor TestHelper class to TestData class

* Grouping common test data

* Refactor testData class in ComplianceObligationContainer test
* Add unit-tests for Compliance and Compliance-components

* Minor clean-up

* Minor clean-up
…event Error 31 (duplicate VINs) (#2370)

* task: spreadsheets with duplicate vins are rejected with error message during submission

* chore: moves line out of loop
* unit tests for supp components

* tweaks and start zevsales

* get rid of duplication
#2377)

* -adds navigation tabs to credit agreement details

* chore: ran prettier

axios.get.mockResolvedValue(mockResponse);

const params = { headers: { Authorization: "Bearer token" } };

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical test

The hard-coded value "Bearer token" is used as
authorization header
.
emi-hi and others added 6 commits January 2, 2025 14:25
* Disable Save button if vehicle supplier, transaction type, or effective date is not entered.

* Disable "Submit to Director" button if credit quantity is missing.
* Add model-year in query string to solve tab-names inconsistency during loading issue.

* Add URI encoding and code clean-up

* Align compliance report tabs

* Fixing compliance report disabled tabs alignment

* Disable compliance-report tabs when loading.

* Move insertIdAndYear function to utilities
)

* feat: initial changes to seperate comment boxes and add tooltip

* chore: ran prettier

* chore: minor refactoring

* chore: adds useEffect
const getRoute = () => {
if (locationRoute && locationState) {
return history.push(locationRoute, locationState)
return history.push(locationRoute, locationState);

Check failure

Code scanning / CodeQL

Client-side cross-site scripting High

Cross-site scripting vulnerability due to
user-provided value
.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to ensure that the locationRoute parameter is properly sanitized before being used in the history.push method. One effective way to do this is by using a library like DOMPurify to sanitize the user input. This will prevent any malicious scripts from being executed.

  1. Install the DOMPurify library.
  2. Import DOMPurify in the relevant files.
  3. Sanitize the locationRoute parameter before using it in the history.push method.
Suggested changeset 2
frontend/src/app/components/Button.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/components/Button.js b/frontend/src/app/components/Button.js
--- a/frontend/src/app/components/Button.js
+++ b/frontend/src/app/components/Button.js
@@ -5,2 +5,3 @@
 import history from "../History";
+import DOMPurify from "dompurify";
 
@@ -20,8 +21,9 @@
   const getRoute = () => {
-    if (locationRoute && locationState) {
-      return history.push(locationRoute, locationState);
+    const sanitizedRoute = DOMPurify.sanitize(locationRoute);
+    if (sanitizedRoute && locationState) {
+      return history.push(sanitizedRoute, locationState);
     }
 
-    if (locationRoute) {
-      return history.push(locationRoute);
+    if (sanitizedRoute) {
+      return history.push(sanitizedRoute);
     }
EOF
@@ -5,2 +5,3 @@
import history from "../History";
import DOMPurify from "dompurify";

@@ -20,8 +21,9 @@
const getRoute = () => {
if (locationRoute && locationState) {
return history.push(locationRoute, locationState);
const sanitizedRoute = DOMPurify.sanitize(locationRoute);
if (sanitizedRoute && locationState) {
return history.push(sanitizedRoute, locationState);
}

if (locationRoute) {
return history.push(locationRoute);
if (sanitizedRoute) {
return history.push(sanitizedRoute);
}
frontend/package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/package.json b/frontend/package.json
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -52,3 +52,4 @@
     "winston": "^3.2.1",
-    "xlsx": "^0.18.5"
+    "xlsx": "^0.18.5",
+    "dompurify": "^3.2.3"
   },
EOF
@@ -52,3 +52,4 @@
"winston": "^3.2.1",
"xlsx": "^0.18.5"
"xlsx": "^0.18.5",
"dompurify": "^3.2.3"
},
This fix introduces these dependencies
Package Version Security advisories
dompurify (npm) 3.2.3 None
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
}

if (locationRoute) {
return history.push(locationRoute)
return history.push(locationRoute);

Check failure

Code scanning / CodeQL

Client-side cross-site scripting High

Cross-site scripting vulnerability due to
user-provided value
.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to ensure that the locationRoute parameter is sanitized or validated before being used in the history.push function. One effective way to do this is to use a whitelist of allowed routes and ensure that the locationRoute matches one of these allowed routes before proceeding.

  1. Create a whitelist of allowed routes.
  2. Validate the locationRoute against this whitelist before using it in the history.push function.
  3. If the locationRoute is not valid, handle the error appropriately (e.g., redirect to a default safe route or show an error message).
Suggested changeset 1
frontend/src/app/components/Button.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/components/Button.js b/frontend/src/app/components/Button.js
--- a/frontend/src/app/components/Button.js
+++ b/frontend/src/app/components/Button.js
@@ -19,11 +19,10 @@
   } = props;
+  const allowedRoutes = ["/route1", "/route2", "/route3"]; // Add all allowed routes here
   const getRoute = () => {
-    if (locationRoute && locationState) {
-      return history.push(locationRoute, locationState);
-    }
-
-    if (locationRoute) {
+    if (locationRoute && allowedRoutes.includes(locationRoute)) {
+      if (locationState) {
+        return history.push(locationRoute, locationState);
+      }
       return history.push(locationRoute);
     }
-
     return history.goBack();
EOF
@@ -19,11 +19,10 @@
} = props;
const allowedRoutes = ["/route1", "/route2", "/route3"]; // Add all allowed routes here
const getRoute = () => {
if (locationRoute && locationState) {
return history.push(locationRoute, locationState);
}

if (locationRoute) {
if (locationRoute && allowedRoutes.includes(locationRoute)) {
if (locationState) {
return history.push(locationRoute, locationState);
}
return history.push(locationRoute);
}

return history.goBack();
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
if (newState === 'SUBMITTED') {
history.replace(ROUTES_VEHICLES.DETAILS.replace(/:id/gi, id))
if (newState === "SUBMITTED") {
history.replace(ROUTES_VEHICLES.DETAILS.replace(/:id/gi, id));

Check failure

Code scanning / CodeQL

Client-side cross-site scripting High

Cross-site scripting vulnerability due to
user-provided value
.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to ensure that the id parameter is properly sanitized before being used in constructing the URL. One way to achieve this is by using a library like DOMPurify to sanitize the id parameter. This will help prevent any malicious scripts from being executed.

  1. Install the DOMPurify library.
  2. Import DOMPurify in the file.
  3. Sanitize the id parameter before using it in the URL construction.
Suggested changeset 2
frontend/src/vehicles/VehicleDetailsContainer.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/vehicles/VehicleDetailsContainer.js b/frontend/src/vehicles/VehicleDetailsContainer.js
--- a/frontend/src/vehicles/VehicleDetailsContainer.js
+++ b/frontend/src/vehicles/VehicleDetailsContainer.js
@@ -13,2 +13,3 @@
 import VehicleDetailsPage from "./components/VehicleDetailsPage";
+import DOMPurify from "dompurify";
 
@@ -20,3 +21,4 @@
   });
-  const { id } = useParams();
+  const { id: rawId } = useParams();
+  const id = DOMPurify.sanitize(rawId);
   const { keycloak, user, location } = props;
EOF
@@ -13,2 +13,3 @@
import VehicleDetailsPage from "./components/VehicleDetailsPage";
import DOMPurify from "dompurify";

@@ -20,3 +21,4 @@
});
const { id } = useParams();
const { id: rawId } = useParams();
const id = DOMPurify.sanitize(rawId);
const { keycloak, user, location } = props;
frontend/package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/package.json b/frontend/package.json
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -52,3 +52,4 @@
     "winston": "^3.2.1",
-    "xlsx": "^0.18.5"
+    "xlsx": "^0.18.5",
+    "dompurify": "^3.2.3"
   },
EOF
@@ -52,3 +52,4 @@
"winston": "^3.2.1",
"xlsx": "^0.18.5"
"xlsx": "^0.18.5",
"dompurify": "^3.2.3"
},
This fix introduces these dependencies
Package Version Security advisories
dompurify (npm) 3.2.3 None
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
rogerlcleung and others added 19 commits January 8, 2025 00:34
…tip (#2414)

* feat: disables save button if forecast isn't filled, adds tooltip

* fix: adds check for model year before disabling save

* chore: adds proptypes
* fix: conditionally displays confirmation for sales forecast if year >= 2023

* chore: adds proptypes

* chore: replaces if-then-else flow as requested by sonarcloud
* enhance ux on file upload

* allow for prescence of confirm modal to be controlled via props for FileDropArea
* Create unit-tests for Credits

* Grouping common test data
* unit tests for credit agreement components

* reduce duplicate code
* feat: 2412 - updated sales and supplied table

* small change
* feat: adds tooltip component and implements it on supplier info page and compliance obligation

* chore: linting

* chore: more linting

* fix: adds # to css color
* fix: adds filter to credit agreement comments for bceid users

* adds check to ensure comment exists for update

* chore: credit agreement tests

* chore: linting
* Disable Recommend buttons in credit transfer if no comment is entered.

* Fix props-validation

* Disable "Add Comment" button until a comment is entered.

* Fix the issue that some buttons won't change back to disabled if comment is erased.
* Add admin command reset_database

* minor change

* Add migration and check for production environment
* credit transfer tests

* more debug

* ensure users get distinct organizations

* remove transaction.oncommit
Copy link

sonarqubecloud bot commented Feb 4, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube Cloud

@kuanfandevops kuanfandevops merged commit 85a516e into master Feb 6, 2025
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants