Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Issue 2961373002: Improve Zip File Scanning on Mac (Closed)

Created:
3 years, 5 months ago by mortonm
Modified:
3 years, 4 months ago
CC:
Robert Sesek, chromium-reviews, grt+watch_chromium.org, timvolodine, vakh+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Improve Zip File Scanning on Mac This CL fixes two aspects of broken ZIP processing on Mac. First, it ensures that .app files are treated as directories and as such do not break binary feature extraction, causing analysis to fail. Second, it performs type-sniffing to identify the existence of executable MachO files that do not have any file extension, as is the usual case on Mac. BUG=600392 Review-Url: https://codereview.chromium.org/2961373002 Cr-Commit-Position: refs/heads/master@{#492032} Committed: https://chromium.googlesource.com/chromium/src/+/034ecb569929e1202f39cf744a32e8deeade06c8

Patch Set 1 : crude magic check working #

Patch Set 2 : gonna implement cap first before moving on #

Patch Set 3 : removed temp dir stuff #

Patch Set 4 : addressing comments #

Patch Set 5 : added makefile #

Patch Set 6 : changing name of executable in zip #

Patch Set 7 : ready for review #

Patch Set 8 : improving readability in zip_analyzer.cc #

Patch Set 9 : removing check for .app on windows #

Total comments: 4

Patch Set 10 : addressing comments #

Patch Set 11 : addressing comments #

Patch Set 12 : addressing comments #

Total comments: 7

Patch Set 13 : refactoring in zip_reader #

Total comments: 6

Patch Set 14 : comment on return value #

Patch Set 15 : incorporating new zip_reader functionality into existing functions #

Patch Set 16 : adding debug statements for android #

Patch Set 17 : debugging int64_t on android #

Total comments: 4

Patch Set 18 : removing argument from ExtractCurrentEntryToString() #

Patch Set 19 : minor #

Total comments: 10

Patch Set 20 : slight refactoring in zip_reader #

Total comments: 4

Patch Set 21 : testing #

Patch Set 22 : avoiding multiple calls to unzReadCurrentFile #

Total comments: 22

Patch Set 23 : addressing comments #

Total comments: 6

Patch Set 24 : final mods #

Total comments: 12

Patch Set 25 : comments #

Total comments: 2

Patch Set 26 : minor #

Unified diffs Side-by-side diffs Delta from patch set Stats (+262 lines, -58 lines) Patch
M chrome/browser/safe_browsing/sandboxed_zip_analyzer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 13 chunks +93 lines, -11 lines 0 comments Download
M chrome/common/safe_browsing/zip_analyzer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 6 chunks +49 lines, -6 lines 0 comments Download
M chrome/test/data/safe_browsing/mach_o/Makefile View 1 2 3 4 5 6 7 8 9 10 1 chunk +7 lines, -0 lines 0 comments Download
A chrome/test/data/safe_browsing/mach_o/zipped-app-two-executables-one-signed.zip View 1 2 3 4 5 6 7 8 9 10 Binary file 0 comments Download
M third_party/zlib/google/zip_reader.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +19 lines, -16 lines 0 comments Download
M third_party/zlib/google/zip_reader.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 5 chunks +43 lines, -18 lines 0 comments Download
M third_party/zlib/google/zip_reader_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 4 chunks +51 lines, -7 lines 0 comments Download

Messages

