Repository navigation
feat: add KesselContentGuard to authorize content via Kessel (PULP-2707) - #1714
CryptoRodeo wants to merge 1 commit into
Conversation
Lightwell content needs permission-based access control, and the Kessel CIAM credentials were already wired into stage (pulp#1681) but nothing used them. This adds a KesselContentGuard that permits a content request only when Kessel answers ALLOWED_TRUE for the guard's permission (for example content_sources_repository_view). The check runs against the requesting org's default workspace, with redhat/<user_id> as the subject. That is the same flow content-sources-backend uses: look up the default workspace via RBAC v2, then call Inventory v1beta2 Check. The official kessel-sdk does the OAuth2 client-credentials token, the workspace lookup and the gRPC call. The guard fails closed: a missing identity is a 401, and anything else (a bad identity, a deny, or Kessel, RBAC or SSO being unreachable) is a 403. Every external call has a timeout, so a hung dependency can't stall the content worker. One new setting, PULP_KESSEL_RBAC_URL, is wired into the clowdapp and defaults to empty, so stage stays inert until app-interface sets it. KESSEL_URL must be a gRPC host:port with no scheme; when the client credentials are set, the SDK always uses TLS, so a plaintext endpoint gets a 403 on every request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Bryan ramos <bramos@redhat.com>
Reviewer's GuideSchema and migrationsAdd the KesselContentGuard database model and its permission field so guards can persist the Kessel permission they enforce.
APIExpose KesselContentGuard as a serialized, role-managed content-guard endpoint with its permission field.
ImplementationParse the request identity and implement fail-closed authorization through the Kessel permission check.
Build the Kessel client, resolve and cache an org's default workspace, and enforce timeouts for token, RBAC, and Inventory calls.
ConfigurationWire the Kessel RBAC URL into deployment parameters and application settings for environment-specific configuration.
DocumentationRecord the new KesselContentGuard capability in the changelog.
TestsTest Kessel permission decisions, workspace lookup caching and failure handling, and guard identity parsing and denial behavior.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Why
Lightwell content needs permission-based access control. The Kessel CIAM
credentials were wired into stage in #1681, but nothing used them yet.
What
Adds a
KesselContentGuard. A content request gets through only if Kesselsays the user has the guard's permission (e.g.
content_sources_repository_view)on their org's default workspace.
It follows the same flow content-sources-backend uses:
Check(Inventory v1beta2), subjectredhat/<user_id>The official
kessel-sdkdoes all three steps. Service accounts use their ownuser_id.Fails closed:
Before enabling in stage
KESSEL_RBAC_URLin app-interface. This PR adds the setting; it's empty by default, so nothing changes until it's set.KESSEL_URLis a gRPChost:portwith no scheme. With credentials set, the SDK always uses TLS, so a plaintext endpoint means every guarded request gets a 403.Testing
account, bad headers), fail-closed behavior, workspace caching, and the token timeout.
/contentguards/service/kessel/, a request with no identity gets a 401,and one with Kessel unconfig
or without this change (the container's pulpcore is missing a patch).
Follow-ups (not in this PR)
without TLS)
kessel-sdkversionSummary by Sourcery
Protect content access with a configurable KesselContentGuard that enforces organization-scoped permissions for authenticated principals.
New Features:
Enhancements:
Build:
Deployment:
Tests: