Skip to content

Idea: have MS post into CHQ when TP feedback is first received on a domain

Jeff Schaller edited this page Nov 13, 2024 · 8 revisions
  1. new spam domain is seen in a post (spam.example.com)
  2. TP feedback is given, making spam.example.com be 1/0/0
  3. IIF (one of the domains) in the now-TP post is 1/0/0 (could consider 1+/0/0, but those have higher odds of being watched already), post a message into CHQ saying: "at least one domain in [MS link] is now 1/0/0 in MS; consider adding watches". Or append a string to the existing message: ... tpu- feedback received on [[MS](https://metasmoke.erwaysoftware.com/post/####)] [title](on-site link) + ; new spam domain(s) seen

Complications:

  • when is it officially TP? 2 feedbacks? Are we OK with 1 "TP" feedback triggering this? Is it 0/0/0 (or even known) when feedback is given?
  • do we bother checking to see if it's already been watched?
    • maybe it was a reason in the post; that might be easy
    • either way, no harm in attempting a new watch
  • do we try to de-regex the domain? is there already a function for this? basically: escaping the periods.
  • do we assume there's just one new domain? more generally, should loop through any/all, but then the chat message might become too long (think of "gold mine" posts with 20 new domains)

Info:

Subroutine:

  def send_to_chat
    return if chat_user_id.present?
    return if Feedback.where(post: post).where('feedback_type LIKE ?', "#{feedback_type[0]}%").where.not(id: id).exists?

    message = "#{feedback_type} feedback received"
    host = 'metasmoke.erwaysoftware.com'
    link = url_helpers.url_for controller: :posts, action: :show, id: post.id, host: host, protocol: 'https'
    message += " on \\[[MS](#{link})] [#{SmokeDetectorsHelper.escape_markdown post.title}‭](#{post.link})"
    ActionCable.server.broadcast 'smokedetector_messages', message: message
  end

Also: report a 5+/0/0 domain that isn't blacklisted.