Open Bug 2095074 Opened 15 days ago Updated 1 day ago

Implement the LookupCacheV5 for the SafeBrowsing V5

Categories

(Toolkit :: Safe Browsing, task)

task

Tracking

()

REOPENED

People

(Reporter: timhuang, Assigned: timhuang, NeedInfo)

References

(Blocks 2 open bugs)

Details

Attachments

(5 external files)

V5 tables reuse LookupCacheV4, so each V5 table keeps its own full-hash cache and V5 completions are filtered to the table that asked. hashes.search returns every threat type for a prefix, so a completion for one table throws away what it learned for the others, and the same prefix can be completed again for another table.

This bug adds LookupCacheV5 so that V5 tables share one full-hash cache, owned by the Classifier, instead of keeping one per table. The real-time mode will depend on this shared cache.

Assignee: nobody → tihuang
Status: NEW → ASSIGNED

This patch moves nsUrlClassifierHashCompleterBase into its own files
without changing its code. The following patches extend it with the V5
completion callback.

This patch moves the full hash cache of LookupCache, with its check,
expiry sweep, cache info and dump logic, into a FullHashCache class that
LookupCache holds as a member. Behavior doesn't change. The following
patches add a V5 cache on top of FullHashCache that isn't tied to one
LookupCache.

This patch clears mLastResults in nsUrlClassifierDBServiceWorker::ClearCache().
CacheCompletions() skips a result set that equals the last one it cached,
but ClearCache() emptied the caches without forgetting that set. If the
same prefix was completed again within the same second after a clear, the
result was never cached and the next lookup sent another completion
request.

This patch adds ParseSearchHashesResponse(), which turns a V5
SearchHashesResponse into the returned full hashes, each with a bitmask of
its threat types, and the cache duration. The following patch uses it for
V5 completions in place of the parser in nsUrlClassifierUtils.

The parser drops a FullHashDetail with an unknown threat type or with any
attribute, because CANARY must not be enforced, FRAME_ONLY never applies
to top-level loads, and unknown attributes must be disregarded. Like the
parser it replaces, it reads a missing cache_duration as 0 seconds and
skips a full hash that isn't 32 bytes instead of failing the response.

makeSearchHashesResponseV5 replaces the test utility
makeFindFullHashResponseV5 and can build responses with several threat
types per full hash.

This patch adds V5FullHashCache, one full hash cache owned by the
Classifier, and LookupCacheV5 for the V5 tables with a threat type, which
read it. hashes.search returns every threat type of a prefix, so a
completion for one table now also answers the others. A table is only
confirmed when the full hash carries its threat type. Tables without one,
such as goog-badbinurl-proto, stay LookupCacheV4 tables.

Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/91e7fcaf0d0b https://hg.mozilla.org/integration/autoland/rev/e6a3794207ab Revert "Bug 2095074 - Part 5: Share one full hash cache between the V5 tables. r=dimi" for causing build bustages @TestV5FullHashCache.cpp.

Backed out for causing build bustages @TestV5FullHashCache.cpp.

Flags: needinfo?(tihuang)
Pushed by abutkovits@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/04739ed73236 https://hg.mozilla.org/mozilla-central/rev/d0fa58d362b1 Revert "Bug 2095074 - Part 5: Share one full hash cache between the V5 tables. r=dimi" for causing build bustages @TestV5FullHashCache.cpp.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 164 Branch → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: