Skip to content

Conversation

@WofWca
Copy link
Member

@WofWca WofWca commented Sep 6, 2025

This partially reverts 750721c
(#3098).
Not completely though: the <iframe> thing is still there,
and I have not removed it yet for the sake of being conservative.

The most important point of this change is to prepare ourselves
for the removal of the IsolateSandboxedIframes Chromium feature.
It has been enabled by default, and the switch
is to be removed soon-ish:
https://issues.chromium.org/issues/362246896.
The feature makes the RTCPeerConnection exhaustion hack
not work anymore, because an attacker can create
a sandboxed <iframe>, and, as the feature name implies,
the iframe would be process-isolated,
thus have a separate RTCPeerConnection 500 pool.

Earlier we simply un-enabled this Chromium feature in
50bcd88
(#4351),
but when it's removed, we will not be able to.
We could hold off on upgrading Electron then, but let's not.

To answer "Why haven't we done this before?":
probably because the 500 hack was the first thing
that proved to work, both on Electron and in Android.
But in Android apparently one can't control
the WebRTC IP handling policy, so this approach
is not available on Android.

Another thing is, of course, the fact that this speeds up
the process of launching an app.

And in general this approach seems more thorough to me.
It also provides another exfiltration security layer (a dummy proxy)
against regular HTTP requests as well,
i.e. it guards even against CSP bypass.

This uses the same approach that we took in the Tauri version:
#4852.

On top of that, the 500 limit itself is not something
that is set in stone and should be relied on.

To check that this still works, follow the instructions in
https://github.com/webxdc/webxdc-test/pull/40/files.

TODO:

  • I just realized that this breaks the maps .xdc, i.e. the app that has internet_access. So this depends on Maps with own session #5455 (unless we are willing to break maps XD).
    Edit: or actually, we could just have a separate ses for the maps .xdc where we don't set the proxy 🤷‍♀️.

@WofWca WofWca added webxdc performance Related to (improving) performance Runtime: Electron Issue affecting the electron runtime specifically labels Sep 6, 2025
@WofWca WofWca force-pushed the wofwca/remove-RTCPeerConnection-exhaustion-hack branch from 6d6f08b to 15f3e5a Compare September 7, 2025 08:41
@WofWca WofWca marked this pull request as draft September 8, 2025 15:51
@WofWca WofWca force-pushed the wofwca/remove-RTCPeerConnection-exhaustion-hack branch from 15f3e5a to 78d74de Compare November 1, 2025 17:48
@WofWca
Copy link
Member Author

WofWca commented Nov 1, 2025

Rebased.
This should be good to merge when #5455 is merged.

@WofWca WofWca marked this pull request as ready for review November 1, 2025 17:49
This partially reverts 750721c
(#3098).
Not completely though: the `<iframe>` thing is still there,
and I have not removed it yet for the sake of being conservative.

The most important point of this change is to prepare ourselves
for the removal of the `IsolateSandboxedIframes` Chromium feature.
It has been enabled by default, and is to be removed soon-ish:
https://issues.chromium.org/issues/362246896.
The feature makes the RTCPeerConnection exhaustion hack
not work anymore, because an attacker can create
a sandboxed `<iframe>`, and, as the feature name implies,
process-isolated, thus have a separate RTCPeerConnection 500 pool.

Earlier we simply un-enabled this Chromium feature in
50bcd88
(#4351),
but when it's removed, we will not be able to.
We could hold off on upgrading Electron then, but let's not.

To answer "Why haven't we done this before?":
probably because the 500 hack was the first thing
that proved to work, both on Electron and in Android.
But in Android apparently one can't control
the WebRTC IP handling policy, so this approach
is not available on Android.

Another thing is, of course, the fact that this speeds up
the process of launching an app.

And in general this approach seems more thorough to me.
It also provides another exfiltration security layer (a dummy proxy)
against regular HTTP requests as well,
i.e. it guards even against CSP bypass.

This uses the same approach that we took in the Tauri version:
#4852.

On top of that, the 500 limit itself is not something
that is set in stone and should be relied on.

To check that this still works, follow the instructions in
https://github.com/webxdc/webxdc-test/pull/40/files.
@WofWca WofWca force-pushed the wofwca/remove-RTCPeerConnection-exhaustion-hack branch from 78d74de to a69f8d2 Compare November 2, 2025 09:41
@WofWca
Copy link
Member Author

WofWca commented Nov 2, 2025

Rebased, and adjusted comments a little.

I also re-tested this with the instructions above. All works well.

Copy link
Member

@nicodh nicodh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed by reading & testing

I tested this with following results:

I can confirm that without setWebRTCIPHandlingPolicy('disable_non_proxied_udp')

the requests to the STUN server can reach the server which is not the case if the policy is set.

The dns prefetch is also blocked except, if the lines

rawApp.commandLine.appendSwitch('host-resolver-rules', hostRules)
rawApp.commandLine.appendSwitch('host-rules', hostRules)

are removed

Concerning the dummy proxy approach: is that taken from a specific source or just an own idea? I see how it works but I can't really say if this approach is valid.
Some documentation in the code would help here:
Is it related to disable_non_proxied_udp or "just another exfiltration security layer" as described?
How can it be tested that it's needed?

Copy link
Member Author

@WofWca WofWca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that taken from a specific source or just an own idea?

An own idea basically. I don't recall seeing it anywhere else.

I see how it works but I can't really say if this approach is valid.

Sorry, I might have forgotten to link to the spec, or just assumed that it's obvious where to find it (which it is not). See my new suggestion comment.

Is it related to disable_non_proxied_udp or "just another exfiltration security layer" as described?

As I commented "However, weirdly, this alone seems to disable WebRTC, even without setting a proxy". I expect that setting a proxy is required to make disable_non_proxied_udp work as we want, but apparently just disable_non_proxied_udp is enough.

How can it be tested that it's needed?

I have submitted MRs about this:

@WofWca WofWca merged commit b3f66a5 into main Nov 10, 2025
9 checks passed
@WofWca WofWca deleted the wofwca/remove-RTCPeerConnection-exhaustion-hack branch November 10, 2025 11:08
WofWca added a commit that referenced this pull request Nov 13, 2025
The symptoms are:
- After launching the app, WebXDC apps open OK.
- After switching to another account and clicking a WebXDC app,
  nothing happens.
- On second click, the app window opens, but it's blank.

The bug has been introduced in
b3f66a5
(#5451).
WofWca added a commit that referenced this pull request Nov 13, 2025
The symptoms are:
- After launching Delta Chat, WebXDC apps open OK.
- After switching to another account and clicking a WebXDC app,
  nothing happens.
- On second click, the app window opens, but it's blank.

The bug has been introduced in
b3f66a5
(#5451).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Related to (improving) performance Runtime: Electron Issue affecting the electron runtime specifically webxdc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants