Skip to content

fix: Show ALB logs only to people who can query them - #1628

Merged
0xmc merged 1 commit into
mainfrom
fix/alb-logs-subresource-gate
Oct 4, 2026
Merged

0xmc merged 1 commit into
mainfrom
fix/alb-logs-subresource-gate

Conversation

@0xmc

@0xmc 0xmc commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Summary

People on custom roles could see the load balancer logs panel and then hit a permission error on every query, while others with real access had it hidden.

Since Milo began checking subresource permissions, a log query passes two checks that the panel's permission check never asked about.

The panel now shows only when both checks pass, which needed permission checks in the portal to carry a subresource through to Milo.

The Cypress component and end-to-end suites were not run.

Test plan

  • Lint, typecheck, formatting and the unit suite pass, and the new tests fail against the previous code
  • A user whose role cannot run a log query does not see the panel
  • A user on a built-in viewer role sees the panel and gets log results

Fixes #1627

The ALB logs panel was gated on o11y.miloapis.com/logs.get. With Milo's
subresource authorization on, a log query is reviewed twice instead: the
aggregator hop reads /logs/loki/api/v1/... as resource logs, name loki,
subresource api (logs/api.get), and queryapi then reviews its own route as
logs.query with no name, subresource or namespace. A custom role holding only
logs.get saw the panel and got a 403 on every query, and a role holding the
new permissions was hidden.

The portal's permission checks could not express a subresource: the BFF
schema stripped unknown fields, so the field never reached Milo.

Key changes:
- thread an optional subresource from usePermission through the BFF schema,
  RbacService and the SelfSubjectAccessReview payload, and include it in the
  query cache key and the bulk dedupe identity
- accept queryapi's query verb in permission checks
- gate the panel on both reviews: logs/api.get with name loki, and
  logs.query, each with an empty namespace at project scope

The provider resolves logs/api.get with name loki against the Logs:loki
instance plus the project, kind root and scope root, so including the name
also honors an instance-level binding, as the real request does.

The new tests fail against the previous code (12 failures) and pass with
this change.

Fixes #1627
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

🧪 Test Summary

Job Status
Bun Unit Tests ✅ success
E2E Regression (0) ✅ success
E2E Regression (1) ✅ success
E2E Regression (2) ✅ success ⚠️ passed on retry
E2E Regression (3) ✅ success
E2E Smoke ✅ success
Unit Tests ✅ success

View workflow run

⚠️ 1 e2e job(s) passed only on retry. That is a flake, not a pass; check the first-attempt screenshots in the artifacts.

Need another run? Use Re-run failed jobs: one shard costs a few minutes, the whole workflow about 26.

@0xmc
0xmc merged commit 1323cd4 into main Oct 4, 2026
19 checks passed
@0xmc
0xmc deleted the fix/alb-logs-subresource-gate branch October 4, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ALB logs panel misjudges access

2 participants