chore: Sync with the 26.05 branch#5041
Merged
Merged
Conversation
…fe_path _builtin_data previously did no path validation, allowing directory traversal attacks via crafted bundled file requests. Extract ensure_safe_path as a reusable guard and apply it to both _handle_local_file_request and _builtin_data. UnsafePathException is caught at the top-level request handler.
This reverts commit 82bfc32cdcd6eab6dcb885e61ef91485651e40d7. This doesn't work. Fetch requests in iframes are also ResourceTypeXhr
Serve collection media with a restrictive CSP that sandboxes active documents, blocks script execution, and prevents network access. This means SVG/HTML loaded via iframe or object can still render where the browser allows it, but cannot call back into the editor page or Anki's local API. Keep add-on web exports exempt from the sandbox, since they share the LocalFileRequest path but are trusted extension assets. The editor page CSP is intentionally left limited to script-src so existing user content such as remote iframe embeds, dictionary sites, YouTube embeds, and SVG object tags is not newly blocked by the editor itself. Add tests for the untrusted media CSP, local API connect blocking, the add-on exemption, and the editor CSP compatibility expectations.
Add a manual QtWebEngine harness that loads an editor-like page, serves untrusted HTML/SVG media with the collection media CSP, and fails if embedded media can POST to /_anki/getImageForOcclusion while the profile injects the bearer auth header. The smoke test also checks that untrusted media scripts do not execute, including a parent.fetch() attempt that reproduces why connect-src-only protection is insufficient: the child document's own fetch is blocked, but same-origin access to the editor page can still reach the local API. Confirm static local SVGs still load through img/object tags and that a different-origin iframe is not blocked by the editor page CSP. Keep the harness outside pytest discovery because QtWebEngine headless execution is environment-sensitive. Add tools/qwebengine-csp-smoke as the supported wrapper for running the check.
Previously, `set(done_results)` subtracted all element IDs from expected_loads regardless of whether they fired 'load' or 'error'. This meant a CSP regression breaking a benign resource load would go undetected. Now only IDs with value 'load' satisfy expected_loads, and error events are reported as explicit failures.
Fix audio broken on Intel Macs because our new mpv build doesn't recognize the `--no-ytdl` option.
fernandolins
approved these changes
Jun 19, 2026
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.
This syncs security fixes and translation/version updates from the 26.05 branch.
Related: #5039