Skip to content

Resolve "Avatar Content type does not match file extension"

What does this MR do?

Replace file type check with content whitelist. E.g old "file type" check asks if dog.jpg is really a jpeg.

This MR removes that from avatar and favicon uploaders and replaces with a content whitelist. E.g. regardless of filename, we're only letting through jpeg's.

Created a ContentTypeWhitelist to bring forward the whitelist feature available in Carrierwave 2 but not in the current 1.3.1 version.

DesignV432x230Uploader assumed we were running with CarrierWave 2 behavior. Specs added to confirm patch improvements function as assumed.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #200107 (closed)

Edited by Alex Pooley

Merge request reports