Skip to content

Make allowNetworking testable and throw in AVM2 navigateToURL - #25102

Merged
evilpie merged 3 commits into
ruffle-rs:masterfrom
evilpie:allowNetworking
Nov 7, 2026
Merged

evilpie merged 3 commits into
ruffle-rs:masterfrom
evilpie:allowNetworking

Conversation

@evilpie

@evilpie evilpie commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Part of #25100 and #3044.

This is the first step towards more correctly implementing the allowNetworking setting (Restricting networking APIs) that can be used with <object> or <embed> tags. This is mostly just some preliminary architectural work. As a proof of concept I implemented throwing in AVM2's navigateToURL. I think next we should probably expose this to the desktop app.

Afterwards of course all the APIs listed in the Adobe documentation need to be restricted.

Testing

This feature is only available when running the Flash Player inside a browser, so this isn't directly testable with something like flashplayerdebugger. I did test this using https://hub.docker.com/r/jchprj/play-adobe-flash-after-eol.

Checklist

  • I, a human, have self-reviewed this PR and fully understand the changes within.
  • I have made or updated tests where possible.
  • All of my commits are properly scoped, compile successfully, and pass all tests.
  • This PR does not make sense to split up into smaller PRs.
  • An LLM was involved in the authoring of this code.

@danielhjacobs danielhjacobs added A-avm2 Area: AVM2 (ActionScript 3) T-compat Type: Compatibility with Flash Player labels Nov 5, 2026
evazion referenced this pull request in danbooru/danbooru Nov 5, 2026
Ruffle gave Flash files script access to the page by default. When loading a URL, it sets `allowScriptAccess`
to `samedomain`, which is true when the SWF is served from the site's own domain. This let any Flash post call
`ExternalInterface` to run JavaScript as the viewer and hijack their account. It also allowed `navigateToURL`
and unrestricted network access.

Fix it by disabling script access, networking, and URL opening in the Ruffle config, and by running the player
inside an `<iframe sandbox="allow-scripts" srcdoc="...">`. The sandboxed frame has an opaque origin, so even if
Ruffle has a bug, a malicious Flash file can't access the user's cookies, session, or the parent page.

Because the frame's origin is `null`, Ruffle's fetches for the .wasm and .swf files now count as cross-origin. For this reason, the shipped nginx for the prod image now sends `Access-Control-Allow-Origin: *` for .wasm and .swf files only. CDNs serving flash files might need to have their caches purged and/or add this header to these extensions.
@evilpie
evilpie force-pushed the allowNetworking branch 2 times, most recently from 6ee46c2 to a1cc151 Compare November 5, 2026 22:08
@evilpie
evilpie enabled auto-merge (rebase) November 6, 2026 23:06
@evilpie
evilpie disabled auto-merge November 6, 2026 23:27
@evilpie
evilpie enabled auto-merge (rebase) November 7, 2026 21:00
@evilpie
evilpie merged commit 5701ce3 into ruffle-rs:master Nov 7, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) T-compat Type: Compatibility with Flash Player

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants