Drop setAllowUniversalAccessFromFileURLs in ControlPanelFragment#10
Open
jim-daf wants to merge 1 commit into
Open
Drop setAllowUniversalAccessFromFileURLs in ControlPanelFragment#10jim-daf wants to merge 1 commit into
jim-daf wants to merge 1 commit into
Conversation
ControlPanelFragment.afterView loads a panel from
file:///android_asset/panels/<name>/index.html and attaches the ir
JS bridge. It used to set both:
settings.setAllowFileAccessFromFileURLs(true);
settings.setAllowUniversalAccessFromFileURLs(true);
The panel scripts (assets/js/Panel.coffee) call $.getJSON on a sibling
file:// JSON descriptor (file:///android_asset/panels/<name>/*.json).
That XHR is file-to-file, so setAllowFileAccessFromFileURLs(true) is
needed for the existing panels to load their configuration.
setAllowUniversalAccessFromFileURLs(true) is the strictly broader
flag: it lets a file:// page XHR ANY origin, not just other file://
resources. The panel JS only ever fetches a sibling .json from
android_asset, so this flag is not load-bearing for any existing
panel. With the ir JS bridge attached, leaving it on would let an
attacker-controlled panel exfiltrate IR command data, app
information, or anything else the bridge exposes to a remote host
(CWE-200).
Drop the universal-access flag. The file-from-file flag stays in
place so the existing JSON loading keeps working.
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.
Closes #9.
ControlPanelFragment.afterViewenables bothsetAllowFileAccessFromFileURLs(true)andsetAllowUniversalAccessFromFileURLs(true)on the panel WebView and attaches theirJS bridge:layoutUrlisfile:///android_asset/panels/<name>/index.html. The panel JS (assets/js/Panel.coffee) does$.getJSONon a sibling.jsondescriptor in the same directory:That XHR is
file://tofile://, sosetAllowFileAccessFromFileURLs(true)is needed for the existing panels to load their JSON descriptors.setAllowUniversalAccessFromFileURLs(true)is the strictly broader flag: it lets afile://page XHR any origin, not just otherfile://resources. The panel JS only ever fetches a sibling.jsonfromandroid_asset, so this flag is not load-bearing for any existing panel. With theirbridge attached, leaving it on would let an attacker-controlled panel exfiltrate IR command data, app information, or anything else the bridge exposes to a remote host (CWE-200).Change
Drop
settings.setAllowUniversalAccessFromFileURLs(true). KeepsetAllowFileAccessFromFileURLs(true)so the sibling-JSON loading continues to work.Assisted-by: Claude (Anthropic)