Skip to content

refactor(authz): replace admin role check with policy-based authorization for default backend access#2741

Open
migmartri wants to merge 1 commit intochainloop-dev:mainfrom
migmartri:miguel/pfm-4454-support-providing-the-actual-content-to-the-endpoint
Open

refactor(authz): replace admin role check with policy-based authorization for default backend access#2741
migmartri wants to merge 1 commit intochainloop-dev:mainfrom
migmartri:miguel/pfm-4454-support-providing-the-actual-content-to-the-endpoint

Conversation

@migmartri
Copy link
Member

@migmartri migmartri commented Feb 13, 2026

Summary

Replace hardcoded admin role check with proper policy-based authorization when falling back to the default CAS backend for artifact downloads.

Motivation

This change improves the authorization model by:

  1. Using the authorization framework consistently instead of hardcoded role checks
  2. Making the permission explicit and auditable through policies
  3. Allowing for future policy customization without code changes

Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
@migmartri migmartri requested review from javirln and jiparis and removed request for jiparis February 13, 2026 22:18
backend = defaultBackend
} else {
// fallback to default backend if the user or the token is allowed to
if ok, err := s.authzUC.Enforce(ctx, currentAuthzSubject, authz.PolicyDefaultBackendArtifactRead); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

this will allow us to customize API tokens with PolicyDefaultBackendArtifactRead

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.

1 participant