Closed Bug 402610 Opened 17 years ago Closed 17 years ago

support redirected chunk data in safebrowsing updates

Categories

(Toolkit :: Safe Browsing, defect, P1)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: dcamp, Assigned: dcamp)

References

()

Details

Attachments

(2 files, 1 obsolete file)

Google is considering updating the safebrowsing protocol to allow inline chunk data to be replaced with a URL for the chunk data. We'll need to update the url-classifier service to deal with that correctly.
Flags: blocking-firefox3?
Will block on this if it goes forward, wanted to keep it on radar.
Flags: blocking-firefox3? → wanted-firefox3+
Depends on: 407759
This is a small helper patch that I'll be using in the actual patch. This patch allocates a single proxy for accessing the worker thread and reuses it, rather than allocating a new proxy for each worker thread request.
Attached patch v1 (obsolete) — Splinter Review
This patch adds support for u: lines as specified in v2.1 of the safebrowsing spec. I haven't been able to test it against google's live server (it isn't running quite yet) so I'm not asking for review yet.
Assignee: nobody → dcamp
Status: NEW → ASSIGNED
re-asking for blocking-firefox3. This change will be happening on google's servers shortly.
Flags: blocking-firefox3?
Flags: blocking-firefox3? → blocking-firefox3+
Priority: -- → P1
Comment on attachment 293216 [details] [diff] [review] v1 The servers are now up and running and this patch has been tested against it, so I'm asking for review.
Attachment #293216 - Attachment description: untested patch → v1
Attachment #293216 - Flags: review?(tony)
Comment on attachment 293216 [details] [diff] [review] v1 >diff -r 0d7cd50fd002 toolkit/components/url-classifier/public/nsIUrlClassifierDBService.idl > /** >+ * The nsIUrlClassifierUpdateObserver interface is implemented by >+ * clients streaming updates to the url-classifier (usually >+ * nsUrlClassifierStreamUpdater. >+ */ >+[scriptable, uuid(113671b8-c5cc-47d9-bc57-269568c7ce29)] >+interface nsIUrlClassifierUpdateObserver : nsISupports { Nice refactoring into an interface. > /** >+ * Begin an update process. >+ */ >+ void beginUpdate(in nsIUrlClassifierUpdateObserver updater); It might be nice to add some comments explaining updates and streams. > /** >+ * Finish an individual stream update. Must be called for every >+ * beginStream() call, before the next bingStream() or finishUpdate(). >+ * >+ * The update observer's streamFinished will be called once the >+ * stream has been processed. Typo: bingStream. >diff -r 0d7cd50fd002 toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.cpp >+NS_IMETHODIMP >+nsUrlClassifierStreamUpdater::StreamFinished() >+{ >+ nsresult rv; >+ >+ // Pop off a pending URL and update it. >+ if (mPendingUpdateUrls.Length() > 0) { >+ rv = FetchUpdate(mPendingUpdateUrls[0], NS_LITERAL_CSTRING("")); >+ if (NS_FAILED(rv)) { >+ LOG(("Error fetching update url: %s\n", mPendingUpdateUrls[0].get())); >+ mDBService->CancelUpdate(); >+ return rv; >+ } It looks like a malformed URL will cause the whole update to be canceled. Is that intended (i.e., maybe we should just ignore and try the next pending update?). Also, shouldn't this be a while loop so we try all the URLs? It would be nice to add a unittest for this case. >+NS_IMETHODIMP >+nsUrlClassifierStreamUpdater::UpdateSuccess(PRUint32 requestedTimeout) >+{ >+ LOG(("nsUrlClassifierStreamUpdater::UpdateSuccess [this=%p]", this)); >+ NS_ASSERTION(mPendingUpdateUrls.Length() == 0, >+ "Didn't fetch all update URLs."); >+ >+ nsCOMPtr<nsIUrlClassifierCallback> successCallback = mSuccessCallback; >+ DownloadDone(); There should be a comment explaining you need to cache mSuccessCallback because DownloadDone clears it. >+NS_IMETHODIMP >+nsUrlClassifierStreamUpdater::UpdateError(PRUint32 result) >+{ >+ LOG(("nsUrlClassifierStreamUpdater::UpdateSuccess [this=%p]", this)); >+ >+ nsCOMPtr<nsIUrlClassifierCallback> errorCallback = mUpdateErrorCallback; >+ DownloadDone(); Same as above.
Attachment #293216 - Flags: review?(tony) → review+
Attachment #293215 - Flags: review?(tony)
Attachment #293215 - Flags: review?(tony) → review+
Attached patch v2Splinter Review
Attachment #293216 - Attachment is obsolete: true
(In reply to comment #6) > It might be nice to add some comments explaining updates and streams. Added. > Typo: bingStream. Fixed. > It looks like a malformed URL will cause the whole update to be canceled. Is > that intended (i.e., maybe we should just ignore and try the next pending > update?). As discussed on IRC, this was intended. > Also, shouldn't this be a while loop so we try all the URLs? It would be nice > to add a unittest for this case. We don't need a while loop here. We only start the download for one stream at a time. > There should be a comment explaining you need to cache mSuccessCallback because > DownloadDone clears it. Fixed, along with the UpdateError() one.
Checking in browser/app/profile/firefox.js; /cvsroot/mozilla/browser/app/profile/firefox.js,v <-- firefox.js new revision: 1.252; previous revision: 1.251 done Checking in browser/components/safebrowsing/content/malware-warden.js; /cvsroot/mozilla/browser/components/safebrowsing/content/malware-warden.js,v <-- malware-warden.js new revision: 1.3; previous revision: 1.2 done Checking in toolkit/components/url-classifier/public/nsIUrlClassifierDBService.idl; /cvsroot/mozilla/toolkit/components/url-classifier/public/nsIUrlClassifierDBService.idl,v <-- nsIUrlClassifierDBService.idl new revision: 1.14; previous revision: 1.13 done Checking in toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp; /cvsroot/mozilla/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp,v <-- nsUrlClassifierDBService.cpp new revision: 1.48; previous revision: 1.47 done Checking in toolkit/components/url-classifier/src/nsUrlClassifierDBService.h; /cvsroot/mozilla/toolkit/components/url-classifier/src/nsUrlClassifierDBService.h,v <-- nsUrlClassifierDBService.h new revision: 1.7; previous revision: 1.6 done Checking in toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.cpp; /cvsroot/mozilla/toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.cpp,v <-- nsUrlClassifierStreamUpdater.cpp new revision: 1.13; previous revision: 1.12 done Checking in toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.h; /cvsroot/mozilla/toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.h,v <-- nsUrlClassifierStreamUpdater.h new revision: 1.9; previous revision: 1.8 done Checking in toolkit/components/url-classifier/tests/unit/head_urlclassifier.js; /cvsroot/mozilla/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js,v <-- head_urlclassifier.js new revision: 1.5; previous revision: 1.4 done Checking in toolkit/components/url-classifier/tests/unit/test_addsub.js; /cvsroot/mozilla/toolkit/components/url-classifier/tests/unit/test_addsub.js,v <-- test_addsub.js new revision: 1.2; previous revision: 1.1 done Checking in toolkit/components/url-classifier/tests/unit/test_dbservice.js; /cvsroot/mozilla/toolkit/components/url-classifier/tests/unit/test_dbservice.js,v <-- test_dbservice.js new revision: 1.9; previous revision: 1.8 done RCS file: /cvsroot/mozilla/toolkit/components/url-classifier/tests/unit/test_streamupdater.js,v done Checking in toolkit/components/url-classifier/tests/unit/test_streamupdater.js; /cvsroot/mozilla/toolkit/components/url-classifier/tests/unit/test_streamupdater.js,v <-- test_streamupdater.js initial revision: 1.1 done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Depends on: 412392
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: