You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@texera.apache.org by gi...@apache.org on 2026/07/09 08:03:17 UTC

(texera) branch gh-readonly-queue/main/pr-6217-27f145a4f293955e80779ba781c1249d792604be created (now 1fb018476b)

This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-6217-27f145a4f293955e80779ba781c1249d792604be
in repository https://gitbox.apache.org/repos/asf/texera.git


      at 1fb018476b fix(auth): enforce role annotation coverage in notebook-migration-service (#6217)

This branch includes the following new commits:

     new 1fb018476b fix(auth): enforce role annotation coverage in notebook-migration-service (#6217)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(texera) 01/01: fix(auth): enforce role annotation coverage in notebook-migration-service (#6217)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-6217-27f145a4f293955e80779ba781c1249d792604be
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 1fb018476be952a0336a8ed28bf86130b089b5c5
Author: Martin Vu <12...@users.noreply.github.com>
AuthorDate: Thu Jul 9 01:02:55 2026 -0700

    fix(auth): enforce role annotation coverage in notebook-migration-service (#6217)
    
    ### What changes were proposed in this PR?
    
    - Add `RoleAnnotationEnforcer.enforce(...)` to
    `NotebookMigrationService` after all Jersey resources are registered so
    role annotation coverage is validated at startup. This aligns the
    notebook-migration-service with the other five Dropwizard microservices
    that already have this guardrail.
    - Update `NotebookMigrationServiceRunSpec` to mock the Jersey
    `ResourceConfig` for the new startup check.
    
    ### Any related issues, documentation, discussions?
    
    Closes #6149
    Follow-up from #4904
    
    ### How was this PR tested?
    
    Ran:
    
    ```bash
    sbt "NotebookMigrationService / testOnly *NotebookMigrationServiceRunSpec"
    ```
    
    The test passed successfully.
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    Co-authored with ChatGPT 5.5-mini
    
    Co-authored-by: Xinyuan Lin <xi...@uci.edu>
---
 .../scala/org/apache/texera/service/NotebookMigrationService.scala  | 6 ++++++
 .../org/apache/texera/service/NotebookMigrationServiceRunSpec.scala | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/notebook-migration-service/src/main/scala/org/apache/texera/service/NotebookMigrationService.scala b/notebook-migration-service/src/main/scala/org/apache/texera/service/NotebookMigrationService.scala
index a94e728b00..fe9214b0d1 100644
--- a/notebook-migration-service/src/main/scala/org/apache/texera/service/NotebookMigrationService.scala
+++ b/notebook-migration-service/src/main/scala/org/apache/texera/service/NotebookMigrationService.scala
@@ -30,6 +30,7 @@ import org.apache.texera.auth.{
   SessionUser,
   UnauthorizedExceptionMapper
 }
+import org.apache.texera.auth.RoleAnnotationEnforcer
 import org.apache.texera.dao.SqlServer
 import org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature
 import java.nio.file.Path
@@ -69,6 +70,11 @@ class NotebookMigrationService
 
     environment.jersey.register(classOf[NotebookMigrationResource])
 
+    RoleAnnotationEnforcer.enforce(
+      environment.jersey.getResourceConfig,
+      "NotebookMigrationService"
+    )
+
     // Route request logs through SLF4J, controlled by TEXERA_SERVICE_LOG_LEVEL
     RequestLoggingFilter.register(environment.getApplicationContext)
   }
diff --git a/notebook-migration-service/src/test/scala/org/apache/texera/service/NotebookMigrationServiceRunSpec.scala b/notebook-migration-service/src/test/scala/org/apache/texera/service/NotebookMigrationServiceRunSpec.scala
index e71529a367..7a11d478a6 100644
--- a/notebook-migration-service/src/test/scala/org/apache/texera/service/NotebookMigrationServiceRunSpec.scala
+++ b/notebook-migration-service/src/test/scala/org/apache/texera/service/NotebookMigrationServiceRunSpec.scala
@@ -21,6 +21,7 @@ package org.apache.texera.service
 
 import io.dropwizard.auth.AuthDynamicFeature
 import io.dropwizard.core.setup.Environment
+import io.dropwizard.jersey.DropwizardResourceConfig
 import io.dropwizard.jersey.setup.JerseyEnvironment
 import io.dropwizard.jetty.MutableServletContextHandler
 import io.dropwizard.jetty.setup.ServletEnvironment
@@ -42,6 +43,7 @@ class NotebookMigrationServiceRunSpec extends AnyFlatSpec with Matchers {
     when(env.jersey).thenReturn(jersey)
     when(env.servlets).thenReturn(servlets)
     when(env.getApplicationContext).thenReturn(context)
+    when(jersey.getResourceConfig).thenReturn(new DropwizardResourceConfig())
 
     val service = new NotebookMigrationService
     service.run(mock(classOf[NotebookMigrationServiceConfiguration]), env)