Skip to content

Commit

Permalink
fix: fixed hard-coded denylist removal issue
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Dec 13, 2024
1 parent 26a702f commit e4994a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/web/denylist.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,10 @@ async function remove(ctx) {
await email({
template: 'alert',
message: {
to: ctx.request.body.email,
to: config.email.message.from,
cc: isEmail(ctx.request.body.email)
? ctx.request.body.email
: ctx.state.user.email,
subject: `Hard-coded Denylist Removal: ${ctx.state.q}`
},
locals: {
Expand Down
2 changes: 2 additions & 0 deletions helpers/is-email.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

const punycode = require('node:punycode');

const isSANB = require('is-string-and-not-blank');
const { isEmail } = require('@forwardemail/validator');

//
Expand All @@ -14,6 +15,7 @@ const { isEmail } = require('@forwardemail/validator');
// <https://github.com/validatorjs/validator.js/issues/2508>
// <https://github.com/validatorjs/validator.js/issues/2504>
module.exports = function (str) {
if (!isSANB(str)) return false;
return isEmail(punycode.toASCII(str), {
allow_ip_domain: true,
ignore_max_length: true,
Expand Down

0 comments on commit e4994a0

Please sign in to comment.