Open
Conversation
GitBook's embed iframe sets a frame-ancestors CSP that rejects HTTP parents, producing a console error on every page load and an empty "See Docs" panel. Gate the embed script, init, and widget observers on window.location.protocol === 'https:'. Disable the sidebar Documentation toggle with a tooltip when unavailable so it no longer looks interactive. Signed-off-by: Alex Piatakov <alex.piatakov@swirldslabs.com>
bea10a4 to
5ff6844
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
GitBook's embed iframe at
/~gitbook/embed/assistantsets aframe-ancestorsCSP that rejects HTTP parents. When the Guardian frontend is served over plain HTTP (defaultdocker-compose.ymlonhttp://localhost:3000), this produces a console error on every page load and an empty panel when the floating See Docs button is clicked.This PR gates the GitBook widget on
window.location.protocol === 'https:'so it only activates in environments where it can actually function.Related issue
Closes #5995
Checklist
docker compose up→ openhttp://localhost:3000; confirm noRefused to load …/~gitbook/embed/assistanterror in the console, no floating See Docs button, sidebar Documentation toggle is greyed out withcursor: not-allowedand shows the tooltip on hover; clicking it does nothing.docker compose -f docker-compose.yml -f docker-compose.ssl.yml up→ openhttps://localhost; confirm the See Docs button appears, opens a populated GitBook iframe, the sidebar toggle hides/shows the widget, andclipboard-writeis present on the widget iframe'sallowattribute.