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

[Cases] Adding files configuration fields #154013

Merged
merged 12 commits into from
Apr 3, 2023

Conversation

jonathan-buttner
Copy link
Contributor

@jonathan-buttner jonathan-buttner commented Mar 30, 2023

Fixes: #151935

This PR allows the mime types and max file size for the files functionality within cases to be configured through the kibana.yml. We set the defaults maxSize to be 100 mb and if it is not set by the user we also restrict images to be 10 mb. If the maxSize is set by the user we use it for all mime types including images (or whatever the user has specified in allowedMimeTypes).

The file service changes are just mocks to help with testing some of the configuration options.

New fields

{
  files: {
    allowedMimeTypes: string[]
    maxSize: positive number (minimum 0) <-- exposed to the browser
  }
}

Release Notes

Cases added two configuration options to allow users to control which files mime types are allowed to be attached to cases and the approved max size of a file being upload.

xpack.cases.files.allowedMimeTypes - An array of strings representing the allowed mime types to be attached to a case.
xpack.cases.files.maxSize - A number representing the file size limit for files being attached to a case (in bytes).

@jonathan-buttner jonathan-buttner added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature release_note:feature Makes this part of the condensed release notes v8.8.0 labels Mar 30, 2023
@jonathan-buttner jonathan-buttner marked this pull request as ready for review March 31, 2023 20:52
@jonathan-buttner jonathan-buttner requested review from a team as code owners March 31, 2023 20:52
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

describe('no mime types', () => {
const schema = ConfigSchema.validate({ files: { allowedMimeTypes: [] } });

it('sets the cases file kind allowed mime types to only image png', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: sets the cases file kind allowed to no mime types

Copy link
Member

@cnasikas cnasikas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LTGM!

@cnasikas cnasikas mentioned this pull request Apr 3, 2023
5 tasks
Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/plugins/files lgtm !

@kc13greiner kc13greiner self-requested a review April 3, 2023 14:13
@kc13greiner
Copy link
Contributor

@jonathan-buttner How do I attach a file to a case? 😅 I can't seem to find the control

Copy link
Contributor

@kc13greiner kc13greiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cases 567 566 -1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cases 134.1KB 132.6KB -1.5KB
Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 432 435 +3

Total ESLint disabled count

id before after diff
securitySolution 512 515 +3

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jonathan-buttner jonathan-buttner merged commit 234d48d into elastic:main Apr 3, 2023
@jonathan-buttner jonathan-buttner deleted the cases-files-config branch April 3, 2023 19:01
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 3, 2023
jonathan-buttner added a commit that referenced this pull request Apr 12, 2023
This PR adds the new configuration settings to the docs. The
configurations were added in this PR:
#154013

---------

Co-authored-by: lcawl <lcawley@elastic.co>
jonathan-buttner added a commit that referenced this pull request Apr 19, 2023
This PR adds the follow cases config options from this PR to the docker
script.

#154013

```
    xpack.cases.files.allowedMimeTypes
    xpack.cases.files.maxSize
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Cases Cases feature release_note:feature Makes this part of the condensed release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cases] Make size limit and allowed file types configurable
7 participants