Skip to content

Conversation

@aaneja
Copy link
Contributor

@aaneja aaneja commented Nov 24, 2025

Description

For controlled environments, users may want to disable the UI
The UI is enabled by default

Impact

No impact

Test Plan

  • CI
  • Manually test the UI page with the web-ui disabled
image

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

== RELEASE NOTES ==

General Changes
* Add ability to disable the UI

For controlled environments, users may want to disable the UI
(enabled by default)
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Nov 24, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 24, 2025

Reviewer's Guide

Adds a configurable server flag to enable or disable the Presto web UI and conditionally binds UI routes to either the full UI or a minimal "UI disabled" page, including configuration plumbing and tests.

Sequence diagram for handling /ui requests with configurable web UI

sequenceDiagram
    actor "User" as User
    participant "Browser" as Browser
    participant "PrestoServer" as Server
    participant "CoordinatorModule" as CoordModule
    participant "StaticResourceHandler" as StaticHandler

    User->>Browser: "Enter /ui URL"
    Browser->>Server: "HTTP GET /ui"
    Server->>CoordModule: "Resolve route for /ui"
    alt "Web UI enabled (webUIEnabled = true)"
        CoordModule->>StaticHandler: "Bind /ui to \"webapp\" resources with welcome \"index.html\""
        CoordModule->>StaticHandler: "Bind /ui/dev and /tableau when enabled"
        Server->>Browser: "Serve full UI index.html from \"webapp/index.html\""
        Browser->>User: "Display full Presto UI"
    else "Web UI disabled (webUIEnabled = false)"
        CoordModule->>StaticHandler: "Bind /ui to \"nowebapp\" resources with welcome \"index.html\""
        Server->>Browser: "Serve minimal disabled page from \"nowebapp/index.html\""
        Browser->>User: "Display message: \"The Presto UI has been disabled for this environment\""
    end
Loading

Class diagram for updated server configuration and coordinator module

classDiagram
    class ServerConfig {
        - Duration clusterStatsExpirationDuration
        - boolean nestedDataSerializationEnabled
        - Duration clusterResourceGroupStateInfoExpirationDuration
        - boolean webUIEnabled = true
        + boolean isResourceManager()
        + boolean isCoordinator()
        + boolean isCatalogServer()
        + boolean isWebUIEnabled()
        + ServerConfig setWebUIEnabled(boolean webUIEnabled)
    }

    class CoordinatorModule {
        - String DEFAULT_WEBUI_CSP
        - boolean isWebUIEnabled
        + CoordinatorModule(boolean webUIEnabled)
        + void setup(Binder binder)
        + static HttpResourceBinding webUIBinder(Binder binder, String path, String classPathResourceBase)
    }

    class ServerMainModule {
        + void configure()
    }

    ServerMainModule --> ServerConfig : reads webUIEnabled flag
    ServerMainModule --> CoordinatorModule : creates with isWebUIEnabled()
    CoordinatorModule --> HttpResourceBinding : uses for /ui route binding
Loading

File-Level Changes

Change Details Files
Introduce server configuration flag to control whether the Web UI is enabled, defaulting to enabled.
  • Add webUIEnabled boolean field with default true to server configuration
  • Expose getter and @Config-mapped setter for the new webui-enabled property
  • Update server configuration tests for default values and explicit property mappings to cover the new flag
presto-main-base/src/main/java/com/facebook/presto/server/ServerConfig.java
presto-main-base/src/test/java/com/facebook/presto/server/TestServerConfig.java
Wire the new configuration flag into coordinator startup so that UI routing depends on the flag.
  • Add an isWebUIEnabled instance field and constructor to CoordinatorModule
  • Pass serverConfig.isWebUIEnabled() when installing CoordinatorModule from ServerMainModule
presto-main/src/main/java/com/facebook/presto/server/CoordinatorModule.java
presto-main/src/main/java/com/facebook/presto/server/ServerMainModule.java
Conditionally bind web UI HTTP resources or a disabled-UI placeholder based on the flag, and add a minimal HTML page for the disabled state.
  • Guard existing /ui/dev, /ui, and /tableau resource bindings behind the isWebUIEnabled flag
  • When UI is disabled, bind /ui to a new nowebapp resource with index.html as the welcome file
  • Add a simple nowebapp/index.html page informing users that the Presto UI has been disabled
presto-main/src/main/java/com/facebook/presto/server/CoordinatorModule.java
presto-main/src/main/resources/nowebapp/index.html

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@aaneja aaneja marked this pull request as ready for review November 24, 2025 07:39
@aaneja aaneja requested a review from a team as a code owner November 24, 2025 07:39
@prestodb-ci prestodb-ci requested review from a team, auden-woolfson and xin-zhang2 and removed request for a team November 24, 2025 07:39
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Changing CoordinatorModule from a no-arg constructor to requiring a boolean may break existing code/tests that instantiate it directly; consider adding an overloaded no-arg constructor that defaults to webUIEnabled = true to preserve backward compatibility.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Changing CoordinatorModule from a no-arg constructor to requiring a boolean may break existing code/tests that instantiate it directly; consider adding an overloaded no-arg constructor that defaults to `webUIEnabled = true` to preserve backward compatibility.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@aaneja aaneja changed the title feat(server) : Add ability to disable the UI feat(server): Add ability to disable the UI Nov 24, 2025
}
else if (serverConfig.isCoordinator()) {
install(new CoordinatorModule());
install(new CoordinatorModule(serverConfig.isWebUIEnabled()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can bind ServerConfig in CoordinatorModule and check for UI config there?

 ServerConfig severConfig = buildConfigObject(ServerConfig.class);

webUIBinder(binder, "/tableau", "webapp/tableau");
}
else {
webUIBinder(binder, "/ui", "nowebapp").withWelcomeFile("index.html");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we disable /dev & /tableau as well otherwise they will have 404 when webUI is disabled

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense.

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

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants