Merged PR 2315: Auth stabilistatiion and hardening

Related work items: #23020
This commit is contained in:
Robert Bond
2026-05-14 08:55:49 +00:00
parent d295a507ac
commit d0b2fd077a
41 changed files with 1462 additions and 418 deletions
+10
View File
@@ -2,6 +2,8 @@
import fs from "fs";
import path from "path";
const xmlCache = new Map();
/**
* Reads /data/formsxml/{appealtypes}.xml and normalises it.
* Returns { xmlStr } or throws on missing file.
@@ -12,6 +14,12 @@ export function readFormXml(appealtypes) {
const configDirectory = path.resolve(process.cwd(), "data/formsxml");
const filePath = path.join(configDirectory, `${appealtypes}.xml`);
const cacheKey = filePath;
const cached = xmlCache.get(cacheKey);
if (cached) {
return { xmlStr: cached, filePath, fromCache: true };
}
let xmlStr = fs.readFileSync(filePath, "utf8");
// Keep existing normalisation behaviour
@@ -20,5 +28,7 @@ export function readFormXml(appealtypes) {
xmlStr = xmlStr.replace(/> <"/g, "><");
xmlStr = xmlStr.toString();
xmlCache.set(cacheKey, xmlStr);
return { xmlStr, filePath };
}