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

Issue 6683060: Private API for extensions like ssh-client that need access to TCP. (Closed)

Created:
9 years, 9 months ago by Denis Lagno
Modified:
9 years, 6 months ago
CC:
chromium-reviews, Erik does not do reviews, Paweł Hajdan Jr., pam+watch_chromium.org, brettw-cc_chromium.org, Nikita (slow), Mihai Parparita -not on Chrome
Visibility:
Public.

Description

Private API for extensions like ssh-client that need access to websocket-to-tcp proxy. Access to TCP is obtained in following way: (1) extension requests authentication token via call to private API like: chrome.webSocketProxyPrivate.getPassportForTCP('netbsd.org', 25, callback); if API validates this request then extension obtains some string token (in callback). (2) open websocket connection to local websocket-to-tcp proxy ws://127.0.0.1:10101/tcpproxy (3) pass header containing hostname, port and token obtained at step (1) (4) communicate (in base64 encoding at this moment). Proxy (running in chrome process) verifies those tokens by calls to InternalAuthVerification::VerifyPassport Passports are one-time; no passport can be reused. Passports expire in short period of time (20 seconds). BUG=chromium-os:9667 TEST=unit_test,apitest Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=85757

Patch Set 1 : sigh-nedness #

Total comments: 8

Patch Set 2 : fix #

Total comments: 7

Patch Set 3 : c #

Total comments: 12

Patch Set 4 : k #

Patch Set 5 : m #

Total comments: 6

Patch Set 6 : v #

Patch Set 7 : u #

Patch Set 8 : sync with ToT #

Patch Set 9 : launch webproxy on first call #

Patch Set 10 : fixed bugs + added apitest + rebased #

Total comments: 9

Patch Set 11 : synced with ToT #

Patch Set 12 : c #

Total comments: 18

Patch Set 13 : reflected comments #

Total comments: 6

Patch Set 14 : v #

Total comments: 5

Patch Set 15 : reflect comments + care about trailing slash in origin #

