简体   繁体   English

有权删除通过Podio邮件发送到项目功能发送的垃圾邮件评论

[英]Permissions to delete spam comments sent in via the Podio Email to item feature

We have an awkward, persisting situation of receiving unsolicited comments into our corporate Podio space via the Email to Item feature. 通过电子邮件到项目功能接收未经请求的评论到我们公司的Podio空间中,我们一直处于尴尬而持续的状态。 We spam arrives sporadically, we get a couple of hundred of them on some days. 我们的垃圾邮件偶尔会到达,有时会收到数百封。 Removing the offending user from the Podio workspace does not help. 从Podio工作区中删除有问题的用户无济于事。 We have of course contacted Podio support, but they are unable to help. 我们当然已经联系了Podio支持,但是他们无法提供帮助。

I assume others have, or are vulnerable the same breach. 我认为其他人也有或容易受到同样的侵害。 It seems Kirsten Campbell-Morris reported in 2014 the same breach. 似乎Kirsten Campbell-Morris在2014年报告了同样的漏洞。

Our analysis is that the email notification which Podio sends have been captured, and the unique reply-to addresses are used. 我们的分析是,已经捕获了Podio发送的电子邮件通知,并使用了唯一的回复地址。 According to our analysis (and theory), this is a write-only vulnerability. 根据我们的分析(和理论),这是一个只写漏洞。

In our case the spam items are easy to classify as spam/ham: they all come from one user 𝒰, and always arrive via the Email to Item feature. 在我们的案例中,垃圾邮件很容易被归类为垃圾邮件/火腿:它们全部来自一个用户𝒰,并且始终通过“邮件发送到邮件”功能到达。 Other than the spam, we never ever need this feature, and would be happy to get rid of this poorly managed feature altogether. 除了垃圾邮件之外,我们再也不需要此功能,并且很乐意完全摆脱此管理不善的功能。

We have sketched three alternate solutions, here in chronological order of development: 我们按照开发的时间顺序,草绘了三种替代解决方案:

  1. A periodic cleanup program 定期清理程序
  2. JavaScript program running against the DOM 针对DOM运行的JavaScript程序
  3. A webhook endpoint Webhook端点

See below for description of the others (1. and 2.), but we would prefer to use the latest idea (3.), using webhooks . 有关其他内容(1.和2)的描述,请参见下文。但是,我们更愿意使用webhooks来使用最新的想法(3.)。 The idea is to create a either one or separate comment-create hook for all the apps in our workspace. 这个想法是为工作区中的所有应用程序comment-create一个或单独的comment-create挂钩。 It would receive a HTTP request on comment creation, authenticate with the Podio API, fetch the comment in question, decide whether it is spam or not, and delete it if necessary (like said, deciding what is spam is straightforward in our case). 它会收到有关注释创建的HTTP请求,使用Podio API进行身份验证,获取有问题的注释,确定是否为垃圾邮件,并在必要时将其删除(例如说,在我们的情况下,确定垃圾邮件很简单)。

I implemented this idea as a minimal Lumen API endpoint. 我将这个想法实现为最小的Lumen API端点。 On receiving the webhook request with the following JSON payload 收到带有以下JSON有效负载的webhook请求时

{
    "item_id": "yyyyyyyyy",
    "hook_id": "zzzzzzz",
    "type":"comment.create"
}

it is passed to PodioComment::get() for decisionmaking. 它被传递给PodioComment::get()进行决策。

