Repository navigation
Conversation
…ble URL scheme createBookmark()/updateBookmark() passed bookmark.url straight through to browser.bookmarks.create()/update(). That value comes from whichever sync adapter is configured (WebDAV, Google Drive, a Git repo, Nextcloud, ...), i.e. from a remote the user trusted with bookmark data, not with the ability to run code in their browser. A javascript:/vbscript: bookmark executes in the context of whatever tab is active when the user clicks it, and a data: bookmark can carry an inline HTML document with its own script, so a compromised or malicious sync account could plant a working bookmarklet directly into the browser's bookmarks. Add sanitizeBookmarkUrl(), which replaces these schemes with about:blank before the bookmark reaches the browser API. This is a blanket backstop across every adapter; Nextcloud's own opt-in javascript: bookmarklet support (hasFeatureJavascriptLinks) isn't threaded through to this layer and would need its own explicit exception if that feature should keep working through this adapter specifically.
Member
|
Closing as syncing javascript bookmarks are an explicit feature of floccus. |
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.
Fixes #2389.
BrowserTree.createBookmark()/updateBookmark()passed a synced bookmark'surlstraight through tobrowser.bookmarks.create()/update()with no scheme restriction. A bookmark synced in from any configured adapter can seturltojavascript:...ordata:text/html,..., which becomes a real browser bookmark that runs that code when clicked, in the context of whatever tab is active at the time.This adds
sanitizeBookmarkUrl(), which replacesjavascript:/vbscript:/data:URLs withabout:blankbefore the bookmark reaches the browser API. This is a blanket backstop across every adapter; Nextcloud's own opt-injavascript:bookmarklet support (hasFeatureJavascriptLinks) isn't threaded through to this layer, so if that feature should keep working specifically through this path, it would need its own explicit exception here.