apache / apache/cordova-plugin-file

Question Regarding Restricting FileSystem Access to certain parts of the code

Open
#276 4 comments 0 reactions 0 assignees View on GitHub
question support
Dominant language
JavaScript
Stars
744
Forks
754
Avg merge
3d 4h
Merged PRs (30d)
1

Description

Related to the recent event-stream exploit (https://github.com/dominictarr/event-stream/issues/116)

The attacker used the fact `window.cordoba.file` is global and public access from anywhere in the code, as shown on this part of the injected malicious code:
``` javascript
if (window.cordova) try {
var e = cordova.file.dataDirectory;
resolveLocalFileSystemURL(e, function(e) {
e.getFile(t, {
create: !1
}, function(e) {
e.file(function(e) {
var t = new FileReader;
t.onloadend = function() {
return n(JSON.parse(t.result))
}, t.onerror = function(e) {
t.abort()
}, t.readAsText(e)
})
})
})
```

we are thinking different ways to prevent no-authorized part of the code to access the file system, but I wonder if there is any existing solution for that or you guys have already thought a possibility of doing so.

thanks,
matías

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked event-stream exploit and reviewing how the public window.cordova.file access is exposed. The issue names no repository files or tests; done would require deciding and documenting or implementing a viable way to prevent unauthorized code from accessing the file system.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
mobile-dev, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.