Kord-Extensions/kord-extensions

Phishing check errors in DMs

Closed this issue ยท 7 comments

Description

Provide a detailed description of the problem here. Some questions you can
ask yourself are:

  • What were you doing when you first noticed the problem?
  1. An error popped up on our sentry log, relating to class cast exceptions of DMChannel -> GuildChannel failing
  2. A NullPointerException throws when a known phishing domain is sent in DMs.
    The above are seperate errors.

Versions

If it makes sense for your report, please provide information on the following:

  • Names and versions of any implicated dependencies: KordEx 1.5.4-SNAPSHOT
  • Editor name and version: IntelliJ 2022.1.2
  • Gradle version: 7.4.2-bin
  • JDK distribution, version and architecture: OpenJDK 17.0.3+7
  • Kotlin distribution and plugin version: 1.6.10

If you're working directly with our projects, then you only need to specify versions
for things that differ from what's already part of the project, or are not part of it.

Reproduction

Error 1 I have not been able to reproduce
For error 2, send a known phishing domain to the Bot in DMs to discover the error.

Error 1

java.lang.ClassCastException: class dev.kord.core.entity.channel.DmChannel cannot be cast to class dev.kord.core.entity.channel.GuildChannel (dev.kord.core.entity.channel.DmChannel and dev.kord.core.entity.channel.GuildChannel are in unnamed module of loader 'app')
    at dev.kord.core.entity.Message.getGuild(Message.kt:405)
    at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension$handleMessage$3.invokeSuspend(PhishingExtension.kt:176)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
    at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
    at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
    at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
    at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
    at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
    at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
    at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
    at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
    at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
    at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
    at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
    at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
    at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
    at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

Error 2

16-06-2022 10:44:46 | DefaultDispatcher-worker-3     | ERROR | c.k.kord.extensions.events.EventHandler  | Error during execution of event handler (MessageCreateEvent)
java.lang.NullPointerException: null
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension.handleMessage$extra_phishing(PhishingExtension.kt:195)
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension$setup$2$5.invokeSuspend(PhishingExtension.kt:77)
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension$setup$2$5.invoke(PhishingExtension.kt)
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension$setup$2$5.invoke(PhishingExtension.kt)
	at com.kotlindiscord.kord.extensions.events.EventHandler.call(EventHandler.kt:210)
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension$setup$$inlined$event$2$1.invokeSuspend(ExtensibleBot.kt:433)
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension$setup$$inlined$event$2$1.invoke(ExtensibleBot.kt)
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension$setup$$inlined$event$2$1.invoke(ExtensibleBot.kt)
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension$setup$$inlined$event$2$3$1.invokeSuspend(ExtensibleBot.kt:271)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

On top of the above listed errors, another one has arisen:

18-06-2022 12:08:13 | DefaultDispatcher-worker-18    | ERROR | c.k.kord.extensions.events.EventHandler  | Error during execution of event handler (MessageUpdateEvent)
org.jsoup.HttpStatusException: HTTP error fetching URL. Status=500, URL=[https://github.com/replaceitem/carpet-discarpet/blob/master/docs/Full.md#__on_system_messagetexttype]
	at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:890)
	at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:829)
	at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:366)
	at org.jsoup.helper.HttpConnection.get(HttpConnection.java:353)
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension.followRedirects$extra_phishing(PhishingExtension.kt:341)
	at com.kotlindiscord.kord.extensions.modules.extra.phishing.PhishingExtension$followRedirects$1.invokeSuspend(PhishingExtension.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)

That's a HTTP 500 from the URL being checked and has nothing to do with us.

This should be solved, I think - please confirm at some point.

That's a HTTP 500 from the URL being checked and has nothing to do with us.

Ah, alright!

This should be solved, I think - please confirm at some point.

I'll update our dependency later and see if comes up ๐Ÿ‘๐Ÿผ

The solution was just to fix existing checks by the way, it should never have triggered in a DM

๐Ÿ‘๐Ÿผ I saw the commit. I'll check later

Seems to be fix, thanks for the work ๐Ÿ‘๐Ÿผ