The problem is that the delete operation [ PodioComment::delete()](https://developers.podio.com/doc/comments/delete-a-comment-22347) receives a PodioForbiddenError`, though it authenticates with token from user 𝒰. 问题是删除操作[ PodioComment::delete()](https://developers.podio.com/doc/comments/delete-a-comment-22347) receives a PodioForbiddenError`,尽管它使用来自用户的令牌进行身份验证𝒰。

The PHP stacktrace PHP堆栈跟踪

 PodioForbiddenError in Podio.php line 319 at Podio::request('DELETE', '/comment/xxxxxxxx', array()) in Podio.php line 358 at Podio::delete('/comment/xxxxxxxx') in PodioComment.php line 46 at PodioComment::delete(xxxxxxxx) in CommentController.php line 116 

What is going on here? 这里发生了什么? Am I not authenticating properly? 我不能正确认证吗? I can do other tasks, eg get comments and other Podio items, and Podio::setup() and Podio::authenticate_with_app() run succesfully, with the client ID and secret, and app id and token. 我可以执行其他任务,例如获取评论和其他Podio项,以及Podio::setup()Podio::authenticate_with_app()成功运行,并带有客户端ID和密码,以及应用程序ID和令牌。

Our current theory is that the Email to Item feature is a separate application (with it's own app_id ). 我们目前的理论是,“ 电子邮件到项目”功能是一个单独的应用程序(具有自己的app_id )。 If this is correct, how can we authenticate as that app to delete comments from it? 如果这是正确的,我们如何才能通过该应用进行身份验证以从中删除评论? If not, what else can we do to delete the spam comments? 如果没有,我们还可以删除垃圾评论吗? How can we check which permissions our custom program has for various Podio items? 我们如何检查自定义程序对各种Podio项目具有哪些权限?

Details of solutions 1. and 2. 解决方案1和2的详细信息。

Solution sketch 1. A periodic cleanup program (does not work) 解决方案草图1.定期清理程序(不起作用)

The first one (1.) of these is a PHP program was written with the Podio PHP client and was planned to run as cronjob. 其中的第一个(1.)是一个PHP程序,该程序是用Podio PHP客户端编写的,并计划作为cronjob运行。 The idea was to periodically – say every 6 hours – to authenticate, scan all items for new comments, and delete them if they are deemed spam. 这个想法是定期(例如每6个小时)进行身份验证,扫描所有项目以查找新评论,并在被视为垃圾邮件时将其删除。 This didn't work, because though the program was running on API keys of an administrator user, it didn't have permission to delete comments made by user 𝒰. 这没有用,因为尽管程序是在管理员用户的API密钥上运行的,但它无权删除用户made发表的注释。

Solution sketch 2. JavaScript program running against the DOM (works if manually supported) 解决方案草图2.针对DOM运行的JavaScript程序(在手动支持的情况下有效)

This is hack with screenscraping and automatically pressing buttons on the web UI. 这是通过抓屏并自动按下Web UI上的按钮进行的​​。

We login as the user 𝒰, navigate to their activity stream, open the browser developer tools, copy-paste the following program to the console, and go for coffee. 我们以用户login登录,导航到他们的活动流,打开浏览器开发人员工具,将以下程序复制粘贴到控制台中,然后喝咖啡。 This bypasses authentication issues of (1.) and (3.), but is cumbersome to operate and error-prone. 这绕过了(1.)和(3.)的身份验证问题,但是操作麻烦并且容易出错。

// Add the user id to remove in here. There is a good chance it is
// a six-digit number
var spamUid = 'xxxxxx';

// Consider only comments made after this date
var spamDate = new Date(2018, 04, 01);

var spamUserUrl = 'https://podio.com/users/' + spamUid;

var mnum = {
    'January': 0,
    'February': 1,
    'March': 2,
    'April': 3,
    'May': 4,
    'June': 5,
    'July': 6,
    'August': 7,
    'September': 8,
    'October': 9,
    'November': 10,
    'December': 11
}

var titleToDate = (title) => {
    re = /(\s*\d*) ([A-Za-z]*) (\d{4}) (\d*):(\d*)/;
    [, D, M, Y, h, m] = re.exec(title);
    d = new Date(Y, mnum[M], D, h, m);
    return d;
}

var throttling = 2000;

var spamComments = jQuery('.comment')
    .filter((i, c) => jQuery(c).find('.comment_byline > a')[0].href == spamUserUrl)
    .filter((i, c) => jQuery(c).find('.timestamp > time')[0].title != "")
    .filter((i, c) => titleToDate(jQuery(c).find('.timestamp > time')[0].title) > spamDate);

console.log("Found " + spamComments.length + " comments to delete");

spamComments.each((i, c) => {
    c.style.border = '5px red dotted';
    setTimeout(() => {
    console.log("deleting 💩", c);
    jQuery(c).find('.js-delete-comment').click();
    jQuery('.confirm-button')[0].click();
    }, i * throttling);
});

Please contact Podio support. 请联系Podio支持。 We have solution to stop this :) 我们有解决方案来阻止这种情况:)

For the record, we did contact Podio support and this time they were responsive and said the issue has been solved. 作为记录,我们确实联系了Podio支持,这一次他们很热心,并表示问题已解决。 I have no idea what was done on their end, but we have not received the spam messages since. 我不知道他们该如何处理,但此后我们还没有收到垃圾邮件。 Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM