-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fix double identities for wildcard requests from APIExport virtual workspace #2306
🐛 Fix double identities for wildcard requests from APIExport virtual workspace #2306
Conversation
/hold |
61d279e
to
9205f31
Compare
/unhold |
Wait. |
No decorateWildcardPathsWithResourceIdentities client should be used to forward requests from a VW. /hold |
9205f31
to
bb3c15a
Compare
Updated to change the VW server to use a "clean" client that doesn't inject identities. Had to reimplement similar logic in the initializing workspaces vw. PTAL. Happy to adjust as needed. |
// It's possible the incoming request already has an identity specified. Make sure we exclude that when | ||
// determining the resource in question. | ||
parts := strings.SplitN(comps[5], ":", 2) | ||
if len(parts) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this ever happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, but can't hurt to have the code here?
bb3c15a
to
7916b6d
Compare
Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com>
7916b6d
to
635489a
Compare
1. Look up the root:tenancy.kcp.dev APIExport identity and use that when forwarding requests for clusterworkspaces from the initializingworkspaces service to kcp. 2. Fix security issue that exposed all workspaces regardless of phase and initializer for GET/UPDATE for a single clusterworkspace Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com>
635489a
to
1f9ce1b
Compare
/unhold |
factory, listFactory, destroyer, | ||
strategy, tableConvertor, | ||
resource, apiExportIdentityHash, categories, | ||
dynamicClusterClient, []string{}, *patchConflictRetryBackoff, ctx.Done(), | ||
) | ||
store := wrapper(resource.GroupResource(), delegate) | ||
if wrapper != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have an inherent nil
check in the implementation of Decorate()
- do we need it here?
func(_ schema.GroupResource, store *forwardingregistry.StoreFuncs) *forwardingregistry.StoreFuncs { | ||
return store | ||
}) | ||
forwardingregistry.StorageWrapperFunc(func(_ schema.GroupResource, store *forwardingregistry.StoreFuncs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have an inherent nil
check - can we just omit this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we keep the nil check in NewStorage, yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments, otherwise LGTM
// We are explicitly setting forceAllowCreate to false in the call to the underlying storage because | ||
// subresources should never allow create on update. | ||
return delegateUpdate(ctx, name, objInfo, createValidation, updateValidation, false, options) | ||
} | ||
statusStore := wrapper(resource.GroupResource(), statusDelegate) | ||
if wrapper != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have an inherent nil check in the implementation of Decorate() - do we need it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep it - you never know if some other implementation omits the nil check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing
ctx, | ||
resource, | ||
"", // ClusterWorkspaces have no identity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: stevekuznetsov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
Fix a bug where wildcard requests coming from the APIExport virtual workspace for "built-in" kcp types (e.g. ClusterWorkspaceTypes) had the identity set by the virtual workspace, then set a second time by
decorateWildcardPathsWithResourceIdentities
.Related issue(s)
Fixes #2184
Fixes #2308
Incorporates & supersedes #2245