fix(security): use server-configured PET notification recipient
This commit is contained in:
@@ -480,10 +480,7 @@ test("notify/sendContactUsPETNotification posts only the dedicated PET payload",
|
||||
ignored: "not sent"
|
||||
};
|
||||
|
||||
const result = await notify.sendContactUsPETNotification(
|
||||
formValues,
|
||||
"pet@example.com"
|
||||
);
|
||||
const result = await notify.sendContactUsPETNotification(formValues);
|
||||
|
||||
assert.deepStrictEqual(normalize(result), { sent: true });
|
||||
assert.strictEqual(
|
||||
@@ -492,7 +489,6 @@ test("notify/sendContactUsPETNotification posts only the dedicated PET payload",
|
||||
);
|
||||
assert.strictEqual(axios.calls[0].config.method, "post");
|
||||
assert.deepStrictEqual(normalize(axios.calls[0].config.data), {
|
||||
petEmail: "pet@example.com",
|
||||
contactEmail: "person@example.com",
|
||||
contactSubject: "Questions about Planning legislation or policy",
|
||||
contactbody: "Please review https://example.invalid",
|
||||
@@ -513,15 +509,12 @@ test("notify/sendContactUsPETNotification logs and rethrows on failure", async (
|
||||
});
|
||||
|
||||
await assert.rejects(
|
||||
notify.sendContactUsPETNotification(
|
||||
{
|
||||
contactEmail: "person@example.com",
|
||||
contactSubject: "Questions about Planning legislation or policy",
|
||||
contactbody: "Message",
|
||||
typeOfContact: "plq"
|
||||
},
|
||||
"pet@example.com"
|
||||
),
|
||||
notify.sendContactUsPETNotification({
|
||||
contactEmail: "person@example.com",
|
||||
contactSubject: "Questions about Planning legislation or policy",
|
||||
contactbody: "Message",
|
||||
typeOfContact: "plq"
|
||||
}),
|
||||
(thrown) => thrown === error
|
||||
);
|
||||
assert.strictEqual(logger.calls.length, 1);
|
||||
@@ -538,7 +531,7 @@ test("public and portal Contact Us pages preserve PET gating and submission orde
|
||||
'formValues.typeOfContact == "plq" &&'
|
||||
);
|
||||
const petCall = source.indexOf(
|
||||
"sendPETEmail(formValues, props.petEmail);"
|
||||
"sendPETEmail(formValues);"
|
||||
);
|
||||
|
||||
assert.notStrictEqual(confirmationCall, -1);
|
||||
@@ -552,9 +545,7 @@ test("public and portal Contact Us pages preserve PET gating and submission orde
|
||||
true
|
||||
);
|
||||
assert.strictEqual(
|
||||
source.includes(
|
||||
"sendContactUsPETNotification(formValues, petEmail)"
|
||||
),
|
||||
source.includes("sendContactUsPETNotification(formValues)"),
|
||||
true
|
||||
);
|
||||
assert.strictEqual(
|
||||
@@ -562,6 +553,8 @@ test("public and portal Contact Us pages preserve PET gating and submission orde
|
||||
true
|
||||
);
|
||||
assert.strictEqual(source.includes("sendEmail(templateId,"), false);
|
||||
assert.strictEqual(source.includes("props.petEmail"), false);
|
||||
assert.strictEqual(source.includes("process.env.PETEMAIL"), false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user