← Back to Pull requests

[ZEPPELIN-6366] Separate WebSocket max message size into a dedicated REST API #5099

Merged
seung-00 merged 11 files (121 lines) on Jan 22, 2026 06:49 UTC
View on GitHub
seung-00 seung-00 commented on Oct 08, 2025 09:52 UTC
Author

What is this PR for?


Currently, configuration data is fetched through both REST API and WebSocket channels. However, the WebSocket path does not perform permission checks, and the only required data from it is the WebSocket max message size.

I extracted the websocket max message size field into a dedicated REST API, to improve security and simplify configuration handling.

What type of PR is it?


Improvement

Todos


[ ] #5060

What is the Jira issue?


Open an issue on Jira https://issues.apache.org/jira/browse/ZEPPELIN/6366

How should this be tested?


  • Check the configuration page (/configuration)

  • Check the notebook page (/notebook/{notebook_id})
  • Screenshots (if appropriate)

    Questions:


    Does the license files need to update? N
    Is there breaking changes for older versions? Y
  • Does this needs documentation? N
  • Diff: 121 lines (+82 / -39) across 11 files Reviewer: tbonelee Review duration: 152456m
    All Vouch review confidence checks passed
    Residual risk 0.12 = Change Risk (0.46) × (1 − Review Confidence (0.74)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 121 lines diff across 11 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.48 · 5 substantive comment(s)
    0.48
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    73%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.287
    Real PR Conversation Timeline
    27 items
    tbonelee tbonelee commented on code on Oct 08, 2025 11:23 UTC
    Code Review
    zeppelin-web-angular/src/app/services/configuration.service.ts:1
    @@ -13,18 +13,33 @@
     import { HttpClient } from '@angular/common/http';
     import { Injectable } from '@angular/core';
     
    +import { retry } from 'rxjs/operators';

    Perhaps we could remove this.

    tbonelee tbonelee requested changes on Oct 08, 2025 11:23 UTC
    Changes Requested Reviewer

    Requested changes.

    seung-00 seung-00 commented on code on Oct 08, 2025 13:06 UTC
    Code Review
    zeppelin-web-angular/src/app/services/configuration.service.ts:1
    @@ -13,18 +13,33 @@
     import { HttpClient } from '@angular/common/http';
     import { Injectable } from '@angular/core';
     
    +import { retry } from 'rxjs/operators';

    @tbonelee
    Thanks, I've removed.

    Reamer Reamer commented on Oct 08, 2025 19:43 UTC
    Contributor

    I don't know if we should also adapt zeppelin-web? What do you think?

    tbonelee tbonelee commented on Oct 09, 2025 08:23 UTC
    Contributor

    @Reamer Looks reasonable for zeppelin-web too. Are there specific concerns you’re considering, such as maintenance or behavior differences?

    tbonelee tbonelee commented on Oct 09, 2025 08:41 UTC
    Contributor

    @seung-00
    (If we also apply this to zeppelin-web.)
    There is a failing test in zeppelin-integration(test-selenium-with-spark-module-for-spark-3-5 CI job).
    After a quick note: in zeppelin-web's NoteImportCtrl, wsMaxMessageSize is called even when the user is not logged in.
    The server then returns a 302 redirect to /api/login (shiro.loginUrl). When the login API responds with 405, the HTTP interceptor emits session_logout (https://github.com/apache/zeppelin/blob/f1f671394dc742ec35ede32be039850cdf8a1145/zeppelin-web/src/app/app.js#L170). The login controller listens for session_logout and programmatically clicks the login button (.nav-login-btn).
    As a result, the login modal pops up immediately when the window opens, which is different from before, and the integration test fails.

    It looks like we should change this to issue the API request only when the user is authenticated, or defer it until the moment it is actually needed.

    Reamer Reamer commented on Oct 09, 2025 11:44 UTC
    Contributor

    @Reamer Looks reasonable for zeppelin-web too. Are there specific concerns you’re considering, such as maintenance or behavior differences?

    Yes both. All frontends should use the same interfaces. This makes it easier to remove things later on.

    seung-00 seung-00 commented on Oct 12, 2025 10:46 UTC
    Author

    @Reamer
    In this case I applied it to both, as you mentioned, to make it easier to remove unreferenced things later on.
    But I don’t think we need to do that for every task. Covering both sides would be a bit tricky, since the front-end codebases are quite different.

    @tbonelee
    I fixed the issue you mentioned.
    If the CI failed due to the login modal, I think the CI job might need to be adjusted instead, because the wsMaxMessageSize API doesn’t require authentication.
    However, I found that wsMaxMessageSize was being called and cached initially (same as before), but the field only needed in specific cases (e.g., exporting/importing note). So I modified it to be called only when required, now the CI error no longer occurs.

    BTW, if the user isn’t logged in initially, showing the login modal seems more natural. 🤔

    seung-00 seung-00 commented on code on Oct 12, 2025 10:49 UTC
    Code Review
    zeppelin-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java:1
    @@ -334,6 +334,7 @@ void testAngularRunParagraph() throws Exception {
     
           // Click on 1 paragraph to trigger z.runParagraph() function
     
    +      ZeppelinITUtils.sleep(1000, false);

    I added a sleep because the test was failing intermittently.

    tbonelee tbonelee commented on code on Oct 14, 2025 17:25 UTC
    Code Review
    zeppelin-web-angular/src/app/app.module.ts:1
    @@ -13,7 +13,7 @@
     import { registerLocaleData } from '@angular/common';
     import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
     import en from '@angular/common/locales/en';
    -import { NgModule } from '@angular/core';
    +import { APP_INITIALIZER, NgModule } from '@angular/core';

    import { NgModule } from '@angular/core';
    

    tbonelee tbonelee commented on code on Oct 14, 2025 17:25 UTC
    Code Review
    zeppelin-web-angular/src/app/app.module.ts:1
    @@ -26,7 +26,7 @@ import { NzNotificationService } from 'ng-zorro-antd/notification';
     
     import { MESSAGE_INTERCEPTOR, TRASH_FOLDER_ID_TOKEN } from '@zeppelin/interfaces';
     import { loadMonacoBefore } from '@zeppelin/languages';
    -import { TicketService } from '@zeppelin/services';
    +import { ConfigurationService, TicketService } from '@zeppelin/services';

    import { TicketService } from '@zeppelin/services';
    

    tbonelee tbonelee requested changes on Oct 14, 2025 17:26 UTC
    Changes Requested Reviewer

    Everything seems right but the unused imports should be removed.

    tbonelee tbonelee commented on Oct 15, 2025 04:32 UTC
    Reviewer

    LGTM. I also agree with showing a login modal when authentication is required. Maybe we could address that in another issue.

    Reamer Reamer commented on code on Oct 15, 2025 07:05 UTC
    Code Review
    zeppelin-server/src/main/java/org/apache/zeppelin/rest/ConfigurationsRestApi.java:1
    @@ -32,7 +32,7 @@
     import org.apache.zeppelin.service.AuthenticationService;
     
     /** Configurations Rest API Endpoint. */
    -@Path("/configurations")

    You have changed the path of the API class here. Probably so that the call is /api/wsMaxMessageSize. However, I also think /api/configurations/wsMaxMessageSize is very good and would prefer this API endpoint.

    Reamer Reamer requested changes on Oct 15, 2025 07:06 UTC
    Changes Requested Reviewer

    But I don’t think we need to do that for every task. Covering both sides would be a bit tricky, since the front-end codebases are quite different.

    Sooner or later, we should send the old front end into well-deserved retirement. In my opinion, sooner rather than later.

    seung-00 seung-00 commented on code on Oct 15, 2025 10:53 UTC
    Code Review
    zeppelin-server/src/main/java/org/apache/zeppelin/rest/ConfigurationsRestApi.java:1
    @@ -32,7 +32,7 @@
     import org.apache.zeppelin.service.AuthenticationService;
     
     /** Configurations Rest API Endpoint. */
    -@Path("/configurations")

    @Reamer
    I also think the path you mentioned looks good. However, since the authentication referenced in shiro.ini appears to be set up based on the /configuration path, I excluded /configurations from the path. The wsMaxMessageSize API is intended to be a non-authenticated API.

    Please feel free to let me know if you have any other suggestions. 🤔

    seung-00 seung-00 commented on code on Oct 31, 2025 04:35 UTC
    Code Review
    zeppelin-server/src/main/java/org/apache/zeppelin/rest/ConfigurationsRestApi.java:1
    @@ -32,7 +32,7 @@
     import org.apache.zeppelin.service.AuthenticationService;
     
     /** Configurations Rest API Endpoint. */
    -@Path("/configurations")

    @Reamer
    Would you mind taking a look at this?
    The issue this PR addresses, configuration data being accessible via WebSocket without a permission check because of the wsMaxMessageSize field, seems to be a clear problem that needs to be fixed.

    Reamer Reamer commented on code on Nov 03, 2025 09:18 UTC
    Code Review
    zeppelin-server/src/main/java/org/apache/zeppelin/rest/ConfigurationsRestApi.java:1
    @@ -32,7 +32,7 @@
     import org.apache.zeppelin.service.AuthenticationService;
     
     /** Configurations Rest API Endpoint. */
    -@Path("/configurations")

    Hi @seung-00 ,
    Thank you for bringing this issue to my attention again.

    As I see it, we have the following options.

    1) We include the path /api/configurations/wsMaxMessageSize in shiro.ini and give unauthenticated users the right to call this endpoint.
    This would be a breaking change.
    2) We add a new path, but it would also have to contain something related to configuration in the path, e.g., /api/configuration/wsMaxMessageSize (without s). The entire API endpoint would then also have to be mapped to a new class.
    The shiro.ini would also have to be adjusted here, and that would also be a breaking change.

    What bothers me about 1) is that potentially new frontend configuration options would also have to be added to the shiro.ini.
    What bothers me about 2) is that it's quite confusing, but you probably only need to adjust the shiro.ini once.

    What do you think about creating a general endpoint for frontend configurations? With this pull request, it's wsMaxMessageSize, tomorrow it might be something else. Then you could build the whole thing in the ConfigurationsRestApi and use frontend-config or something else as the endpoint path. You would only have to adjust shiro.ini once and extend the map that the endpoint returns.

    Either way, this change would be a breaking change, since the shiro.ini, for example, is very variable.
    See: https://github.com/apache/zeppelin/blob/master/conf/shiro.ini.template#L129-L130

    seung-00 seung-00 commented on Jan 01, 2026 14:17 UTC
    Author

    @Reamer @tbonelee
    As Reamer suggested, I changed the endpoint to a general configuration API for the frontend. As a result, this PR includes a breaking change in shiro.ini.template.
    Thanks for great suggestions and sorry for the one-year delay.

    tbonelee tbonelee commented on code on Jan 04, 2026 10:33 UTC
    Code Review
    zeppelin-web/src/components/note-import/note-import.controller.js:1

    We should set $scope.maxLimit value to tell users the max file size.

    <img width="557" height="446" alt="Image" src="https://github.com/user-attachments/assets/b44e9401-c5c7-43c1-a8dc-43a3c557938e" />

    tbonelee tbonelee requested changes on Jan 04, 2026 10:33 UTC
    Changes Requested Reviewer

    Requested changes.

    seung-00 seung-00 commented on code on Jan 17, 2026 09:45 UTC
    Code Review
    zeppelin-web/src/components/note-import/note-import.controller.js:1

    @tbonelee
    Thanks for the comment. I’ve updated this part.

    tbonelee tbonelee approved these changes on Jan 18, 2026 14:08 UTC
    Approved Reviewer

    Approved these changes.

    seung-00 seung-00 commented on Jan 18, 2026 14:39 UTC
    Author

    @Reamer
    Could you review it again?

    Reamer Reamer approved these changes on Jan 18, 2026 19:05 UTC
    Approved Reviewer

    The backend part looks good.

    tbonelee tbonelee commented on Jan 22, 2026 06:54 UTC
    Contributor

    Thanks for your work. I merged this PR into the master branch only, since it introduces a breaking change to the authorization behavior.

    Reviewers
    Assignees
    seung-00 seung-00
    Labels
    risk: low confidence: 73.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 46.4% (MEDIUM) · Higher = larger blast radius
    46.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 73.9% · Lower = rushed or shallow review
    73.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 12.1% · Safe to merge
    12.1%