[BB-906] baton-sql-server: add user deprovisioning#28
Merged
Bencheng21 merged 2 commits intomainfrom Jun 20, 2025
Merged
Conversation
Comment on lines
+39
to
+40
| query := fmt.Sprintf(` | ||
| ALTER LOGIN [%s] DISABLE;`, userName) |
Contributor
There was a problem hiding this comment.
Needs to sanitize the username to prevent sql injection
pkg/connector/server_user.go
Outdated
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return nil, err |
Contributor
There was a problem hiding this comment.
Suggested change
| return nil, err | |
| return nil, nil |
| "go.uber.org/zap" | ||
| ) | ||
|
|
||
| var _ connectorbuilder.ResourceDeleter = (*userPrincipalSyncer)(nil) |
Contributor
There was a problem hiding this comment.
Why do we need this line?
Contributor
Author
There was a problem hiding this comment.
This one can check if userPrincipalSyncer implements all the methods in ResourceDeleter`. If not, an error is thrown in compile time.
It acts as a safety check, any changes in ResourceDeleter requires us to change baton-sql-server.
It's good for migration, IMO
Bencheng21
commented
Jun 20, 2025
| } | ||
|
|
||
| func (c *Client) DisableUserFromServer(ctx context.Context, userName string) error { | ||
| if strings.ContainsAny(userName, "[]\"';") { |
Contributor
Author
There was a problem hiding this comment.
sanitize the username here.
MarcusGoldschmidt
approved these changes
Jun 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description.
Follow doc to add account deprovisioning.
As BB-906 described, account deprovisioning could be
disable user login, soDelete()function is used to disable user.Test.
delete command