Skip to content

chore: Sync with the 26.05 branch#5041

Merged
abdnh merged 25 commits into
mainfrom
26.05-picked
Jun 19, 2026
Merged

chore: Sync with the 26.05 branch#5041
abdnh merged 25 commits into
mainfrom
26.05-picked

Conversation

@abdnh

@abdnh abdnh commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

This syncs security fixes and translation/version updates from the 26.05 branch.

Related: #5039

abdnh and others added 23 commits May 9, 2026 17:36
…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.
---------

Co-authored-by: Andrew Sanchez <andrewsanchez@users.noreply.github.com>
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.
@abdnh abdnh requested a review from fernandolins June 18, 2026 18:56
@abdnh abdnh added the hotfix Bugfix PRs exempt from the linked issue requirement label Jun 18, 2026
@ankitects ankitects deleted a comment from github-actions Bot Jun 18, 2026
@read-the-docs-community

read-the-docs-community Bot commented Jun 18, 2026

Copy link
Copy Markdown

Documentation build overview

📚 Anki | 🛠️ Build #33216679 | 📁 Comparing 70b3aab against latest (3b705a1)

  🔍 Preview build  

3 files changed
± api-aqt-modules.html
± genindex.html
± autoapi/aqt/mediasrv/index.html

Comment thread qt/tests/qwebengine_csp_smoke.py Fixed
@abdnh abdnh marked this pull request as draft June 19, 2026 11:50
@abdnh abdnh marked this pull request as ready for review June 19, 2026 12:53
@abdnh abdnh merged commit 8f39ce8 into main Jun 19, 2026
7 checks passed
@abdnh abdnh deleted the 26.05-picked branch June 19, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotfix Bugfix PRs exempt from the linked issue requirement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants