-
Notifications
You must be signed in to change notification settings - Fork 1
[BB-906] baton-sql-server: add user deprovisioning #28
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
Conversation
| query := fmt.Sprintf(` | ||
| ALTER LOGIN [%s] DISABLE;`, userName) |
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.
Needs to sanitize the username to prevent sql injection
pkg/connector/server_user.go
Outdated
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return nil, err |
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.
| return nil, err | |
| return nil, nil |
| "go.uber.org/zap" | ||
| ) | ||
|
|
||
| var _ connectorbuilder.ResourceDeleter = (*userPrincipalSyncer)(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.
Why do we need this line?
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.
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
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.
Great
| } | ||
|
|
||
| func (c *Client) DisableUserFromServer(ctx context.Context, userName string) error { | ||
| if strings.ContainsAny(userName, "[]\"';") { |
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.
sanitize the username here.
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