Skip to content

[LIVY-1096] Reject HTTP TRACE and TRACK with 405 on REST and Thrift HTTP - #572

Open
nileshrathi345 wants to merge 1 commit into
apache:masterfrom
nileshrathi345:LIVY-1096
Open

nileshrathi345 wants to merge 1 commit into
apache:masterfrom
nileshrathi345:LIVY-1096

Conversation

@nileshrathi345

Copy link
Copy Markdown
Contributor

Add HttpTraceTrackFilter and register it on the Livy REST server and the Thrift HTTP endpoint so TRACE/TRACK requests return 405 Method Not Allowed.

What changes were proposed in this pull request?

Reject HTTP TRACE and TRACK requests with 405 (Method Not Allowed) on the Livy REST server and on the Thrift HTTP endpoint.

  • Added HttpTraceTrackFilter, a servlet filter that returns 405 for TRACE and TRACK in any letter case. All other methods pass through.
  • The filter is registered on all paths (/*) in LivyServer and ThriftHttpCLIService. It is always on; there is no config flag.
  • Removed TRACE from the methods that skip the XSRF check in ThriftHttpServlet, since TRACE no longer reaches the servlet.

JIRA: LIVY-1096

How was this patch tested?

Added HttpTraceTrackFilterSpec with 9 unit tests:

  • TRACE, TRACK and mixed-case TrAcE return 405 and are not passed to the next filter.
  • GET, POST, PUT, DELETE, OPTIONS and HEAD pass through.

Was this patch authored or co-authored using generative AI tooling?

No

Add HttpTraceTrackFilter and register it on the Livy REST server and the
Thrift HTTP endpoint so TRACE/TRACK requests return 405 Method Not Allowed.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.41%. Comparing base (fc5f238) to head (29ffc58).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...main/scala/org/apache/livy/server/LivyServer.scala 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #572      +/-   ##
============================================
+ Coverage     69.03%   69.41%   +0.37%     
- Complexity     1231     1239       +8     
============================================
  Files           107      108       +1     
  Lines          6986     6925      -61     
  Branches        858      859       +1     
============================================
- Hits           4823     4807      -16     
+ Misses         1689     1639      -50     
- Partials        474      479       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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