Skip to content

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Oct 13, 2025

Description

This PR enhances the audit log redaction functionality to use an existing extension point in core that is not utilized. Core has an extension point called RestRequestFilter that can be used to filter sensitive values from a request payload (for example password in some reindex REST Apis). I am raising this PR to wire up this extension point.

See opensearch-project/OpenSearch@9005e9f#diff-b30aa63ce9a55b210cf60a1c2a0d0070156e13379ae6ffef45707686e31ae0c6

The benefit of this extension point is that other plugins can leverage it to declare api params as sensitive and filtered in cases where the request body may be used.

  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)

Bug fix

Check List

  • New functionality includes testing
  • New functionality has been documented
  • New Roles/Permissions have a corresponding security dashboards plugin PR
  • API changes companion pull request created
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@cwperks cwperks changed the title Use filtered request Use RestRequestFilter.getFilteredRequest to declare sensitive API params Oct 13, 2025
Signed-off-by: Craig Perkins <[email protected]>
Copy link

codecov bot commented Oct 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.91%. Comparing base (d2365fb) to head (185d8b4).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5710      +/-   ##
==========================================
- Coverage   72.93%   72.91%   -0.03%     
==========================================
  Files         420      420              
  Lines       26269    26277       +8     
  Branches     3974     3976       +2     
==========================================
  Hits        19159    19159              
- Misses       5192     5200       +8     
  Partials     1918     1918              
Files with missing lines Coverage Δ
...arch/security/dlic/rest/api/AbstractApiAction.java 88.54% <100.00%> (+0.13%) ⬆️
...opensearch/security/filter/SecurityRestFilter.java 86.92% <100.00%> (+0.44%) ⬆️

... and 7 files with indirect coverage changes

🚀 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.

Copy link
Member

@DarshitChanpura DarshitChanpura left a comment

Choose a reason for hiding this comment

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

left 1 comment. LGTM otherwise


RestRequest filteredRequest = getFilteredRequest(request);

RestRequest auditLogRequest = (request.method() != Method.PATCH) ? filteredRequest : request;
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind adding a brief comment on why PATCH is skipped?

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