refactor phase 4 hardening helpers and redacted logging
This commit is contained in:
@@ -25,11 +25,19 @@
|
||||
* description: Failed
|
||||
*/
|
||||
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
import { consoleLogger, redactSensitive } from "../../../actions/core/logger";
|
||||
import { isNonEmptyString, sanitizeString } from "../../../actions/core/guards";
|
||||
import { getPreferredLanguage } from "../../../actions/services/accountService";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var data = req.body;
|
||||
const emailAddress = sanitizeString(data?.emailAddress);
|
||||
|
||||
if (!isNonEmptyString(emailAddress)) {
|
||||
return res.status(400).json({ error: "emailAddress is required" });
|
||||
}
|
||||
|
||||
data.emailAddress = emailAddress;
|
||||
|
||||
if (data?.reference === "PEDW-NEW-CASEREF") {
|
||||
try {
|
||||
@@ -50,7 +58,10 @@ export default async function ApiProxy(req, res) {
|
||||
const notifyClient = new NotifyClient(process.env.NOTIFY_API_KEY);
|
||||
//const emailReplyToId = process.env.EMAIL_REPLY_TO_ID;
|
||||
|
||||
console.log("///////////////\n Sending email \ns//////////////", data);
|
||||
console.log(
|
||||
"///////////////\n Sending email \ns//////////////",
|
||||
redactSensitive(data)
|
||||
);
|
||||
|
||||
notifyClient
|
||||
.sendEmail(data.templateId, data.emailAddress, {
|
||||
|
||||
Reference in New Issue
Block a user