Kotlin not being obfuscated
sky-starver opened this issue · comments
I just tried kotlin and I notice it can co exists with java code in Intellij,it can really speed up the development, but there is one security problem because kotlin file is not being obfuscated by yguard
Here is the resulting jar code after I add a kotlin code in my java obfuscated project
public final class Test public constructor() {
public final var num0: kotlin.Int /* compiled code */
public final var num1: kotlin.Int /* compiled code */
public final var num2: kotlin.Int /* compiled code */
public final fun add(): kotlin.Int { /* compiled code */ }
public final fun test(): kotlin.Unit { /* compiled code */ }
}
There is also this metadata problem
@Metadata(
mv = {1, 4, 0},
bv = {1, 0, 3},
k = 1,
d1 ={""},
d2 = {"Lcom/path/to/Test;", "", "()V", "num0", "", "getNum0", "()I", "setNum0", "(I)V", "num1", "getNum1", "setNum1", "num2", "getNum2", "setNum2", "add", "test", "", "ProjectName"}
)
My unobfuscated class
class Test
{
var num1=0
var num0=0
var num2=2
fun test()
{
println("broom broom skrrrrrrt")
}
fun add() : Int
{
return num1+num2
}
}
Any help is much appreciated.
Yes, no, maybe!?
Are you saying that the obfuscation could be better or is something broken after obfuscation?
I am not familiar with Kotlin's bytecode and specifically the meta-data.
Can you please elaborate on "the problem"?
And ideally if you would want to see this improvement, it would be awesome if you could collect relevant information on how Kotlin "works" and what changes would need to be implemented in yGuard in order to support Kotlin.
That said, unless yGuard breaks class files, this is probably not a bug, but a missing feature support for Kotlin.
Pull-requests that implement this would be welcome.
It's documented that you cannot currently obfuscate Kotlin code. Please read the documentation here: https://yworks.github.io/yGuard/compatibility/#compatibility-to-3rd-party-jvm
Hello guys thank you for helping me. I have found a workaround for this matter. I hope I can help future reader of this thread. Firstly in Intellij you should obfuscate your jar then after that use proguard gui(I use proguard version 7.1.0-beta1 sourceforge.net) to obfuscated again the code so that the metadata will be gone and the kotlin code will also be obfuscated to a java class.