Chrome extension permissions on private instance behind reverse proxy
Created by: stephen
- Sourcegraph version: 3.0.0
- Platform information: Mac OS X, aws, oauth2_proxy, chrome 71
Steps to reproduce:
- Set up sourcegraph instance behind an oauth2_proxy, which requires a specific cookie to be sent to be passed through
- Install sourcegraph extension v19.1.29.2106
- Change url to https://sourcegraph.internal.etc
Expected behavior:
Code intelligence in PRs on private repod (e.g. PRs).
Actual behavior:
No code intelligence on private github repos (e.g. PR links), though it does work on https://sourcegraph.internal.etc itself
Investigation
I looked a little into what was going on and saw that the oauth2_proxy cookie was not being set since the chrome extension does not have permissions on my private instance. I can hack around this by going to:
- chrome://extensions
-
background page
for the sourcegraph extension - paste into console:
chrome.permissions.request({
origins: ["https://sourcegraph.internal.etc/*"],
}, (...args) => console.log(...args))
- hit accept
- it works!
Is there a way to get the chrome extension to do this without the hack? I see some code for this here: https://github.com/sourcegraph/sourcegraph/blob/a8ea976dba526349ba283f6296a798985c4319c8/client/browser/src/browser/permissions.ts#L11 but I didn't investigate further why they aren't requested.
References
http://www.adambarth.com/experimental/crx/docs/permissions.html