Additional security hardening.

This commit is contained in:
Patrick Fic
2023-05-04 11:59:39 -07:00
parent 99b847822f
commit b861957342
9 changed files with 89 additions and 35 deletions

View File

@@ -50,7 +50,7 @@ async function getEntegralShopData() {
}
exports.default = async (req, res) => {
res.sendStatus(200);
res.sendStatus(401);
return;
//Query for the List of Bodyshop Clients.
const job = req.body.event.data.new;

View File

@@ -40,6 +40,14 @@ exports.default = async (req, res) => {
const specificShopIds = req.body.bodyshopIds; // ['uuid]
const { start, end, skipUpload } = req.body; //YYYY-MM-DD
if (
!start ||
!moment(start).isValid ||
req.headers["x-imex-auth"] !== process.env.AUTOHOUSE_AUTH_TOKEN
) {
res.sendStatus(401);
return;
}
const allxmlsToUpload = [];
const allErrors = [];
try {
@@ -772,7 +780,9 @@ const CreateCosts = (job) => {
billTotalsByCostCenters[
job.bodyshop.md_responsibility_centers.defaults.costs.MAPA
] = Dinero({
amount: Math.round((job.mixdata[0] && job.mixdata[0].totalliquidcost || 0) * 100)
amount: Math.round(
((job.mixdata[0] && job.mixdata[0].totalliquidcost) || 0) * 100
),
});
} else {
billTotalsByCostCenters[