You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Pii-Safe Compiler Plugin — FIR checker not considering Type Arguments annotated with @PiiSafe.HasPii #11570
When a data class is NOT annotated with @PiiSafe.HasPii, the FIR checker HasPiiRequiresAnnotatedPropertyChecker verifies if any of its properties are annotated with @PiiSafe.HasPii. However, it is missing checking the Type Arguments as well, leaving the following scenario prone to leaking PII:
@PiiSafe.HasPii
data class MessageAddress(
@get:PiiSafe.Mask
val value: String,
val label: String,
)
data class MessageEnvelope(
val subject: String,
val from: List<MessageAddress>,
...
)
Expected behaviour
Build should fail with the following message:
> Task :feature:mail:message:api:compileKotlinJvm FAILED
e: file:///<file-path>/MessageEnvelope.kt:22:5 This class holds a property of a type annotated @PiiSafe.HasPii; this class must also be annotated @PiiSafe.HasPii.
(In case of enabled) IDE should mark the properties whose type argument is annotated with @PiiSafe.HasPii as an error, showing the above-mentioned message
Actual behaviour
The build succeeds
No toString method is overridden if no other property type is annotated with @PiiSafe.HasPii
(In case of enabled) No IDE error
Build output:
> BUILD SUCCESSFUL
Instructions
Although this is labelled as good first issue, it involves a complex topic with not much documentation. You may need to check the Kotlin Compiler source code to succeed in this task.
This is a bug in the newly introduced Kotlin Compiler Plugin, located at library/pii-safe/compiler-plugin
You will need to change the logic inside the HasPiiRequiresAnnotatedPropertyChecker.check method to look after type arguments.
You MUST implement test cases to handle this scenario inside HasPiiRequiresAnnotatedPropertyCheckerTest
Thanks for the detailed reproduction. The expected diagnostic and the unannotated MessageEnvelope example appear to be handled by HasPiiPropagationChecker, while HasPiiRequiresAnnotatedPropertyChecker currently checks the opposite case: an already-annotated data class must contain at least one PII-bearing property.
Should this issue update only HasPiiPropagationChecker to recurse through type arguments, or should both checkers share the recursive type-argument test? I will hold off on code until that boundary is clear.
Thanks for the detailed reproduction. The expected diagnostic and the unannotated MessageEnvelope example appear to be handled by HasPiiPropagationChecker, while HasPiiRequiresAnnotatedPropertyChecker currently checks the opposite case: an already-annotated data class must contain at least one PII-bearing property.
Should this issue update only HasPiiPropagationChecker to recurse through type arguments, or should both checkers share the recursive type-argument test? I will hold off on code until that boundary is clear.
Activity
taljeon commentedon Sep 16, 2026
Thanks for the detailed reproduction. The expected diagnostic and the unannotated
MessageEnvelopeexample appear to be handled byHasPiiPropagationChecker, whileHasPiiRequiresAnnotatedPropertyCheckercurrently checks the opposite case: an already-annotated data class must contain at least one PII-bearing property.Should this issue update only
HasPiiPropagationCheckerto recurse through type arguments, or should both checkers share the recursive type-argument test? I will hold off on code until that boundary is clear.rafaeltonholo commentedon Sep 16, 2026
I would say both