Skip to content

fix(auth): clear request state outside jersey (backport 2.0 #36173) - #36222

Merged
Vishnuujain merged 1 commit into
2.0from
clear-request-state-2.0
Oct 26, 2026
Merged

Vishnuujain merged 1 commit into
2.0from
clear-request-state-2.0

Conversation

@Vishnuujain

@Vishnuujain Vishnuujain commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #36173 to 2.0.

RetriggerView in GreptileConfidence Score: 4/5

The cleanup looks sound, but the explicit requirement for final markers must be satisfied before merging.

Findings

  1. P2 Unchanged parameters lack required markers ▶

Summary

Adds PerRequestContextCleanupFilter around application requests outside Jersey.

  • Requests start and end with clean thread state.

Scope acknowledged by Vishnuujain: the FreshReadScope changes are intentionally excluded because their prerequisites, #32872 and #34209, are not on 2.0.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Application request] --> B[Clear request-local state]
  B --> C[Run filters and servlet]
  C --> D[Response or exception]
  D --> E[Clear request-local state in finally]
Loading

Reviews (1) · Last reviewed commit: "fix(auth): clear request state outside j..." · Reviewed by Greptile

@Vishnuujain
Vishnuujain requested a review from a team as a code owner October 26, 2026 09:17
@Vishnuujain Vishnuujain added the safe to test Add this label to run secure Github workflows on PRs label Oct 26, 2026
@Vishnuujain
Vishnuujain requested review from mohityadav766 and removed request for a team October 26, 2026 09:17
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · The global filter clears cached entities and impersonation context around every request, which could produce incorrect authorization decisions or expose data.

Adds PerRequestContextCleanupFilter on /* to clear the per-request entity cache and contexts before and after every request, covering servlets and filters outside Jersey such as MCP transport, WebSocket handshake, and SSO callbacks. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

public final class PerRequestContextCleanupFilter implements Filter {

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Unchanged parameters lack required markers

The new doFilter parameters never change but lack final. The repository guide requires final on unchanged parameters and local variables. Add it here and to failingChain in the new test. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch was successfully deployed

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

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants