-
Notifications
You must be signed in to change notification settings - Fork 8
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
database: update plugin to adhere to Database v5 interface #14
Conversation
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.
Looks good overall with a couple of issues
} | ||
|
||
// Unmarshal statements.CreationStatements into mongodbRoles | ||
var databaseUser mongoDBAtlasStatement | ||
err = json.Unmarshal([]byte(statements.Creation[0]), &databaseUser) | ||
err = json.Unmarshal([]byte(req.Statements.Commands[0]), &databaseUser) |
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.
Since any statements beyond the first one are ignored, can you return an error if there are more than one?
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.
It seems that we are currently ignoring the other statements if they are provided (same for the MongoDB implementation/update). Would this be a breaking behavior if this is changed?
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.
Technically it would since we'd be erroring if they provide more than one command rather than ignoring them, however I think this a bad user experience if we leave it as-is since we claim that we'll do something (additional commands) but don't actually.
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.
Theron pointed me to the elasticsearch bit of code where we do this. I think it's a fair point, though we should probably do the same for the mongodb (non-Atlas) db engine.
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.
Agreed on the non-Atlas plugin
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 also don't think we need RotateRootCredentials() anymore:
vault-plugin-database-mongodbatlas/mongodbatlas.go
Lines 196 to 199 in 53fc0ec
// RotateRootCredentials is not currently supported on MongoDB | |
func (m *MongoDBAtlas) RotateRootCredentials(ctx context.Context, statements []string) (map[string]interface{}, error) { | |
return nil, errors.New("root credential rotation is not currently implemented in this database secrets engine") | |
} |
Overview
Updates the MongoDB Atlas Database plugin to adhere to the v5 Database interface. Doc updates will be done directly on the SDK and Database v5 feature. The change should be relatively transparent for users.
Related Issues/Pull Requests
Test Output
Acceptance test output using a real MongoDB Atlas account:
Test Output
Acceptance test output with user connection verification:
Test Output
Contributor Checklist