Skip to content

fix(project): correct access privilege lookup#5156

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/project-access-lookup
Open

fix(project): correct access privilege lookup#5156
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/project-access-lookup

Conversation

@fallintoplace
Copy link
Copy Markdown

What changes were proposed in this PR?

Fixes the project access privilege lookup to query PROJECT_USER_ACCESS by (pid, uid) instead of mixing workflow/dataset access tables. Adds regression coverage for WRITE, READ, and NONE project access rows.

Any related issues, documentation, discussions?

Closes #5155

How was this PR tested?

  • git diff --check
  • git diff --cached --check
  • Attempted: JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home PATH=/opt/homebrew/opt/openjdk@17/bin:$PATH /tmp/texera-sbt "WorkflowExecutionService / Test / testOnly org.apache.texera.web.resource.dashboard.user.project.ProjectAccessResourceSpec"
    • Blocked before running the spec because local JOOQ generation could not authenticate to Postgres: FATAL: password authentication failed for user "postgres", causing generated DAO classes to be unavailable.

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

No

@fallintoplace fallintoplace marked this pull request as ready for review May 22, 2026 20:24
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.42%. Comparing base (5e56956) to head (a159bf7).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5156      +/-   ##
============================================
+ Coverage     43.39%   43.42%   +0.02%     
+ Complexity     2215     2214       -1     
============================================
  Files          1049     1049              
  Lines         40567    40567              
  Branches       4321     4321              
============================================
+ Hits          17606    17617      +11     
+ Misses        21871    21859      -12     
- Partials       1090     1091       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø) Carriedforward from 5e56956
agent-service 33.76% <ø> (ø) Carriedforward from 5e56956
amber 44.01% <100.00%> (+0.07%) ⬆️
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 5e56956
config-service 0.00% <ø> (ø) Carriedforward from 5e56956
file-service 32.18% <ø> (ø) Carriedforward from 5e56956
frontend 34.61% <ø> (ø) Carriedforward from 5e56956
python 90.50% <ø> (ø) Carriedforward from 5e56956
workflow-compiling-service 56.81% <ø> (ø) Carriedforward from 5e56956

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@Ma77Ball
Copy link
Copy Markdown
Contributor

Thank you for contributing. Please use the /request-review feature to ask for a committer to review this pr or ask @chenlica to assign a reviewer for you in the future.

@Ma77Ball
Copy link
Copy Markdown
Contributor

/request-review @Yicong-Huang

@chenlica chenlica requested a review from mengw15 May 23, 2026 06:06
@chenlica
Copy link
Copy Markdown
Contributor

@carloea2 Can you review it? After that, @mengw15 and @bobbai00 can review it.

@chenlica chenlica requested a review from bobbai00 May 23, 2026 06:06
@carloea2
Copy link
Copy Markdown
Contributor

I remember someone told me projects feature was deprecated, maybe @mengw15 can confirm?

@Yicong-Huang
Copy link
Copy Markdown
Contributor

Yicong-Huang commented May 23, 2026

even if the project is deprecated, we still need to maintain the codebase.

unless we decide to remove project completely, then we should remove the codebase.

@carloea2
Copy link
Copy Markdown
Contributor

In that case, I would say in case it is indeed deprecated, lets discuss the removal of that feature before reviewing this PR, is that ok?

@Yicong-Huang
Copy link
Copy Markdown
Contributor

In that case, I would say in case it is indeed deprecated, lets discuss the removal of that feature before reviewing this PR, is that ok?

I feel those two are orthogonal, I hope to encourage @fallintoplace to finish this PR, regardless if we decided to drop support of project eventually or not. Let's discuss removal separately, which is a much larger scope.

@carloea2
Copy link
Copy Markdown
Contributor

Got it, I will review it. Thanks.

assert(!ProjectAccessResource.userHasWriteAccess(project.getPid, readerUid))
}

it should "return NONE if the user has no project access row" in {
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.

Could we make this negative test cover the (pid, uid) bug more directly?

Right now noAccessUid has no rows in PROJECT_USER_ACCESS, so the test only proves that a missing user row returns NONE. Since this PR specifically fixes lookup by both pid and uid, please add or adjust this case so the user has access to a different project, then assert that lookup on this project still returns NONE.

For example: create two projects, grant readerUid READ on project A only, then assert getProjectAccessPrivilege(projectB.getPid, readerUid) == PrivilegeEnum.NONE. That would catch a regression where the query accidentally filters only by uid and ignores pid.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks, updated the negative case to cover this more directly.

The test now creates two projects, grants readerUid READ access only on the first project, and asserts that getProjectAccessPrivilege returns NONE for the second project with the same readerUid. This should catch a regression where the lookup filters by uid but not pid.

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.

Thanks

@fallintoplace fallintoplace force-pushed the fix/project-access-lookup branch from f7188d3 to a159bf7 Compare May 23, 2026 09:58
@carloea2
Copy link
Copy Markdown
Contributor

LGTM

@Yicong-Huang Yicong-Huang enabled auto-merge May 24, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project access privilege lookup queries wrong access tables

6 participants