Skip to content

fix(experiments): enforce object-level access in experiment Max tools - #87802

Merged
trunk-io[bot] merged 1 commit into
masterfrom
experiments/max-summary-object-access
Aug 24, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
experiments/max-summary-object-access

Conversation

@jurajmajerik

Copy link
Copy Markdown
Contributor

Problem

ExperimentSummaryTool and SessionReplaySummaryTool only check resource-level experiment:viewer access. A team member with an explicit object-level denial on a specific experiment can still summarize it (or list its replay counts) by passing the experiment ID. Flagged by veria-ai on #84320.

Changes

  • Call check_object_access(experiment, "viewer") after loading the experiment in both summary tool paths and in the replay tool.
  • In the summary fetch path, load the experiment and check access before running the metric queries, so a denied user costs no ClickHouse work.
  • Re-raise MaxToolAccessDeniedError past the tools' catch-all exception handlers so the framework renders the denial instead of a generic failure message.

How did you test this code?

Added one denial test per tool (mocking user_access_control to deny, same pattern as the dashboard tool's test): removing any of the three checks fails the corresponding test. Adjusted test_fetch_and_format_handles_nonexistent_experiment for the reordered lookup. All 71 tests across the three experiment tool test files pass.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code follow-up to a veria-ai review finding on #84320 (pre-existing gap, deferred there as out of scope). Used the existing MaxTool.check_object_access helper; precedent from alerts/customer_analytics/upsert_dashboard tools. Skills invoked: /wt, /writing-tests. Sibling cleanup PR: #87799. Note: #87799 removes the frontend-context path this PR also touches; whichever lands second needs a trivial rebase.

@jurajmajerik jurajmajerik self-assigned this Aug 24, 2026
@trunk-io

trunk-io Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@jurajmajerik
jurajmajerik marked this pull request as ready for review August 24, 2026 12:44
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team August 24, 2026 12:45
@github-actions

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(experiments): enforce object-level a..." | Re-trigger Greptile

@jurajmajerik jurajmajerik added the stamphog Request AI approval (no full review) label Aug 24, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This closes an object-level access-control gap in security-sensitive experiment tools, but the author is on the owning team (team-experiments) and the diff includes denial tests exercising the new checks, satisfying the independent-assurance bar for risky territory; no unresolved comments or holds.

  • Author wrote 0% of the modified lines and has 61 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 22L, 1F substantive, 60L/3F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1b-small (60L, 3F, single-area, fix)
stamphog 2.0.0b4 .stamphog/policy.yml @ 1cc55f3 · reviewed head 1cc55f3

@trunk-io

trunk-io Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@trunk-io
trunk-io Bot merged commit 308ed04 into master Aug 24, 2026
344 of 373 checks passed
@trunk-io
trunk-io Bot deleted the experiments/max-summary-object-access branch August 24, 2026 14:05
@deployment-status-posthog

deployment-status-posthog Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-24 14:40 UTC Run
prod-us ✅ Deployed 2026-08-24 16:10 UTC Run
prod-eu ✅ Deployed 2026-08-24 23:15 UTC Run

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

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant