如何在 Twilio 函数中安全地存储 phone 个数字?
How to securely store phone numbers in Twilio Functions?
我正在使用 Twilio 函数。我想知道存储在函数代码中的 phone 数字是否安全?
我使用的代码类似于在此处找到的代码:https://support.twilio.com/hc/en-us/articles/223180548-How-Can-I-Stop-Receiving-or-Block-Incoming-Phone-Calls-#blacklistNumbers
基本上,它会拒绝您选择的黑名单上的号码。黑名单在函数的代码中。
也许这已经是安全的了。原谅我的误会。
上述代码:
exports.handler = function(context, event, callback) {
// Listing all the blocked phone numbers, at the moment "+1(212)555-1234" and "+1(702)555-6789"
let blacklist = event.blacklist || [ "+12125551234", "+17025556789" ];
let twiml = new Twilio.twiml.VoiceResponse();
let blocked = true;
if (blacklist.length > 0) {
if (blacklist.indexOf(event.From) === -1) {
blocked = false;
}
}
if (blocked) {
twiml.reject();
}
else {
// if the caller's number is not blocked, redirecting to another TwiML which includes instructions for what to do
twiml.redirect("https://demo.twilio.com/docs/voice.xml");
}
callback(null, twiml);
};
嘿哟哟。 Twilio 开发者传播者在这里。
我认为您不必担心这些号码的安全性。但是您可以将黑名单添加到 function configuration instead。这样您就不必在每次想添加新号码到黑名单时更改功能代码。
以下这些值将在传递给您的函数的上下文对象中可用。
exports.handler = async function(context, event, callback) {
console.log(context.BLACKLIST); // 1212...
}
我正在使用 Twilio 函数。我想知道存储在函数代码中的 phone 数字是否安全?
我使用的代码类似于在此处找到的代码:https://support.twilio.com/hc/en-us/articles/223180548-How-Can-I-Stop-Receiving-or-Block-Incoming-Phone-Calls-#blacklistNumbers
基本上,它会拒绝您选择的黑名单上的号码。黑名单在函数的代码中。
也许这已经是安全的了。原谅我的误会。
上述代码:
exports.handler = function(context, event, callback) {
// Listing all the blocked phone numbers, at the moment "+1(212)555-1234" and "+1(702)555-6789"
let blacklist = event.blacklist || [ "+12125551234", "+17025556789" ];
let twiml = new Twilio.twiml.VoiceResponse();
let blocked = true;
if (blacklist.length > 0) {
if (blacklist.indexOf(event.From) === -1) {
blocked = false;
}
}
if (blocked) {
twiml.reject();
}
else {
// if the caller's number is not blocked, redirecting to another TwiML which includes instructions for what to do
twiml.redirect("https://demo.twilio.com/docs/voice.xml");
}
callback(null, twiml);
};
嘿哟哟。 Twilio 开发者传播者在这里。
我认为您不必担心这些号码的安全性。但是您可以将黑名单添加到 function configuration instead。这样您就不必在每次想添加新号码到黑名单时更改功能代码。
以下这些值将在传递给您的函数的上下文对象中可用。
exports.handler = async function(context, event, callback) {
console.log(context.BLACKLIST); // 1212...
}