Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spam Filter Allows New Type of Spam #160

Closed
MissiaL opened this issue Oct 24, 2024 · 16 comments
Closed

Spam Filter Allows New Type of Spam #160

MissiaL opened this issue Oct 24, 2024 · 16 comments

Comments

@MissiaL
Copy link

MissiaL commented Oct 24, 2024

In the last two days, a message has been sent to the chat
image
image
This message is not filtered in any way. Even if this message is sent to the admin filter chat

It turns out that this message is a story message.
image

I have logged this message:

tg-spam  | 2024/10/24 23:53:13.966 [DEBUG] {events/listener.go:271 events.(*TelegramListener).procEvents} {"message_id":237049,"from":{"id":8063614708,"first_name":"TON"},"date":1729803193,"chat":{"id":-1001366657637,"type":"supergroup","title":"ЖК life Варшавская","username":"LifeVarshavskaya","photo":null,"location":null},"message_auto_delete_timer_changed":null,"proximity_alert_triggered":null,"voice_chat_scheduled":null,"voice_chat_started":null,"voice_chat_ended":null,"voice_chat_participants_invited":null}

Most likely, you do not have a filter set up for this type of message

I can send you a sample of this message. If it's not too much trouble, write to me in telegram https://t.me/PetrAlexeev

@umputun
Copy link
Owner

umputun commented Oct 24, 2024

have you tired to turn on "image-only" check?

--meta.image-only enable image only check [$META_IMAGE_ONLY]

@MissiaL
Copy link
Author

MissiaL commented Oct 24, 2024

Yes

@umputun
Copy link
Owner

umputun commented Oct 24, 2024

Yes, and? I would guess it didn't help?

If this is the case, I would need some examples of those messages, as I have never seen them in real life and am not sure what all of this is about. Feel free to forward one of those to my TG (umputun).

umputun added a commit that referenced this issue Oct 27, 2024
@umputun
Copy link
Owner

umputun commented Oct 27, 2024

@paskal any bright ideas? This message is somewhat different, but in the log line provided above, I see nothing that indicates it. The version of github.com/go-telegram-bot-api/telegram-bot-api/v5 is the latest and greatest.

@dsent
Copy link

dsent commented Nov 1, 2024

We started to get more and more spam consisting of videos in a circle (Telegram video messages).
Might make sense to add a check for video messages, and a check for audio messages, in a way similar to image-only check.

@mendelgusmao
Copy link

@paskal any bright ideas? This message is somewhat different, but in the log line provided above, I see nothing that indicates it. The version of github.com/go-telegram-bot-api/telegram-bot-api/v5 is the latest and greatest.

I'm guessing the current version of tbapi is not reading some extra fields that contain the data of this new kind of message

Debugging the payload directly from tbapi can probably provide some guidance

@mendelgusmao
Copy link

mendelgusmao commented Nov 13, 2024

Enabled TG_DEBUG and got:

2024/11/13 11:31:56 Endpoint: getUpdates, response:
{
    "ok": true,
    "result": [
        {
            "update_id": 216000996,
            "message": {
                "message_id": 79360,
                "from": {
                    "id": 5506232953,
                    "is_bot": false,
                    "first_name": "DOGS",
                    "username": "bosstheq"
                },
                "chat": ...,
                "date": 1731508316,
                "story": {
                    "chat": {
                        "id": -1002294442742,
                        "title": "DOGS🦴🐾",
                        "username": "dogscreeee",
                        "type": "channel"
                    },
                    "id": 1
                }
            }
        }
    ]
}

Noticed that the JSON payload has in fact a new field named story that isn't implemented in the tbapi.Message type.

Also, the latest go-telegram-bot-api/telegram-bot-api release is from 2021. The project is clearly not actively maintained and is not catching up with the protocol updates.

I think that the fastest way to deal with this type of spam is:

  • find a fork go-telegram-bot-api/telegram-bot-api that supports the story field
  • forking and adding it should do, as well
  • extend the spam check for the story contents

And then proceed to move from go-telegram-bot-api/telegram-bot-api to a better maintained lib.
There are some suggestions in go-telegram-bot-api/telegram-bot-api#755.

What are your thoughts, @umputun?

@paskal
Copy link
Collaborator

paskal commented Nov 14, 2024

Maybe this one will do: https://github.com/OvyFlash/telegram-bot-api/blob/master/types.go#L556-L629

I'll look into adopting this library.

@dsent
Copy link

dsent commented Nov 14, 2024

Enabling META_VIDEO_ONLY check doesn't stop circle videos from being sent.

@dsent
Copy link

dsent commented Nov 14, 2024

Also, please see #176

@umputun
Copy link
Owner

umputun commented Nov 15, 2024

Maybe this one will do: https://github.com/OvyFlash/telegram-bot-api/blob/master/types.go#L556-L629

I'll look into adopting this library.

This fork is conceptually close to the original code, but it is not compatible on multiple levels. I have tried to adopt it, and it seems possible; however, all the parts communicating with this library should be carefully adjusted.

@umputun
Copy link
Owner

umputun commented Nov 15, 2024

@paskal what do you think about forking the lib and adding new types of messages without breaking compatibility? To me it sounds like a simplest solution

@paskal
Copy link
Collaborator

paskal commented Nov 18, 2024

I've seen too many abandoned Telegram libraries for go the path creating another one. Today it's stories and tomorrow with the new API release it would be something else: I would prefer just staying on some up-to-date library.

Let me give migration a try.

@negasus
Copy link

negasus commented Nov 20, 2024

I try to keep my library always up to date. You can try https://github.com/go-telegram/bot ;)

@paskal
Copy link
Collaborator

paskal commented Nov 24, 2024

#180 switches to https://github.com/OvyFlash/telegram-bot-api/, it will be merged soon.
Does someone want to follow it up and add detection for the new type of spam?

@umputun
Copy link
Owner

umputun commented Dec 14, 2024

after the last merge the detection should be working as a part of video-only meta-check

@umputun umputun closed this as completed Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants