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

fix: Static gzip Media Signature #46

Merged
merged 1 commit into from
Dec 13, 2022
Merged

fix: Static gzip Media Signature #46

merged 1 commit into from
Dec 13, 2022

Conversation

jshlbrd
Copy link
Collaborator

@jshlbrd jshlbrd commented Dec 13, 2022

Description

  • Adds a static media signature for application/x-gzip

Motivation and Context

There is an occasional media identification bug when retrieving compressed CloudTrail files from AWS S3 -- http.DetectContentType incorrectly identifies the media type as application/vnd.ms-fontobject. The bug is rare (at Brex we process more than 100k compressed CloudTrail files every day and we see the bug, at most, once every few months) but it needs to be fixed because it results in data loss.

How Has This Been Tested?

The fix was integration tested with a CloudTrail file known to trigger the false match.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@jshlbrd jshlbrd changed the title fix: ms-fontobject False Positive fix: Static gzip Media Signature Dec 13, 2022
@jshlbrd jshlbrd marked this pull request as ready for review December 13, 2022 01:01
@jshlbrd jshlbrd requested a review from a team as a code owner December 13, 2022 01:01
Copy link
Contributor

@shellcromancer shellcromancer left a comment

Choose a reason for hiding this comment

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

Looks good! If we have a small, sanitized file it would be great to have a test recognizing the content-type.

@jshlbrd
Copy link
Collaborator Author

jshlbrd commented Dec 13, 2022

Looks good! If we have a small, sanitized file it would be great to have a test recognizing the content-type.

We have test coverage for the function that correctly identifies gzip, but a public test file for the fix itself probably isn't a good idea -- it can't be sanitized without changing the MIME type (gunzip -> gzip), which would most likely corrupt the test.

That mentioned, we can host it internally for our own integration tests.

@jshlbrd jshlbrd merged commit 56016f2 into main Dec 13, 2022
@jshlbrd jshlbrd deleted the jshlbrd/fix/media-gzip branch December 13, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants