Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't expose desktopCapturer in sandboxed renderers if the featu…
…re is disabled (#14310)
- Loading branch information
Showing
4 changed files
with
60 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,17 @@ | ||
Object.defineProperties(exports, { | ||
ipcRenderer: { | ||
enumerable: true, | ||
get: function () { | ||
return require('../ipc-renderer') | ||
} | ||
}, | ||
remote: { | ||
enumerable: true, | ||
get: function () { | ||
return require('../../../renderer/api/remote') | ||
} | ||
}, | ||
webFrame: { | ||
enumerable: true, | ||
get: function () { | ||
return require('../../../renderer/api/web-frame') | ||
} | ||
}, | ||
crashReporter: { | ||
enumerable: true, | ||
get: function () { | ||
return require('../../../common/api/crash-reporter') | ||
} | ||
}, | ||
CallbacksRegistry: { | ||
get: function () { | ||
return require('../../../common/api/callbacks-registry') | ||
} | ||
}, | ||
isPromise: { | ||
get: function () { | ||
return require('../../../common/api/is-promise') | ||
} | ||
}, | ||
// XXX(alexeykuzmin): It won't be available if the Desktop Capturer | ||
// was disabled during build time. | ||
desktopCapturer: { | ||
get: function () { | ||
return require('../../../renderer/api/desktop-capturer') | ||
} | ||
}, | ||
nativeImage: { | ||
get: function () { | ||
return require('../../../common/api/native-image') | ||
} | ||
const moduleList = require('../module-list') | ||
|
||
for (const { | ||
name, | ||
load, | ||
enabled = true, | ||
private: isPrivate = false | ||
} of moduleList) { | ||
if (!enabled) { | ||
continue | ||
} | ||
}) | ||
|
||
Object.defineProperty(exports, name, { | ||
enumerable: !isPrivate, | ||
get: load | ||
}) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const features = process.atomBinding('features') | ||
|
||
module.exports = [ | ||
{ | ||
name: 'CallbacksRegistry', | ||
load: () => require('../../common/api/callbacks-registry'), | ||
private: true | ||
}, | ||
{ | ||
name: 'crashReporter', | ||
load: () => require('../../common/api/crash-reporter') | ||
}, | ||
{ | ||
name: 'desktopCapturer', | ||
load: () => require('../../renderer/api/desktop-capturer'), | ||
enabled: features.isDesktopCapturerEnabled() | ||
}, | ||
{ | ||
name: 'ipcRenderer', | ||
load: () => require('./ipc-renderer') | ||
}, | ||
{ | ||
name: 'isPromise', | ||
load: () => require('../../common/api/is-promise'), | ||
private: true | ||
}, | ||
{ | ||
name: 'nativeImage', | ||
load: () => require('../../common/api/native-image') | ||
}, | ||
{ | ||
name: 'remote', | ||
load: () => require('../../renderer/api/remote') | ||
}, | ||
{ | ||
name: 'webFrame', | ||
load: () => require('../../renderer/api/web-frame') | ||
} | ||
] |
This file contains 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