Skip to content

Enable the option for embed route on private instances

Warren Gifford requested to merge rn/enable-embed-on-private-instances into main

Created by: novoselrok

Fixes #31628 (closed)

This PR removes the Cloud check from the embed route. This makes the embed route available for customer instances. The embed route is still disabled by default. A site-admin has to manually enable the feature flag through the API console (added a doc page for this).

Test plan

Note: You can skip the whole ngrok setup, if you use a localhost server as the 3rd party site for testing. I'm keeping it because that is what I was testing with and because it's slightly more real world 🙂.

  • Start a ngrok proxy and copy the https URL (alternatively, see client/web/src/enterprise/embed/README.md)
  • Copy the URL into the site-config.json externalURL property
  • Run export EMBED_DEVELOPMENT=true to compile the embedded web app
  • Start your enterprise (not cloud) local dev environment (sg start enterprise)
  • Navigate to the ngrok https URL and log into the Sourcegraph instance
  • Create a public notebook
  • Have a 3rd party site ready (something like Codepen, or a locally running server)
  • Embed the notebook into the 3rd party site via an iframe
  • Open the 3rd party site in an incognito browser (or log out of the Sourcegraph instance)
  • The iframe should not load, and you should see an error
  • Open the 3rd party site in your main browser window (where you're logged into the Sourcegraph instance)
  • The iframe should load, and you should see the notebook load. You should be able to run searches, etc.
  • Change the notebook visibility to private
  • Log out the current user, and log in with a separate user (that won't have access to the private notebook)
  • Navigate to the 3rd party site, the iframe should load, but you should see an error that the notebook does not exist (since the newly logged in user does not have permissions to access it)

Merge request reports

Loading