-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support using a different s3 bucket through plugin setting #46
Conversation
@mickmister A couple of questions:
|
@wiggin77 I was thinking it may best to keep it simple now, though now I'm thinking we should lean on the side of data access/isolation, which would involve setting different credentials etc. as you mentioned. I'm planning to add the following plugin settings to uniquely identify the bucket, along with unit tests to cover usage:
Here are the values that the plugin currently pulls from the MM config: mattermost-plugin-legal-hold/server/plugin.go Lines 212 to 225 in 568f22b
Yes the legal holds are correctly written to the provided S3 bucket. I've tested with MINIO and will test with an S3 bucket as well I've also added a "connection test" on plugin start up and config change that will error out if the connection fails |
I think it should be a complete copy of the code the handles the MMserver S3 config. Re-use the structs, copy the system console UI. |
@wiggin77 Sure sounds good to me 👍 |
The "plugin settings" page now functions like the "file storage" page with the s3 bucket configuration legal-hold-system-console.mov |
server/api.go
Outdated
go p.legalHoldJob.RunFromAPI() | ||
} | ||
|
||
// we'll want to store the access secret encrypted in the database |
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 put this comment here since right now the UI will be given the stored access secret on page load. Though there is no chance to encrypt/decrypt the config value in the case of saving config values in the system console. Not sure how to proceed with hiding the secret even though it's in plaintext in the server config, and is exposed to the client directly.
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.
How is it done in the main mmserver S3 config?
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.
@wiggin77 The server's config is sanitized before being returned the client, which in this case includes censoring the main product's AWS secret key. But this sanitization step is not available for plugin settings, so they are always delivered as plaintext.
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.
Created a ticket to address this #54
@cwarnermm This PR will require an addition to the Legal Hold plugin docs. |
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.
Good addition.
My only nit/feature request after checking this locally (not for this PR, more like a wishlist): How difficult could it be to visually group the S3 settings and only show the configuration ones if the custom S3 bucket is enabled?
@fmartingr I actually did it that way first but changed it to match the way the primary s3 bucket is configured in the system console. Maybe we could have a more intentional way to do this, like a "show/hide settings" button. So the admin could have them hidden even though a custom bucket is configured |
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.
LGTM 👍
Summary
This PR makes it so the admin can configure the plugin to store the Legal Hold artifacts in a different S3 Bucket than the one that's currently being used by the Mattermost server. The following fields are filled out by the UI, which is a subset of
model.FileSettings
. The backend of the plugin uses unmarshals this as amodel.FileSettings
struct and uses it as such.Ticket Link
Fixex #12