Total messages: 188 (152 generated)
mortonm
3 years, 5 months ago (2017-07-12 17:34:50 UTC) #10
Jialiu Lin
Looking good :-) https://codereview.chromium.org/2961373002/diff/260001/chrome/common/safe_browsing/zip_analyzer.cc File chrome/common/safe_browsing/zip_analyzer.cc (right): https://codereview.chromium.org/2961373002/diff/260001/chrome/common/safe_browsing/zip_analyzer.cc#newcode70 chrome/common/safe_browsing/zip_analyzer.cc:70: LOG(ERROR) << "macho?: " << (bytes.compare("\xcf\xfa\xed\xfe") ...
3 years, 5 months ago (2017-07-12 17:57:11 UTC) #11
mortonm
https://codereview.chromium.org/2961373002/diff/260001/chrome/common/safe_browsing/zip_analyzer.cc File chrome/common/safe_browsing/zip_analyzer.cc (right): https://codereview.chromium.org/2961373002/diff/260001/chrome/common/safe_browsing/zip_analyzer.cc#newcode70 chrome/common/safe_browsing/zip_analyzer.cc:70: LOG(ERROR) << "macho?: " << (bytes.compare("\xcf\xfa\xed\xfe") == 0); On ...
3 years, 5 months ago (2017-07-12 18:15:06 UTC) #12
mortonm
On 2017/07/12 18:15:06, mortonm wrote: > https://codereview.chromium.org/2961373002/diff/260001/chrome/common/safe_browsing/zip_analyzer.cc > File chrome/common/safe_browsing/zip_analyzer.cc (right): > > https://codereview.chromium.org/2961373002/diff/260001/chrome/common/safe_browsing/zip_analyzer.cc#newcode70 > ...
3 years, 5 months ago (2017-07-12 18:55:51 UTC) #14
mortonm
adding satorux@ as OWNER for: third_party/zlib/google/zip_reader.cc third_party/zlib/google/zip_reader.h
3 years, 5 months ago (2017-07-13 16:42:51 UTC) #25
satorux1
+palmer Does this scanning code run in the browser process or in a separate process? ...
3 years, 5 months ago (2017-07-14 01:00:53 UTC) #49
mortonm
All of the code in zip_analyzer.cc, including calling zip_reader functionality, runs in a sandboxed utility ...
3 years, 5 months ago (2017-07-14 17:08:45 UTC) #50
palmer
https://codereview.chromium.org/2961373002/diff/650001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/650001/third_party/zlib/google/zip_reader.cc#newcode362 third_party/zlib/google/zip_reader.cc:362: total_num_bytes_read += base::checked_cast<size_t>(num_bytes_read); Should |total_num_bytes_read| be a |base::CheckedNumeric<size_t>| ?
3 years, 5 months ago (2017-07-17 18:44:49 UTC) #70
mortonm
https://codereview.chromium.org/2961373002/diff/650001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/650001/third_party/zlib/google/zip_reader.cc#newcode362 third_party/zlib/google/zip_reader.cc:362: total_num_bytes_read += base::checked_cast<size_t>(num_bytes_read); On 2017/07/17 18:44:49, palmer wrote: > ...
3 years, 5 months ago (2017-07-17 20:41:45 UTC) #75
satorux1
sorry for the belated response. https://codereview.chromium.org/2961373002/diff/690001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/690001/third_party/zlib/google/zip_reader.cc#newcode328 third_party/zlib/google/zip_reader.cc:328: bool ZipReader::ExtractPartOfCurrentEntry(WriterDelegate* delegate, This ...
3 years, 5 months ago (2017-07-18 07:46:38 UTC) #82
mortonm
https://codereview.chromium.org/2961373002/diff/690001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/690001/third_party/zlib/google/zip_reader.cc#newcode328 third_party/zlib/google/zip_reader.cc:328: bool ZipReader::ExtractPartOfCurrentEntry(WriterDelegate* delegate, On 2017/07/18 07:46:37, satorux1 wrote: > ...
3 years, 5 months ago (2017-07-18 19:58:49 UTC) #85
satorux1
sorry for the belated response again https://codereview.chromium.org/2961373002/diff/710001/chrome/common/safe_browsing/zip_analyzer.cc File chrome/common/safe_browsing/zip_analyzer.cc (right): https://codereview.chromium.org/2961373002/diff/710001/chrome/common/safe_browsing/zip_analyzer.cc#newcode143 chrome/common/safe_browsing/zip_analyzer.cc:143: reader.ExtractFromBeginningOfCurrentEntryToString(sizeof(uint32_t), false, Sorry ...
3 years, 5 months ago (2017-07-21 05:27:02 UTC) #92
mortonm
https://codereview.chromium.org/2961373002/diff/710001/chrome/common/safe_browsing/zip_analyzer.cc File chrome/common/safe_browsing/zip_analyzer.cc (right): https://codereview.chromium.org/2961373002/diff/710001/chrome/common/safe_browsing/zip_analyzer.cc#newcode143 chrome/common/safe_browsing/zip_analyzer.cc:143: reader.ExtractFromBeginningOfCurrentEntryToString(sizeof(uint32_t), false, On 2017/07/21 05:27:02, satorux1 wrote: > Sorry ...
3 years, 5 months ago (2017-07-21 16:29:57 UTC) #93
satorux1
https://codereview.chromium.org/2961373002/diff/710001/chrome/common/safe_browsing/zip_analyzer.cc File chrome/common/safe_browsing/zip_analyzer.cc (right): https://codereview.chromium.org/2961373002/diff/710001/chrome/common/safe_browsing/zip_analyzer.cc#newcode143 chrome/common/safe_browsing/zip_analyzer.cc:143: reader.ExtractFromBeginningOfCurrentEntryToString(sizeof(uint32_t), false, On 2017/07/21 16:29:56, mortonm wrote: > On ...
3 years, 5 months ago (2017-07-21 23:00:09 UTC) #94
mortonm
https://codereview.chromium.org/2961373002/diff/710001/chrome/common/safe_browsing/zip_analyzer.cc File chrome/common/safe_browsing/zip_analyzer.cc (right): https://codereview.chromium.org/2961373002/diff/710001/chrome/common/safe_browsing/zip_analyzer.cc#newcode143 chrome/common/safe_browsing/zip_analyzer.cc:143: reader.ExtractFromBeginningOfCurrentEntryToString(sizeof(uint32_t), false, On 2017/07/21 23:00:09, satorux1 wrote: > On ...
3 years, 5 months ago (2017-07-24 17:51:44 UTC) #97
satorux1
Thank you for revising the patch. I think it's getting close. I have a request ...
3 years, 5 months ago (2017-07-25 07:55:15 UTC) #108
mortonm
https://codereview.chromium.org/2961373002/diff/780001/third_party/zlib/google/zip_reader.h File third_party/zlib/google/zip_reader.h (right): https://codereview.chromium.org/2961373002/diff/780001/third_party/zlib/google/zip_reader.h#newcode220 third_party/zlib/google/zip_reader.h:220: // |max_read_bytes|. Otherwise if |read_entire_file| is false, |num_bytes| On ...
3 years, 5 months ago (2017-07-25 18:10:16 UTC) #113
satorux1
https://codereview.chromium.org/2961373002/diff/820001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/820001/third_party/zlib/google/zip_reader.cc#newcode302 third_party/zlib/google/zip_reader.cc:302: bool entire_file_extracted = true; start with false and set ...
3 years, 4 months ago (2017-07-27 07:05:32 UTC) #120
satorux1
https://codereview.chromium.org/2961373002/diff/820001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/820001/third_party/zlib/google/zip_reader.cc#newcode335 third_party/zlib/google/zip_reader.cc:335: if (total_num_bytes_read == num_bytes_to_extract) { On 2017/07/27 07:05:31, satorux1 ...
3 years, 4 months ago (2017-07-27 07:10:28 UTC) #121
mortonm
https://codereview.chromium.org/2961373002/diff/820001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/820001/third_party/zlib/google/zip_reader.cc#newcode302 third_party/zlib/google/zip_reader.cc:302: bool entire_file_extracted = true; On 2017/07/27 07:05:31, satorux1 wrote: ...
3 years, 4 months ago (2017-07-27 18:32:01 UTC) #123
Jialiu Lin
Thanks satorux1@ for your thorough review! Really appreciate your effort. BTW, do we still need ...
3 years, 4 months ago (2017-07-27 18:34:41 UTC) #126
palmer
lgtm
3 years, 4 months ago (2017-07-27 18:57:26 UTC) #127
satorux1
https://codereview.chromium.org/2961373002/diff/860001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/860001/third_party/zlib/google/zip_reader.cc#newcode329 third_party/zlib/google/zip_reader.cc:329: unzReadCurrentFile(zip_file_, buf.get(), 1) == 0) { I thought we ...
3 years, 4 months ago (2017-07-27 23:18:10 UTC) #132
mortonm
Hi satorux1@, thanks for the help on this CL! I am close to finishing my ...
3 years, 4 months ago (2017-07-31 18:13:04 UTC) #141
satorux1
https://codereview.chromium.org/2961373002/diff/860001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/860001/third_party/zlib/google/zip_reader.cc#newcode329 third_party/zlib/google/zip_reader.cc:329: unzReadCurrentFile(zip_file_, buf.get(), 1) == 0) { On 2017/07/31 18:13:04, ...
3 years, 4 months ago (2017-08-01 08:01:09 UTC) #144
mortonm
https://codereview.chromium.org/2961373002/diff/860001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/860001/third_party/zlib/google/zip_reader.cc#newcode329 third_party/zlib/google/zip_reader.cc:329: unzReadCurrentFile(zip_file_, buf.get(), 1) == 0) { On 2017/08/01 08:01:08, ...
3 years, 4 months ago (2017-08-01 16:16:47 UTC) #147
satorux1
zlib stuff lgtm with some requests: https://codereview.chromium.org/2961373002/diff/920001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/920001/third_party/zlib/google/zip_reader.cc#newcode315 third_party/zlib/google/zip_reader.cc:315: if (num_bytes_read < ...
3 years, 4 months ago (2017-08-03 08:36:48 UTC) #154
satorux1
https://codereview.chromium.org/2961373002/diff/920001/third_party/zlib/google/zip_reader_unittest.cc File third_party/zlib/google/zip_reader_unittest.cc (right): https://codereview.chromium.org/2961373002/diff/920001/third_party/zlib/google/zip_reader_unittest.cc#newcode743 third_party/zlib/google/zip_reader_unittest.cc:743: } On 2017/08/03 08:36:48, satorux1 wrote: > I's suggest ...
3 years, 4 months ago (2017-08-03 08:47:03 UTC) #155
mortonm
Thanks! https://codereview.chromium.org/2961373002/diff/920001/third_party/zlib/google/zip_reader.cc File third_party/zlib/google/zip_reader.cc (right): https://codereview.chromium.org/2961373002/diff/920001/third_party/zlib/google/zip_reader.cc#newcode315 third_party/zlib/google/zip_reader.cc:315: if (num_bytes_read < 0) { On 2017/08/03 08:36:48, ...
3 years, 4 months ago (2017-08-03 15:01:23 UTC) #165
mortonm
3 years, 4 months ago (2017-08-03 15:04:34 UTC) #166
Robert Sesek
Note on the CL description: The "Subject" in Rietveld does not get included in the ...
3 years, 4 months ago (2017-08-03 15:43:36 UTC) #168
mortonm
https://codereview.chromium.org/2961373002/diff/940001/chrome/browser/safe_browsing/sandboxed_zip_analyzer_unittest.cc File chrome/browser/safe_browsing/sandboxed_zip_analyzer_unittest.cc (right): https://codereview.chromium.org/2961373002/diff/940001/chrome/browser/safe_browsing/sandboxed_zip_analyzer_unittest.cc#newcode104 chrome/browser/safe_browsing/sandboxed_zip_analyzer_unittest.cc:104: ASSERT_EQ(data.is_signed, binary.has_signature()); On 2017/08/03 15:43:35, Robert Sesek wrote: > ...
3 years, 4 months ago (2017-08-03 17:09:13 UTC) #171
Robert Sesek
LGTM https://codereview.chromium.org/2961373002/diff/960001/chrome/common/safe_browsing/zip_analyzer.cc File chrome/common/safe_browsing/zip_analyzer.cc (right): https://codereview.chromium.org/2961373002/diff/960001/chrome/common/safe_browsing/zip_analyzer.cc#newcode21 chrome/common/safe_browsing/zip_analyzer.cc:21: #include "chrome/common/safe_browsing/mach_o_image_reader_mac.h" I think this will probably need ...
3 years, 4 months ago (2017-08-03 18:36:31 UTC) #173
mortonm
https://codereview.chromium.org/2961373002/diff/960001/chrome/common/safe_browsing/zip_analyzer.cc File chrome/common/safe_browsing/zip_analyzer.cc (right): https://codereview.chromium.org/2961373002/diff/960001/chrome/common/safe_browsing/zip_analyzer.cc#newcode21 chrome/common/safe_browsing/zip_analyzer.cc:21: #include "chrome/common/safe_browsing/mach_o_image_reader_mac.h" On 2017/08/03 18:36:31, Robert Sesek wrote: > ...
3 years, 4 months ago (2017-08-03 18:45:22 UTC) #176
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2961373002/980001
3 years, 4 months ago (2017-08-04 14:53:57 UTC) #185
commit-bot: I haz the power
3 years, 4 months ago (2017-08-04 14:58:14 UTC) #188
Message was sent while issue was closed.
Committed patchset #26 (id:980001) as
https://chromium.googlesource.com/chromium/src/+/034ecb569929e1202f39cf744a32...

Powered by Google App Engine
This is Rietveld 408576698