Skip to content

[#3109] Implement authorization abstraction - #3110

Merged
jhrozek merged 1 commit into
stacklok:mainfrom
ghaskins:issue-3109
Jan 12, 2026
Merged

jhrozek merged 1 commit into
stacklok:mainfrom
ghaskins:issue-3109

Conversation

@ghaskins

@ghaskins ghaskins commented Dec 18, 2025 •

Copy link
Copy Markdown
Contributor

This patch implements an 'authorizer' abstraction under pkg/authz, and then moves the Cedar implementation as the first/canonical form under pkg/authz/authorizers/cedar.

The configuration schema remains untouched, though the mechanism for loading configuration has been reworked to avoid violating the authorizer abstraction with Cedar-isms.

Large PR Justification

Large refactoring that must be atomic

This fixes #3109

@github-actions github-actions Bot added the size/XL Extra large PR: 1000+ lines changed label Dec 18, 2025

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Large PR Detected

This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.

How to unblock this PR:

Add a section to your PR description with the following format:

## Large PR Justification

[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformation

Alternative:

Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.

See our Contributing Guidelines for more details.


This review will be automatically dismissed once you add the justification section.

@codecov

codecov Bot commented Dec 18, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.13514% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.56%. Comparing base (51b37e3) to head (a652960).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/authz/authorizers/config.go 94.11% 2 Missing and 2 partials ⚠️
cmd/thv-operator/pkg/controllerutil/authz.go 88.88% 1 Missing and 1 partial ⚠️
pkg/authz/authorizers/cedar/core.go 95.65% 1 Missing and 1 partial ⚠️
pkg/authz/config.go 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3110      +/-   ##
==========================================
+ Coverage   56.97%   63.56%   +6.58%     
==========================================
  Files         351      353       +2     
  Lines       34962    35053      +91     
==========================================
+ Hits        19919    22280    +2361     
+ Misses      13387    10972    -2415     
- Partials     1656     1801     +145     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Dec 19, 2025
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Dec 19, 2025
@github-actions
github-actions Bot dismissed their stale review December 19, 2025 02:52

Large PR justification has been provided. Thank you!

@github-actions

Copy link
Copy Markdown
Contributor

✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review.

@yrobla yrobla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work! My only comment is to update the docs/authz file to reflect this new pluggable system

jhrozek
jhrozek previously approved these changes Dec 19, 2025

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! The refactoring to a pluggable authorization framework is clean and the factory pattern works well.

One thing I noticed: the swagger docs only show version/type for the Config struct since the authorizer-specific fields come from MarshalJSON. Considered fixing it but it would mean exporting internal fields just for docs - not worth the tradeoff.

@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Dec 19, 2025
@ghaskins

Copy link
Copy Markdown
Contributor Author

@yrobla I just force-pushed an update to my branch with the following changes

  • I rebased on top of todays latest (fb475a8)
  • I added a new patch for the docs/authz changes you requested

The original patch is unchanged, other than the noted rebase.

yrobla
yrobla previously approved these changes Dec 19, 2025
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Dec 29, 2025
@jhrozek

jhrozek commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

@ghaskins thanks for the PR, we didn't merge it before the holidays and now there's a conflict. Would you mind resolving it? I'll approve and merge right away

This patch implements an 'authorizer' abstraction under pkg/authz, and then moves
the Cedar implementation as the first/canonical form under pkg/authz/authorizers/cedar.

The configuration schema remains untouched, though the mechanism for loading configuration
has been reworked to avoid violating the authorizer abstraction with Cedar-isms.

This fixes stacklok#3109

Signed-off-by: Greg Haskins <[email protected]>
@github-actions github-actions Bot removed the size/XL Extra large PR: 1000+ lines changed label Jan 9, 2026
@github-actions github-actions Bot added the size/XL Extra large PR: 1000+ lines changed label Jan 9, 2026
@ghaskins

ghaskins commented Jan 9, 2026

Copy link
Copy Markdown
Contributor Author

@jhrozek rebase completed

@jhrozek
jhrozek merged commit 306f760 into stacklok:main Jan 12, 2026
32 of 33 checks passed
@ghaskins
ghaskins deleted the issue-3109 branch January 12, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Extra large PR: 1000+ lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for generalizing authorization middleware

3 participants