Skip to content

test: Add Project Role Permission Benchmarks And Traversal Test - #24195

Open
bupd wants to merge 1 commit into
goharbor:mainfrom
bupd:project-role-tests
Open

bupd wants to merge 1 commit into
goharbor:mainfrom
bupd:project-role-tests

Conversation

@bupd

@bupd bupd commented Oct 21, 2026

Copy link
Copy Markdown
Member

Test-only, split out of #24029. No production code changes.

  • benchmark_test.go: benchmarks for the rbac evaluator on project roles (allowed, denied, 10k projects, public project), so changes to permission evaluation can be measured.
  • BenchmarkProjectEvaluator and BenchmarkProjectEvaluatorParallel now fail if the permission is denied. Before, a broken setup would quietly benchmark the deny path.
  • TestTraversalDoesNotReachAnotherProject: a project admin of project 1 cannot reach project 2 through .. segments in the resource path.

Run with go test -run . -bench . ./common/rbac/project/.

@bupd
bupd requested a review from a team as a code owner October 21, 2026 10:17
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.02%. Comparing base (4e07c69) to head (e485cde).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #24195   +/-   ##
=======================================
  Coverage   74.02%   74.02%           
=======================================
  Files        1095     1095           
  Lines      103532   103532           
  Branches     3079     3079           
=======================================
+ Hits        76638    76644    +6     
+ Misses      26526    26520    -6     
  Partials      368      368           
Flag Coverage Δ
unittests 74.02% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 9 files with indirect coverage changes

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

@bupd bupd added the release-note/ignore-for-release Do not include PR or Issue for release notes label Oct 21, 2026
Add benchmarks for the rbac evaluator on project roles: allowed,
denied, many projects and a public project. The existing project
evaluator benchmarks now fail if the permission is denied, so they
can't silently measure the deny path.

Add a test that a project member cannot reach another project's
resources through '..' segments.

Signed-off-by: Prasanth Baskar <prasanth@8gears.com>
@bupd
bupd force-pushed the project-role-tests branch from 216285f to e485cde Compare October 21, 2026 12:11

This branch has not been deployed

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

Labels

release-note/ignore-for-release Do not include PR or Issue for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants