Skip to content

refactor(authz): move scoped access control enricher after authz step - #23847

Open
rhybrillou wants to merge 1 commit into
masterfrom
master-yann/authz/move-sac-context-updater-to-post-auth
Open

rhybrillou wants to merge 1 commit into
masterfrom
master-yann/authz/move-sac-context-updater-to-post-auth

Conversation

@rhybrillou

Copy link
Copy Markdown
Contributor

Description

The current authorizers do not depend on the scope access control rules from the context. In the near future, there will likely be some cases where scoped access control requires role information that can be fetched during the authorization step. As a consequence, the associated interceptor is changing position in the grpc interceptor chain.

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

The existing CI should cover the functional impacts of the change at hand.

How I validated my change

In CI we trust

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.57%. Comparing base (ed8dd64) to head (7adccc1).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #23847      +/-   ##
==========================================
- Coverage   52.61%   52.57%   -0.04%     
==========================================
  Files        2836     2836              
  Lines      177975   177975              
==========================================
- Hits        93640    93572      -68     
- Misses      76142    76190      +48     
- Partials     8193     8213      +20     
Flag Coverage Δ
go-unit-tests 52.57% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Improvements

    • Authorization-related context is now populated with user-scope details after authorization, keeping those details aligned with the authorization outcome. This may affect information available to downstream processing after access checks.
  • Compatibility

    • No changes to public declarations were reported.

The gRPC server now registers the authorization-trace enricher as a post-auth context enricher. The comment now describes user-scope injection after authorization.

Changes: Authorization trace

Layer / File(s) Summary
Post-auth enricher registration
central/main.go
The authorization-trace enricher is registered as a post-auth context enricher instead of a pre-auth context enricher. The comment now describes injecting user scope after authorization.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Refactor

Suggested reviewers: ajheflin

Merge Risk: Minimal · up to 7adcc

The interceptor move matches the stated authorization flow and is ready to merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title states the main change: the scoped access control enricher moves after the authorization step. The raw summary confirms central/main.go appends the authorization-trace enricher to PostAuthCo…
Description check Passed The description explains the reason for the change. Current authorizers do not use scoped access control rules from the context, and future scoped access control may need role information that the aut…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: the scoped access control enricher moves after the authorization step. The raw summary confirms central/main.go appends the authorization-trace enricher to PostAuthContextEnrichers instead of PreAuthContextEnrichers. The title is specific and matches the changeset. It uses the conventional refactor(authz) prefix and is 69 characters long.

Full details: Description check

Explanation

The description explains the reason for the change. Current authorizers do not use scoped access control rules from the context, and future scoped access control may need role information that the authorization step fetches, so the interceptor moves in the gRPC chain. The User-facing documentation and Testing and quality sections are filled in. The automated testing section states that existing CI should cover the change. The How I validated section only says 'In CI we trust,' which gives no concrete validation steps. The CI results checkbox is unchecked. The 'change me!' placeholder was replaced in the Description section but not in the template's required structure, and the author did not explain which validation was performed beyond CI.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0060a364-fd81-4f4f-8d40-da537f8b7631
Commits

Reviewing files that changed from the base of the PR and between ed8dd64 and 7adccc1.

Files selected for processing: 1
  • central/main.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Build Images Ready

Images are ready for commit 7adccc1. To use with deploy scripts:

export MAIN_IMAGE_TAG=5.1.x-458-g7adccc121e

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant