api hardening

This commit is contained in:
2026-03-16 10:46:05 +00:00
parent 598e4a6077
commit 023a8e9e6d
8 changed files with 378 additions and 24 deletions
@@ -59,6 +59,18 @@ export default async function ApiProxy(req, res) {
var appealTypeName = req.query.appealTypeName;
var primaryIdAttribute = req.query.primaryIdAttribute;
var incidentID = req.query.incidentID;
if (
!appealTypeName ||
!primaryIdAttribute ||
!incidentID ||
String(appealTypeName).trim().length === 0 ||
String(primaryIdAttribute).trim().length === 0 ||
String(incidentID).trim().length === 0
) {
return res.status(400).json();
}
var token = await getToken();
let navigationProperty =
@@ -92,8 +104,6 @@ export default async function ApiProxy(req, res) {
? "pinswg_sipscase_value"
: primaryIdAttribute + "s_value");
console.log("query: ", queryUrl, "<<<<end query");
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
@@ -102,7 +112,7 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
let flattened = data.value.map((r) => ({
...r,
ticketnumber: r[navigationProperty]?.ticketnumber || null,
ticketnumber: r[navigationProperty]?.ticketnumber || null
}));
data.value = flattened;