Patch Set 16 : removed changes to rand_util_unittest #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1174 lines, -82 lines) Patch
M chrome/browser/chromeos/web_socket_proxy.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/web_socket_proxy.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 chunks +30 lines, -23 lines 0 comments Download
M chrome/browser/chromeos/web_socket_proxy_controller.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +13 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/web_socket_proxy_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 chunks +92 lines, -10 lines 0 comments Download
M chrome/browser/extensions/extension_apitest.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_function_dispatcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +4 lines, -0 lines 0 comments Download
A chrome/browser/extensions/extension_web_socket_proxy_private_api.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +36 lines, -0 lines 0 comments Download
A chrome/browser/extensions/extension_web_socket_proxy_private_api.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +78 lines, -0 lines 0 comments Download
A chrome/browser/extensions/extension_web_socket_proxy_private_apitest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +19 lines, -0 lines 0 comments Download
A chrome/browser/internal_auth.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +74 lines, -0 lines 0 comments Download
A chrome/browser/internal_auth.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +480 lines, -0 lines 0 comments Download
A chrome/browser/internal_auth_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +199 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +4 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +5 lines, -2 lines 0 comments Download
M chrome/common/chrome_switches.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_switches.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/extension_api.json View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +38 lines, -0 lines 0 comments Download
M chrome/common/extensions/extension.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -1 line 0 comments Download
M chrome/common/extensions/extension.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +28 lines, -27 lines 0 comments Download
M chrome/common/extensions/extension_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/renderer/resources/renderer_extension_bindings.js View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -2 lines 0 comments Download
A chrome/test/data/extensions/api_test/web_socket_proxy_private/background.html View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +32 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/web_socket_proxy_private/manifest.json View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +8 lines, -0 lines 0 comments Download
M crypto/hmac.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -1 line 0 comments Download
M crypto/hmac_mac.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M crypto/hmac_nss.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M crypto/hmac_openssl.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M crypto/hmac_win.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M crypto/symmetric_key_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +11 lines, -7 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
Denis Lagno
please take first look. (it is still not very polished and lacks unittest).
9 years, 9 months ago (2011-03-29 00:13:57 UTC) #1
zel
http://codereview.chromium.org/6683060/diff/3018/base/crypto/symmetric_key_mac.cc File base/crypto/symmetric_key_mac.cc (right): http://codereview.chromium.org/6683060/diff/3018/base/crypto/symmetric_key_mac.cc#newcode73 base/crypto/symmetric_key_mac.cc:73: std::copy(random_data.Data, random_data.Data + num_bytes, out); you should avoid data ...
9 years, 9 months ago (2011-03-29 05:31:33 UTC) #2
Aaron Boodman
It seems like this extension function is not wired up yet. It still needs to ...
9 years, 9 months ago (2011-03-29 18:38:34 UTC) #3
Denis Lagno
http://codereview.chromium.org/6683060/diff/3018/base/crypto/symmetric_key_mac.cc File base/crypto/symmetric_key_mac.cc (right): http://codereview.chromium.org/6683060/diff/3018/base/crypto/symmetric_key_mac.cc#newcode73 base/crypto/symmetric_key_mac.cc:73: std::copy(random_data.Data, random_data.Data + num_bytes, out); On 2011/03/29 05:31:34, zel ...
9 years, 8 months ago (2011-04-04 18:18:02 UTC) #4
zel
LGTM with a nit below: http://codereview.chromium.org/6683060/diff/33042/chrome/browser/extensions/extension_web_proxy_private_api.cc File chrome/browser/extensions/extension_web_proxy_private_api.cc (right): http://codereview.chromium.org/6683060/diff/33042/chrome/browser/extensions/extension_web_proxy_private_api.cc#newcode33 chrome/browser/extensions/extension_web_proxy_private_api.cc:33: std::string id = extension_id(); ...
9 years, 8 months ago (2011-04-05 14:59:24 UTC) #5
Aaron Boodman
Am I missing something, or will this be enabled for every extension? That would be ...
9 years, 8 months ago (2011-04-06 03:49:00 UTC) #6
Denis Lagno
On 2011/04/06 03:49:00, Aaron Boodman wrote: > Am I missing something, or will this be ...
9 years, 8 months ago (2011-04-06 18:09:22 UTC) #7
Aaron Boodman
http://codereview.chromium.org/6683060/diff/43025/chrome/common/extensions/api/extension_api.json File chrome/common/extensions/api/extension_api.json (right): http://codereview.chromium.org/6683060/diff/43025/chrome/common/extensions/api/extension_api.json#newcode4686 chrome/common/extensions/api/extension_api.json:4686: "namespace": "webproxyPrivate", I just realized this: we already have ...
9 years, 8 months ago (2011-04-07 03:17:01 UTC) #8
zel
chromeosPrivate will be used for different purpose than this API - we are expecting that ...
9 years, 8 months ago (2011-04-07 03:59:42 UTC) #9
Aaron Boodman
On 2011/04/07 03:59:42, zel wrote: > chromeosPrivate will be used for different purpose than this ...
9 years, 8 months ago (2011-04-09 23:58:45 UTC) #10
Aaron Boodman
Also, you need tests. http://codereview.chromium.org/6683060/diff/43025/chrome/browser/extensions/extension_webproxy_private_api.cc File chrome/browser/extensions/extension_webproxy_private_api.cc (right): http://codereview.chromium.org/6683060/diff/43025/chrome/browser/extensions/extension_webproxy_private_api.cc#newcode15 chrome/browser/extensions/extension_webproxy_private_api.cc:15: bool CheckCredentials( I think you ...
9 years, 8 months ago (2011-04-10 00:04:43 UTC) #11
Denis Lagno
I've reflected all comments (and added apitest). AFAIK Aaron is on extended leave so if ...
9 years, 7 months ago (2011-05-13 22:02:52 UTC) #12
Dmitry Polukhin
http://codereview.chromium.org/6683060/diff/71065/chrome/browser/chromeos/web_socket_proxy_controller.cc File chrome/browser/chromeos/web_socket_proxy_controller.cc (right): http://codereview.chromium.org/6683060/diff/71065/chrome/browser/chromeos/web_socket_proxy_controller.cc#newcode46 chrome/browser/chromeos/web_socket_proxy_controller.cc:46: // Configure allowed origins. Empty vector allows any origin. ...
9 years, 7 months ago (2011-05-16 09:41:39 UTC) #13
Denis Lagno
Adding Chang as reviewer for crypto/ changes
9 years, 7 months ago (2011-05-16 10:40:36 UTC) #14
Denis Lagno
What is the rule for naming javascript api/permission private? In current codebase private apis are ...
9 years, 7 months ago (2011-05-16 18:03:45 UTC) #15
Erik does not do reviews
If it's restricted so that a random third party developer couldn't develop against it, then ...
9 years, 7 months ago (2011-05-16 20:27:58 UTC) #16
Denis Lagno
On 2011/05/16 20:27:58, Erik Kay wrote: > If it's restricted so that a random third ...
9 years, 7 months ago (2011-05-16 21:14:21 UTC) #17
Erik does not do reviews
On Mon, May 16, 2011 at 2:14 PM, <dilmah@chromium.org> wrote: > On 2011/05/16 20:27:58, Erik ...
9 years, 7 months ago (2011-05-16 21:34:08 UTC) #18
wtc
Review comments on the crypto/* files: 1. The changes to crypto/hmac* are good. 2. Please ...
9 years, 7 months ago (2011-05-16 23:23:29 UTC) #19
Dmitry Polukhin
http://codereview.chromium.org/6683060/diff/80006/chrome/browser/chromeos/web_socket_proxy.h File chrome/browser/chromeos/web_socket_proxy.h (right): http://codereview.chromium.org/6683060/diff/80006/chrome/browser/chromeos/web_socket_proxy.h#newcode25 chrome/browser/chromeos/web_socket_proxy.h:25: static const size_t kConnPoolLimit = 200; I think it ...
9 years, 7 months ago (2011-05-17 10:58:39 UTC) #20
Denis Lagno
http://codereview.chromium.org/6683060/diff/71065/chrome/browser/chromeos/web_socket_proxy_controller.cc File chrome/browser/chromeos/web_socket_proxy_controller.cc (right): http://codereview.chromium.org/6683060/diff/71065/chrome/browser/chromeos/web_socket_proxy_controller.cc#newcode46 chrome/browser/chromeos/web_socket_proxy_controller.cc:46: // Configure allowed origins. Empty vector allows any origin. ...
9 years, 7 months ago (2011-05-17 22:15:07 UTC) #21
wtc
LGTM on the change to crypto/*. I have suggested changes for crypto/symmetric_key_mac.cc. http://codereview.chromium.org/6683060/diff/85029/crypto/symmetric_key_mac.cc File crypto/symmetric_key_mac.cc ...
9 years, 7 months ago (2011-05-17 23:37:52 UTC) #22
Dmitry Polukhin
LGTM http://codereview.chromium.org/6683060/diff/88034/chrome/browser/chromeos/web_socket_proxy_controller.cc File chrome/browser/chromeos/web_socket_proxy_controller.cc (right): http://codereview.chromium.org/6683060/diff/88034/chrome/browser/chromeos/web_socket_proxy_controller.cc#newcode34 chrome/browser/chromeos/web_socket_proxy_controller.cc:34: class Clearance { Class name is strange to ...
9 years, 7 months ago (2011-05-18 06:50:47 UTC) #23
Denis Lagno
9 years, 7 months ago (2011-05-18 11:53:32 UTC) #24
http://codereview.chromium.org/6683060/diff/85029/crypto/symmetric_key_mac.cc
File crypto/symmetric_key_mac.cc (right):

http://codereview.chromium.org/6683060/diff/85029/crypto/symmetric_key_mac.cc...
crypto/symmetric_key_mac.cc:42: if (err != CSSM_OK) {
On 2011/05/17 23:37:52, wtc wrote:
> Although I prefer this form, it's more important to be
> consistent.  So I prefer we not change this, or we should
> change all instances of
>   if (err)
> in this file.

Done.

http://codereview.chromium.org/6683060/diff/85029/crypto/symmetric_key_mac.cc...
crypto/symmetric_key_mac.cc:81: std::fill(random_bytes, random_bytes +
key_size_in_bytes, 0);
On 2011/05/17 23:37:52, wtc wrote:
> You can use
>   memset(random_bytes, 0, key_size_in_bytes);
> here instead.  Then you don't need to change CreateRandomBytes
> to return uint8_t*.

better leave std::fill for consistency

http://codereview.chromium.org/6683060/diff/85029/crypto/symmetric_key_mac.cc...
crypto/symmetric_key_mac.cc:147: : key_(static_cast<const char*>(key_data),
key_size_in_bits / 8) {
On 2011/05/17 23:37:52, wtc wrote:
> I was told to use reinterpret_cast to cast void* to foo*.
> I don't remember why, but it may be the recommendations
> of the Style Guide:
> http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Casting
> 
> So I prefer that we not change this cast.

Done.

http://codereview.chromium.org/6683060/diff/88034/chrome/browser/chromeos/web...
File chrome/browser/chromeos/web_socket_proxy_controller.cc (right):

http://codereview.chromium.org/6683060/diff/88034/chrome/browser/chromeos/web...
chrome/browser/chromeos/web_socket_proxy_controller.cc:34: class Clearance {
On 2011/05/18 06:50:47, Dmitry Polukhin wrote:
> Class name is strange to me. What about OriginValidator?

Done.

http://codereview.chromium.org/6683060/diff/88034/chrome/browser/extensions/e...
File chrome/browser/extensions/extension_web_socket_proxy_private_api.cc
(right):

http://codereview.chromium.org/6683060/diff/88034/chrome/browser/extensions/e...
chrome/browser/extensions/extension_web_socket_proxy_private_api.cc:52:
delay_response = false;
On 2011/05/18 06:50:47, Dmitry Polukhin wrote:
> Please file P1 R13 issue about it. It needs to be fixed because there is race
> condition here. So client code will be flaky (perhaps test also will be
flaky).

ok

Powered by Google App Engine
This is Rietveld 408576698