Skip to content

Reduce msi false-positives#225

Merged
sindresorhus merged 2 commits intosindresorhus:masterfrom
HugoDF:fix/msi-false-positive
Aug 15, 2019
Merged

Reduce msi false-positives#225
sindresorhus merged 2 commits intosindresorhus:masterfrom
HugoDF:fix/msi-false-positive

Conversation

@HugoDF
Copy link
Contributor

@HugoDF HugoDF commented Jul 6, 2019

Closes #162

See #162 (comment)

Hi, is anyone able to provide true positive .msi files?

Using the following check I've been able to detect msi-es (that I've found) without having a false positive on .doc, .xls or .ppt

Full disclosure: I started with the commented out magic bytes from #162 (comment) but ended up just reading the byte stream of msi files.

check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x04, 0x00, 0xFE, 0xFF, 0x0C, 0x00, 0x06])

To get the tests passing the check is actually:

check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x03, 0x00, 0xFE, 0xFF, 0x09, 0x00, 0x06])

I'm shortening it to make it the largest subset of both ie.

check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E])

I've got sample .ppt, .doc and .xls that I've tested this against and that don't return positive, how would I go about integrating them into the test suite @sindresorhus ?


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@sindresorhus
Copy link
Owner

We don't currently have any false-positive tests, but it shouldn't be hard to add here: https://github.com/sindresorhus/file-type/blob/43d3cd63b46ee7bc3d2c8cc7bfd0788f7291cec4/test.js

@HugoDF
Copy link
Contributor Author

HugoDF commented Jul 13, 2019

@sindresorhus added support for false positive tests + corresponding fixture files

Let me know if there's anything else.

@sindresorhus sindresorhus changed the title reduce msi false positives (longer check) Reduce msi false-positives Aug 15, 2019
@sindresorhus sindresorhus merged commit 702f795 into sindresorhus:master Aug 15, 2019
@HugoDF HugoDF deleted the fix/msi-false-positive branch August 15, 2019 15:07
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.

False-positives for the msi detection

2 participants