Skip to content

Conversation

rschlussel
Copy link

The jetty 12 upgrade includes stricter enforcement of http compliance violations. Users may want to allow certain violations while their clients adapt to the new requirements.

@rschlussel rschlussel requested a review from a team as a code owner September 11, 2025 21:17
Copy link

sourcery-ai bot commented Sep 11, 2025

Reviewer's Guide

Introduces a new HTTP compliance violation configuration by defining an enum, extending server config to parse and expose a CSV-based property, applying custom Jetty violations in the server builder, and updating tests to cover defaults and explicit mappings.

Sequence diagram for applying custom HTTP compliance violations during server startup

sequenceDiagram
    participant "HttpServer"
    participant "HttpServerConfig"
    participant "HttpComplianceViolation"
    participant "Jetty HttpConfiguration"
    "HttpServer"->>"HttpServerConfig": getHttpComplianceViolations()
    alt Violations configured
        "HttpServerConfig"->>"HttpComplianceViolation": map to Jetty Violation
        "HttpServer"->>"Jetty HttpConfiguration": setHttpCompliance(customViolations)
    else No violations
        "HttpServer"->>"Jetty HttpConfiguration": setHttpCompliance(default)
    end
Loading

Class diagram for new and updated HTTP compliance configuration types

classDiagram
    class HttpServerConfig {
        - String secureRandomAlgorithm
        - List<String> includedCipherSuites
        - UriCompliance uriCompliance
        - List<HttpComplianceViolation> httpComplianceViolations
        + HttpServerConfig setHttpComplianceViolations(String httpComplianceViolations)
        + List<HttpComplianceViolation> getHttpComplianceViolations()
    }
    class HttpComplianceViolation {
        <<enum>>
        + getHttpComplianceViolation()
        - HttpCompliance.Violation httpComplianceViolation
    }
    HttpServerConfig --> "*" HttpComplianceViolation
Loading

Class diagram for HttpServer applying custom HTTP compliance violations

classDiagram
    class HttpServer {
        + HttpServer(HttpServerInfo httpServerInfo, ...)
    }
    class HttpServerConfig {
        + List<HttpComplianceViolation> getHttpComplianceViolations()
    }
    class HttpComplianceViolation {
        + getHttpComplianceViolation()
    }
    HttpServer --> HttpServerConfig
    HttpServerConfig --> "*" HttpComplianceViolation
Loading

File-Level Changes

Change Details Files
Extend HttpServerConfig with a new CSV-based httpComplianceViolations property
  • Added List field for storing allowed violations
  • Implemented @config setter to parse comma-separated enum names
  • Added getter to expose the configured violations
http-server/src/main/java/com/facebook/airlift/http/server/HttpServerConfig.java
Apply custom HTTP compliance violations in server initialization
  • Checked if violations list is non-empty before applying
  • Mapped enum values to Jetty HttpCompliance.Violation array
  • Updated baseHttpConfiguration with a custom compliance instance
http-server/src/main/java/com/facebook/airlift/http/server/HttpServer.java
Introduce HttpComplianceViolation enum mapping to Jetty violations
  • Defined enum constants that wrap Jetty HttpCompliance.Violation values
  • Stored underlying Jetty violation in a private field
  • Exposed a getter to retrieve the wrapped violation
http-server/src/main/java/com/facebook/airlift/http/server/HttpComplianceViolation.java
Update TestHttpServerConfig to cover new configuration
  • Included default mapping for empty httpComplianceViolations
  • Added explicit property mapping test with sample violation values
http-server/src/test/java/com/facebook/airlift/http/server/TestHttpServerConfig.java

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

Copy link

@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:

  • Fix the error message passed to requireNonNull in setHttpComplianceViolations so it references httpComplianceViolations instead of includedCipherSuites.
  • Remove the unnecessary /**/ placeholder and trailing comma at the end of the HttpComplianceViolation enum to clean up the declaration.
  • Consider adding validation or clearer error messaging in setHttpComplianceViolations for unknown or misspelled violation names to help users debug configuration errors.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Fix the error message passed to requireNonNull in setHttpComplianceViolations so it references `httpComplianceViolations` instead of `includedCipherSuites`.
- Remove the unnecessary `/**/` placeholder and trailing comma at the end of the HttpComplianceViolation enum to clean up the declaration.
- Consider adding validation or clearer error messaging in setHttpComplianceViolations for unknown or misspelled violation names to help users debug configuration errors.

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.

Copy link

@ZacBlanco ZacBlanco left a comment

Choose a reason for hiding this comment

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

LGTM, just one question about the "customViolations" string

@rschlussel
Copy link
Author

addressed comments from the ai reviewer.

The jetty 12 upgrade includes stricter enforcement of http
compliance violations.  Users may want to allow certain violations
while their clients adapt to the new requirements.
@rschlussel rschlussel merged commit 8f98df7 into prestodb:master Sep 12, 2025
3 checks passed
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.

2 participants