Skip to content

[CDAP-21211] Authenticate Preview Runner to Preview Manager communication done via CDAP Messaging Service - #16052

Merged
sidhdirenge merged 1 commit into
developfrom
sidhdirenge-preview-part2
Oct 9, 2025
Merged

[CDAP-21211] Authenticate Preview Runner to Preview Manager communication done via CDAP Messaging Service#16052
sidhdirenge merged 1 commit into
developfrom
sidhdirenge-preview-part2

Conversation

@sidhdirenge

@sidhdirenge sidhdirenge commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

This change authenticates messages sent from a PreviewRunner to the PreviewManager to ensure a runner can only update its own assigned preview run.

Key Changes:

  • Enhanced PreviewRequestPollerInfo: A secretToken field has been added to act as a session password. This is generated in PreviewRunnerTwillRunnable at the start of the runner's lifecycle
  • Authenticated Messages: The serialized PreviewRequestPollerInfo (as publisherInfo) is now attached to every PreviewMessage sent from the runner.
  • Strict Validation: The PreviewDataSubscriberService now validates the publisherInfo in every message against the record in the PreviewStore. A mismatch results in message rejection and termination of the offending runner

Guice Dependency Issue:

To accommodate differences between distributed and non-distributed modes, the following design was used to propagate the pollerInfo.

The Challenge: The pollerInfo (with the secretToken) is generated only in the distributed environment within PreviewRunnerTwillRunnable. However, it's needed by generic components like PreviewMessage(which stores the runner info now) to create the DefaultPreviewRunner and DefaultDataTracer which are created without direct knowledge of the distributed-only class.

The Solution: To decouple the components, the publisherInfo is not injected at construction. Instead, it's set explicitly at runtime (e.g., during the startPreview call), allowing the generic components to support both modes while enabling the new authentication mechanism in the distributed environment.

Testing:

  • Quickstart pipeline run
  • One runner tries to update preview run associated to different runner
image
  • Secret token is different for the same runner
image
  • Unit tests validating cdap sandbox preview run

@sidhdirenge sidhdirenge added the build Triggers github actions build label Sep 26, 2025
Base automatically changed from sidhdirenge-preview-part1 to develop September 29, 2025 09:42
@sidhdirenge
sidhdirenge marked this pull request as ready for review September 29, 2025 09:42
@sidhdirenge sidhdirenge changed the title initial commit [CDAP-21211] Authenticate Preview Runner to Preview Manager communication done via CDAP Messaging Service Sep 29, 2025
@sidhdirenge
sidhdirenge force-pushed the sidhdirenge-preview-part2 branch 3 times, most recently from 327126c to 5df70f7 Compare October 3, 2025 07:51
Comment thread cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewJob.java Outdated
@sidhdirenge
sidhdirenge requested a review from vsethi09 October 8, 2025 09:03
@sidhdirenge
sidhdirenge requested a review from vsethi09 October 9, 2025 06:06
@sidhdirenge
sidhdirenge force-pushed the sidhdirenge-preview-part2 branch from 87d7dc1 to 4ee37b0 Compare October 9, 2025 13:26
@sidhdirenge
sidhdirenge merged commit 8d12ec7 into develop Oct 9, 2025
12 of 13 checks passed
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2025

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
27.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Triggers github actions build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants