Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
fether
Commits
fb0d9f88
Unverified
Commit
fb0d9f88
authored
Aug 30, 2019
by
Amaury Martiny
Committed by
GitHub
Aug 30, 2019
Browse files
feat: Add electron security to disallow permission (#541)
* feat: Add electron security to disallow permission * Fix lint?
parent
cc413f86
Pipeline
#50604
passed with stages
in 14 minutes and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
packages/fether-electron/src/main/app/methods/setupRequestListeners.js
View file @
fb0d9f88
...
...
@@ -15,6 +15,22 @@ function setupRequestListeners (fetherApp) {
return
messages
(
fetherApp
,
...
args
);
});
// Electron security guideline
// Handle Session Permission Requests From Remote Content
// https://electronjs.org/docs/tutorial/security#4-handle-session-permission-requests-from-remote-content
session
.
defaultSession
.
setPermissionRequestHandler
(
(
_webContents
,
permission
,
reqCallback
)
=>
{
// Only allow camera
if
(
permission
===
'
media
'
)
{
reqCallback
(
true
);
return
;
}
reqCallback
(
false
);
}
);
// WS calls have Origin `file://` by default, which is not trusted.
// We override Origin header on all WS connections with an authorized one.
session
.
defaultSession
.
webRequest
.
onBeforeSendHeaders
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment