TASK22019: phase 13 harden delete and involvement guards

This commit is contained in:
2026-03-13 13:02:49 +00:00
parent 0ca63d0228
commit 846cba1645
5 changed files with 231 additions and 10 deletions
+10 -2
View File
@@ -34,6 +34,16 @@ const hashAPIPath = (queryPath) => {
};
export default async function ApiProxy(req, res) {
if (
!req.body ||
typeof req.body.contactid === "undefined" ||
req.body.contactid.length === 0 ||
typeof req.body.incidentid === "undefined" ||
req.body.incidentid.length === 0
) {
return res.status(400).json();
}
var token = await getToken();
var contactid = req.body.contactid;
var queryUrl =
@@ -41,8 +51,6 @@ export default async function ApiProxy(req, res) {
req.body.incidentid +
")/pinswg_incident_contact_case_involvement/$ref";
console.log(req.body, queryUrl);
var crmUrl = "https://" + process.env.CRMURL;
var data = {
+10 -2
View File
@@ -34,6 +34,16 @@ const hashAPIPath = (queryPath) => {
};
export default async function ApiProxy(req, res) {
if (
!req.body ||
typeof req.body.contactid === "undefined" ||
req.body.contactid.length === 0 ||
typeof req.body.incidentid === "undefined" ||
req.body.incidentid.length === 0
) {
return res.status(400).json();
}
var token = await getToken();
var contactid = req.body.contactid;
var queryUrl =
@@ -41,8 +51,6 @@ export default async function ApiProxy(req, res) {
req.body.incidentid +
")/pinswg_incident_contact_case_involvement/$ref";
console.log(req.body, queryUrl);
var crmUrl = "https://" + process.env.CRMURL;
var crmVersion = process.env.CRMURL_VERSION;
+7 -3
View File
@@ -16,7 +16,9 @@ ApiProxy.get(async (req, res) => {
typeof containerName === "undefined" ||
containerName.length === 0 ||
typeof casefolderID === "undefined" ||
casefolderID.length === 0
casefolderID.length === 0 ||
typeof checkHash === "undefined" ||
checkHash.length === 0
) {
return res.status(400).json();
}
@@ -27,12 +29,14 @@ ApiProxy.get(async (req, res) => {
"&casefolderID=" +
casefolderID;
if (hashAPIPath(checkquerypath) != "&hash=" + checkHash) {
return res.status(400).json();
}
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
await deleteBlobCase(containerName, casefolderID).then((data) => {
return res.status(200).json({ data: data });
});
} else {
return res.status(400).json();
}
});
+7 -3
View File
@@ -19,7 +19,9 @@ ApiProxy.get(async (req, res) => {
typeof casefolderID === "undefined" ||
casefolderID.length === 0 ||
typeof repfile === "undefined" ||
repfile.length === 0
repfile.length === 0 ||
typeof checkHash === "undefined" ||
checkHash.length === 0
) {
return res.status(400).json();
}
@@ -32,14 +34,16 @@ ApiProxy.get(async (req, res) => {
"&repfile=" +
repfile;
if (hashAPIPath(checkquerypath) != "&hash=" + checkHash) {
return res.status(400).json();
}
casefolderID = casefolderID + "/" + repfile;
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
await deleteBlobRep(containerName, casefolderID).then((data) => {
return res.status(200).json({ data: data });
});
} else {
return res.status(400).json();
}
});