aafanasev / sekret

Kotlin compiler plugin to hide secret data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@Secret is not working when data class has a subclass

mkopylec opened this issue · comments

This:

abstract class Base(@Secret open val secret: String)

data class Specific(
    @Secret override val secret: String,
    @Secret val other: String
) : Base(secret)

fun main() {
    println(Specific("secret value", "other value"))
}

prints:

Specific(secret=secret value, other=***)

but should print:

Specific(secret=***, other=***)

Thanks for reporting. The thing is override val secret: String gets compiled to getSecret(): String. And functions are not supported by Sekret. I'll add it in the next version.

Meanwhile, as a workaround I'd suggest you to rename the property and remove override as:

data class Specific(
    @Secret val str: String,
    @Secret val other: String
) : Base(str)

Great, I'm waiting for the next version then.

Try out 0.0.8 version.

Still not working :(
Tried 0.0.9

@mkopylec please try again 0.0.10 version. I forgot to update dependencies.

There is no such version on maven repo:

Execution failed for task ':login-service:kaptGenerateStubsKotlin'.
> Could not resolve all files for configuration ':login-service:kotlinCompilerPluginClasspath'.
   > Could not find dev.afanasev:sekret-kotlin-plugin:0.0.10.

Any update here?

Blocked by #19

The fix is ready but jcenter is deprecated. Therefore, I've uploaded to mavenCentral (https://search.maven.org/artifact/net.afanasev/sekret-annotation).

Once my gradle (https://plugins.gradle.org/plugin/net.afanasev.sekret) plugin gets approved I'll update README as there is breaking changes.

Great, I'm waiting for it.

It works, thanks