Skip to content

[BUG] Pii-Safe Compiler Plugin — FIR checker not considering Type Arguments annotated with @PiiSafe.HasPii #11570

Closed

Description

@rafaeltonholo

Description

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

  1. 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.
    
  2. (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

  1. The build succeeds
  2. No toString method is overridden if no other property type is annotated with @PiiSafe.HasPii
  3. (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

Activity

  1. added
    good first issue
    on Sep 16, 2026
  2. taljeon commented on Sep 16, 2026

    @taljeon
    Contributor

    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.

  3. rafaeltonholo commented on Sep 16, 2026

    @rafaeltonholo
    ContributorAuthor

    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.

    I would say both

  4. moved this from Backlog to In Review in Thunderbird for Android - Sprintson Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issue

Type

Fields

Estimate

2

Priority

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions