Skip to content

refactor(amber): remove the unregistered GuestAuthFilter and its unreachable guest guard - #7926

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
eugenegujing:refactor/remove-guest-auth-filter
Aug 25, 2026
Merged

aglinxinyuan merged 1 commit into
apache:mainfrom
eugenegujing:refactor/remove-guest-auth-filter

Conversation

@eugenegujing

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

GuestAuthFilter is an authentication filter that is never registered: every AuthDynamicFeature registration in the repo installs JwtAuthFilter (JwtAuth.scala, AuthFeatures.scala, NotebookMigrationService.scala), and nothing constructs GuestAuthFilter or its Builder. It was originally registered for the non-user-system mode behind the user-sys.enabled flag, but that mode and its registration were removed in #3831, leaving the filter with no production path.

With the filter gone, the guest guard in WorkflowResource.persistWorkflow became unreachable: it compares the request user against GuestAuthFilter.GUEST (whose uid is null), but the only production path to that endpoint is JwtAuthFilter → JwtParser.claimsToSessionUser, which fails authentication with a 401 unless the token carries a non-null userId claim — so every user that reaches the guard has a non-null uid and can never equal GUEST. The endpoint stays protected by @Auth + @RolesAllowed, so removing the guard changes no user-facing behavior.

Changes:

  • Delete GuestAuthFilter.scala (the filter class, its Builder, and the GUEST singleton — the singleton's only production use was the unreachable guard).
  • Delete GuestAuthFilterSpec.scala, since the filter it covers has no production path.
  • Remove the guest guard block from WorkflowResource.persistWorkflow.
  • Remove the "reject the guest user" case from WorkflowResourceSpec (it hand-built a SessionUser(GUEST) principal that no production path can produce) along with the now-unused GuestAuthFilter import, and move the "WorkflowResource.persistWorkflow" should subject prefix onto the following test so the later it should cases keep their subject binding.

Any related issues, documentation, discussions?

Fixes #7923.

The filter was introduced for the non-user-system mode in #1394, the guard was added in #2836 while that mode was still supported, and the mode along with the filter's registration was removed in #3831. This PR cleans up what #3831 left behind.

How was this PR tested?

No new tests: the two removed tests covered only the unreachable path (both had to construct the guest principal by hand). The remaining WorkflowResourceSpec cases for persistWorkflow (owner update with version recording, no-access and no-write-access rejections) continue to cover the endpoint. A repo-wide grep confirms no references to GuestAuthFilter or GUEST remain outside this PR's deletions.

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

Co-authored by: Claude Fable 5 (Claude Code)

…achable guest guard

Delete GuestAuthFilter (the filter class, its Builder, and the GUEST singleton) and its spec, remove the guest guard from WorkflowResource.persistWorkflow, and remove the guard's test case from WorkflowResourceSpec.
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @aglinxinyuan
    You can notify them by mentioning @aglinxinyuan in a comment.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 5 better · 🔴 5 worse · ⚪ 5 noise (<±5%) · 0 without baseline

Compared against main 6b8027e benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🟢 bs=10 sw=10 sl=64 492 0.3 19,952/23,780/23,780 us 🟢 -62.9% / 🔴 +73.7%
🔴 bs=100 sw=10 sl=64 974 0.594 100,847/145,229/145,229 us 🔴 +16.4% / 🔴 +50.5%
⚪ bs=1000 sw=10 sl=64 1,169 0.714 853,215/896,394/896,394 us ⚪ within ±5% / 🟢 -6.9%
Baseline details

Latest main 6b8027e from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 492 tuples/sec 358 tuples/sec 863.81 tuples/sec +37.4% -43.0%
bs=10 sw=10 sl=64 MB/s 0.3 MB/s 0.218 MB/s 0.527 MB/s +37.6% -43.1%
bs=10 sw=10 sl=64 p50 19,952 us 26,883 us 11,488 us -25.8% +73.7%
bs=10 sw=10 sl=64 p95 23,780 us 64,133 us 14,067 us -62.9% +69.0%
bs=10 sw=10 sl=64 p99 23,780 us 64,133 us 17,591 us -62.9% +35.2%
bs=100 sw=10 sl=64 throughput 974 tuples/sec 1,040 tuples/sec 1,127 tuples/sec -6.3% -13.6%
bs=100 sw=10 sl=64 MB/s 0.594 MB/s 0.635 MB/s 0.688 MB/s -6.5% -13.7%
bs=100 sw=10 sl=64 p50 100,847 us 91,695 us 89,893 us +10.0% +12.2%
bs=100 sw=10 sl=64 p95 145,229 us 124,818 us 96,506 us +16.4% +50.5%
bs=100 sw=10 sl=64 p99 145,229 us 124,818 us 104,915 us +16.4% +38.4%
bs=1000 sw=10 sl=64 throughput 1,169 tuples/sec 1,200 tuples/sec 1,156 tuples/sec -2.6% +1.2%
bs=1000 sw=10 sl=64 MB/s 0.714 MB/s 0.732 MB/s 0.705 MB/s -2.5% +1.2%
bs=1000 sw=10 sl=64 p50 853,215 us 833,765 us 886,448 us +2.3% -3.7%
bs=1000 sw=10 sl=64 p95 896,394 us 882,705 us 930,093 us +1.6% -3.6%
bs=1000 sw=10 sl=64 p99 896,394 us 882,705 us 963,104 us +1.6% -6.9%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,406.84,200,128000,492,0.300,19951.71,23780.01,23780.01
1,100,10,64,20,2053.52,2000,1280000,974,0.594,100846.61,145228.54,145228.54
2,1000,10,64,20,17102.92,20000,12800000,1169,0.714,853214.58,896393.98,896393.98

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 25, 2026
Merged via the queue into apache:main with commit 58112d7 Aug 25, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The guest guard in WorkflowResource.persistWorkflow is unreachable, GuestAuthFilter is never registered

2 participants