This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch release/v1.3
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/release/v1.3 by this push:
new b01953b943 fix(amber, v1.3): return 403 instead of 401 when a user
lacks access to an execution (#9333)
b01953b943 is described below
commit b01953b9433b4b3ca97a9bc283fd4d24cd998462
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Nov 5 10:00:18 2026 +0000
fix(amber, v1.3): return 403 instead of 401 when a user lacks access to an
execution (#9333)
### What changes were proposed in this PR?
Automated backport of #9325 to `release/v1.3`.
Source: 312a0cefc54ed3bc6b810dfdb07589df1b872e99 · [automation
run](https://github.com/apache/texera/actions/runs/41981785429)
### Any related issues, documentation, discussions?
Backport of #9325. Originally linked #9324.
### How was this PR tested?
The backported tree built green before #9325 merged. Release-branch CI
runs on this PR once it is reopened — see the comment below.
### Was this PR authored or co-authored using generative AI tooling?
No.
Co-authored-by: Meng Wang <[email protected]>
---
.../user/workflow/WorkflowExecutionsResource.scala | 2 +-
.../dashboard/user/quota/UserQuotaResourceSpec.scala | 3 ++-
.../user/workflow/WorkflowExecutionsResourceSpec.scala | 16 ++++++++++++++--
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git
a/amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResource.scala
b/amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResource.scala
index 26e0b987c0..2670e4f108 100644
---
a/amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResource.scala
+++
b/amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResource.scala
@@ -89,7 +89,7 @@ object WorkflowExecutionsResource {
): Unit = {
eids.distinct.foreach { eid =>
if (!userCanAccessExecution(uid, eid, requireWrite)) {
- throw new WebApplicationException(Response.Status.UNAUTHORIZED)
+ throw new ForbiddenException("No sufficient access privilege.")
}
}
}
diff --git
a/amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/quota/UserQuotaResourceSpec.scala
b/amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/quota/UserQuotaResourceSpec.scala
index 5796dd2afc..9eebd103a0 100644
---
a/amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/quota/UserQuotaResourceSpec.scala
+++
b/amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/quota/UserQuotaResourceSpec.scala
@@ -370,9 +370,10 @@ class UserQuotaResourceSpec extends AnyFlatSpec with
BeforeAndAfterAll with Mock
otherUser.setName("otherUser")
otherUser.setEmail("otherUser-" + UUID.randomUUID().toString.substring(0,
8) + "@example.com")
- intercept[WebApplicationException] {
+ val refused = intercept[WebApplicationException] {
resource.deleteCollection(execution.getEid, new SessionUser(otherUser))
}
+ assert(refused.getResponse.getStatus == 403)
assert(workflowExecutionsDao.fetchOneByEid(execution.getEid) != null)
}
diff --git
a/amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResourceSpec.scala
b/amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResourceSpec.scala
index b656a48346..720d9cfc6f 100644
---
a/amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResourceSpec.scala
+++
b/amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResourceSpec.scala
@@ -699,7 +699,7 @@ class WorkflowExecutionsResourceSpec
requireWrite = true
)
- intercept[WebApplicationException] {
+ intercept[ForbiddenException] {
WorkflowExecutionsResource.validateUserCanAccessExecutions(
otherUserUid,
Seq(eid),
@@ -1309,7 +1309,7 @@ class WorkflowExecutionsResourceSpec
"setExecutionAreBookmarked" should "reject a user without access" in {
val exec = insertExecution()
- assertThrows[WebApplicationException](
+ assertThrows[ForbiddenException](
resource.setExecutionAreBookmarked(
ExecutionGroupBookmarkRequest(testWorkflowWid, Array(exec.getEid),
isBookmarked = false),
session(userWithoutAccess())
@@ -1317,6 +1317,18 @@ class WorkflowExecutionsResourceSpec
)
}
+ it should "refuse a read-only user with 403, since the frontend logs out on
401" in {
+ grantReadAccess()
+ val exec = insertExecution()
+ assertThrows[ForbiddenException](
+ resource.setExecutionAreBookmarked(
+ ExecutionGroupBookmarkRequest(testWorkflowWid, Array(exec.getEid),
isBookmarked = false),
+ session(testUser)
+ )
+ )
+ assert(workflowExecutionsDao.fetchOneByEid(exec.getEid).getBookmarked ==
false)
+ }
+
it should "bookmark executions that are currently un-bookmarked" in {
grantWriteAccess()
val exec = insertExecution() // bookmarked = false