Skip to content

fix(lint): restrict data-plan detector to known event builder types - #817

Open
nickolas-dimitrakas wants to merge 3 commits into
mainfrom
fix/dataplan-lint-reflection-allowlist
Open

nickolas-dimitrakas wants to merge 3 commits into
mainfrom
fix/dataplan-lint-reflection-allowlist

Conversation

@nickolas-dimitrakas

@nickolas-dimitrakas nickolas-dimitrakas commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Background

The Data Plan lint detector evaluates MPEvent.Builder/CommerceEvent.Builder calls found in analyzed source to check them against a data plan. This change tightens what it's allowed to touch while doing that evaluation.

What Has Changed

  • Restrict the detector's expression evaluation to an explicit allowlist of mParticle event/commerce builder types.
  • Add a bounded recursion depth to expression resolution.

Screenshots/Video

N/A — lint tooling change, no UI.

Checklist

  • Self-review completed
  • Tests added
  • Tested locally

Additional Notes

  • ./gradlew :tooling:custom-lint-rules:test and :tooling:custom-lint-rules:ktlintCheck pass.
  • New regression tests in DataplanDetectorTest confirm the allowlist is enforced and that a normal builder chain still resolves as before.

🤖 Generated with Claude Code

…ents

DataplanDetector resolved MPEvent.Builder/CommerceEvent.Builder chains
via unrestricted reflection (Class.forName/newInstance/invoke) driven
by class and method names found in the analyzed project's own source,
including anything reachable through a local variable's initializer
chain. Restrict resolution to an explicit allowlist of the mParticle
DTO/builder types this detector actually needs, and bound expression
resolution depth so an unrelated failure mode can't escape the
existing exception handling as a stack overflow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@nickolas-dimitrakas
nickolas-dimitrakas requested a review from a team as a code owner September 17, 2026 14:35
@cursor

cursor Bot commented Sep 17, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are isolated to compile-time custom lint tooling to safeguard against unsafe reflective execution during static analysis.

Overview
Restricts reflective evaluation in custom lint rules to an explicit allowlist of supported mParticle and collection types. This prevents the Data Plan detector from reflectively executing arbitrary code or side effects discovered in analyzed source files.

Adds depth protection to expression resolution. Call chain evaluations in Constructor, MethodCall, and StaticFactory are now bounded by ResolutionGuard to prevent unbounded recursion and uncatchable stack overflows.

Reviewed by Cursor Bugbot for commit 67937d6. Bugbot is set up for automated code reviews on this repo. Configure here.

nickolas-dimitrakas and others added 2 commits September 17, 2026 10:35
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Nickolas Dimitrakas <nickolas.dimitrakas@rokt.com>
@github-actions

Copy link
Copy Markdown

📦 SDK Size Impact Report

What the SDK adds to a minified release APK.

Measured against an empty baseline app. Unlike the Rokt kit, android-core ships no Compose and no resources, so there is nothing here that a host app would already provide.

mParticle Core SDK

Metric Target branch This PR Change
APK size 119.76 KB 119.75 KB -7 bytes
Download size 117.58 KB 117.57 KB -7 bytes
Dex bytes 213.75 KB 213.75 KB 0 bytes

➡️ SDK size impact change is minimal.

Raw measurements

Target branch:

{"baseline_dex_bytes": 0, "baseline_download_bytes": 2513, "baseline_install_bytes": 7529, "core_dex_bytes": 218884, "core_download_bytes": 122911, "core_install_bytes": 130161}

This PR:

{"baseline_dex_bytes": 0, "baseline_download_bytes": 2517, "baseline_install_bytes": 7534, "core_dex_bytes": 218884, "core_download_bytes": 122908, "core_install_bytes": 130159}

Measured 67937d6 merged into 38bf857

@nickolas-dimitrakas nickolas-dimitrakas self-assigned this Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant