Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitelisting access to chrome.sockets API for local dev with unpacked extension #3102

Closed
lidel opened this issue Jan 25, 2019 · 2 comments
Closed

Comments

@lidel
Copy link

lidel commented Jan 25, 2019

Problem Summary

I am trying to whitelist access to chrome.sockets.* for local development with unpacked extension to test how feasible those APIs are for use in IPFS integration.

Why?

Related notes on bringing IPFS to Brave: #819 (comment)
Upstream issue to add support for chrome.sockets.* APIs to IPFS Companion: ipfs/ipfs-companion#664, cc #829

Steps to Reproduce

I suspect I am just missing some obvious step, so below is what I did:

  1. I loaded an unpacked extension with sockets section added to manifest (this branch), it got assigned ID paanflafljinkomjoheoobkeigpakegp.

  2. Generated ID shortcut via:

    $ echo -n paanflafljinkomjoheoobkeigpakegp | openssl sha1 | tr '[:lower:]' '[:upper:]'
    (STDIN)= CEBF34BE446B77F39E2C535566F8C27F9A460B1E
  3. and added it to whitelists for sockets.* APIs in src/brave/common/extensions/api/_api_features.json)

--- a/common/extensions/api/_api_features.json
+++ b/common/extensions/api/_api_features.json
@@ -60,18 +60,18 @@
   }],
   "sockets.tcp": {
     "dependencies": ["manifest:sockets"],
-    "contexts": ["blessed_extension"],
-    "whitelist": ["3D9518A72EB02667A773B69DBA9E72E0F4A37423"]
+    "contexts": ["blessed_extension","unblessed_extension"],
+    "whitelist": ["3D9518A72EB02667A773B69DBA9E72E0F4A37423","CEBF34BE446B77F39E2C535566F8C27F9A460B1E"]
   },
   "sockets.tcpServer": {
     "dependencies": ["manifest:sockets"],
-    "contexts": ["blessed_extension"],
-    "whitelist": ["3D9518A72EB02667A773B69DBA9E72E0F4A37423"]
+    "contexts": ["blessed_extension","unblessed_extension"],
+    "whitelist": ["3D9518A72EB02667A773B69DBA9E72E0F4A37423","CEBF34BE446B77F39E2C535566F8C27F9A460B1E"]
   },
   "sockets.udp": {
     "dependencies": ["manifest:sockets"],
-    "contexts": ["blessed_extension"],
-    "whitelist": ["3D9518A72EB02667A773B69DBA9E72E0F4A37423"]
+    "contexts": ["blessed_extension","unblessed_extension"],
+    "whitelist": ["3D9518A72EB02667A773B69DBA9E72E0F4A37423","CEBF34BE446B77F39E2C535566F8C27F9A460B1E"]
   },
   "braveRewards": {
     "channel": "stable",
  1. Rebuilt Brave via npm run build

  2. Started it via npm start

  3. Loaded extension again, it got the same ID (paanflafljinkomjoheoobkeigpakegp) but whitelisting did not work and I got this error:

    sockets-error-2019-01-25--11-01-52

I also tried to remove "whitelist" and added "unblessed_extension" to "context", but the result was the same.

Would appreciate some guidance on what am I missing, or where should I look.

@yrliou
Copy link
Member

yrliou commented Jan 25, 2019

I think you’ll also need to add your extension into the whitelist in https://github.com/brave/brave-core/blob/master/common/extensions/api/_manifest_features.json

@lidel
Copy link
Author

lidel commented Jan 25, 2019

@yrliou that did the trick, thank you!

2019-01-25--16-37-31

@lidel lidel closed this as completed Jan 25, 2019
@NejcZdovc NejcZdovc added this to the Dupe / Invalid / Not actionable milestone Jan 28, 2019
@rebron rebron removed this from the Dupe / Invalid / Not actionable milestone May 8, 2019
@NejcZdovc NejcZdovc added this to the Dupe / Invalid / Not actionable milestone Jun 3, 2019
@bbondy bbondy removed this from the Dupe / Invalid / Not actionable milestone May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants