Skip to content

Restrict cross-user follower changes (backport #32322 to 2.0) - #32789

Open
sonika-shah wants to merge 1 commit into
2.0from
backport-32322-2.0
Open

Restrict cross-user follower changes (backport #32322 to 2.0)#32789
sonika-shah wants to merge 1 commit into
2.0from
backport-32322-2.0

Conversation

@sonika-shah

Copy link
Copy Markdown
Collaborator

Backport of #32322 (GHSA-962g-h22r-w7hg) to 2.0.

Restrict cross-user follower changes: EntityResource owns guarded add/delete follower helpers that reject a null userId with a 400, compare the requested user with the authenticated subject via null-safe equality, and require admin authorization for cross-user mutations. All follower endpoints delegate to those helpers before calling the repository. Also carries the required EntityRepository.buildReadBundle cache fix (skip the read-bundle cache for UNCACHED_ENTITY_TYPES so a follower mutation + immediate re-read isn't stale on cache-enabled deployments).

  • Clean cherry-pick of the squashed commit 2fb1cb523a (44 files, no conflicts).
  • openmetadata-service + openmetadata-integration-tests build green locally.

Original PR: #32322

* fix(security): restrict cross-user follower changes

* fix(security): validate follower user IDs

* fix(cache): bypass read-bundle cache for uncached entities

buildReadBundle used the read-bundle cache for every non-deleted read,
ignoring UNCACHED_ENTITY_TYPES (user, task, workflow*, bot, domain, dataProduct).
For those types a mutation followed by an immediate re-read — e.g. the follower
add/delete then fetch in this PR's DataProductResourceIT — could serve a stale
cached bundle. Without this, the follower authorization tests fail under a
cache-enabled deployment (postgres-elasticsearch-redis / postgres-opensearch
integration lanes) with `expected <false> but was <true>` after a delete.

Gate the read-bundle cache on isCacheableEntityType(entityType) so uncached
types take the already-supported bundleCache == null path and always reflect the
current entity_relationship state. Required for the follower tests to pass on the
Redis/OpenSearch lanes (documents why this caching change is part of the security
fix, per reviewer request).

* test(followers): rename put_-prefixed delete-follower tests to delete_ prefix

The two round-trip tests exercise the DELETE follower endpoint (add is setup),
so name them with the delete_ verb prefix to match the method-name convention
(addresses the Copilot review comment).

---------

Co-authored-by: sonika-shah <58761340+sonika-shah@users.noreply.github.com>
@sonika-shah
sonika-shah requested a review from a team as a code owner September 7, 2026 02:57
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Security backport restricting cross-user follower changes to 2.0 branch. Follower endpoints now validate user ownership, reject null user IDs with 400 errors, and require admin authorization for cross-user mutations. Also includes the required entity repository cache fix for UNCACHED_ENTITY_TYPES. Clean cherry-pick with no conflicts and all tests passing. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit f5dc2d4f90dc4238e89cbe98064b2614567f8dc0 in Playwright run 34078005694, attempt 1.

✅ 998 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 51m 46s

⏱️ Max setup 3m 9s · max shard execution 18m 52s · max shard-job elapsed before upload 22m 6s · reporting 7s

🌐 193.38 requests/attempt · 2.42 app boots/UI scenario · 24.29% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 24.29% (convergence target: at most 15%).
  • Application boot ratio was 2.42 per UI scenario (2568 boots / 1060 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
🟡 Shard chromium-01 191 0 1 0 0 0
✅ Shard chromium-02 171 0 0 0 0 0
🟡 Shard chromium-03 160 0 1 0 0 0
✅ Shard chromium-04 126 0 0 0 0 0
✅ Shard chromium-05 131 0 0 0 0 0
✅ Shard data-asset-rules-01 63 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 34 0 0 0 0 0
✅ Shard ingestion-02 30 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 2 flaky test(s) (passed on retry)
  • Features/ContextCenterMemories.spec.tsadding a linked asset in edit mode shows entity badge on the row (shard chromium-01, 1 retry)
  • Features/Table.spec.tsshould persist page size (shard chromium-03, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

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

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants