Skip to content
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

Limit the maximum name length #1450

Merged
merged 1 commit into from Apr 22, 2021
Merged

Limit the maximum name length #1450

merged 1 commit into from Apr 22, 2021

Conversation

wansir
Copy link
Member

@wansir wansir commented Apr 22, 2021

Signed-off-by: hongming talonwan@yunify.com

fix: kubesphere/kubesphere#3784

Limit the maximum name length, avoid accidentally deleting role bindings.

We use username as the label value when deleting resources in batch, If the label value is invalid, all resources will be deleted accidentally. The length of the username must be limited to ensure that the length of the UserReferenceLabel is less than 64.

https://github.com/kubesphere/kubesphere/blob/v3.0.0/pkg/controller/user/user_controller.go#L556-L559

	listOptions := metav1.ListOptions{
		LabelSelector: labels.SelectorFromSet(labels.Set{iamv1alpha2.UserReferenceLabel: user.Name}).String(),
	}

Signed-off-by: hongming <talonwan@yunify.com>
@ks-ci-bot ks-ci-bot added dco-signoff: yes size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 22, 2021
@wansir
Copy link
Member Author

wansir commented Apr 22, 2021

/cc @RolandMa1986

@wansir
Copy link
Member Author

wansir commented Apr 22, 2021

image

/assign @harrisonliu5 Please modify the group name maximum length to 32 characters.

@RolandMa1986
Copy link
Member

@wansir The change itself is ok for me. Another issue is there are already some users with a long name in the system. Should we add some defensive code to the user_controller too?
/lgtm

@ks-ci-bot ks-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 22, 2021
@pixiake
Copy link
Collaborator

pixiake commented Apr 22, 2021

/approve

@ks-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pixiake, wansir

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ks-ci-bot ks-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 22, 2021
@ks-ci-bot ks-ci-bot merged commit d54192a into kubesphere:master Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
4 participants