|
|
|
@ -12,6 +12,12 @@ const requiredModules = [ // services + layout views + system views |
|
|
|
|
|
|
|
|
|
const dependentModules = ['git', 'hardhat', 'truffle', 'slither'] // module which shouldn't be manually activated (e.g git is activated by remixd)
|
|
|
|
|
|
|
|
|
|
const sensitiveCalls = { |
|
|
|
|
'fileManager': ['writeFile', 'copyFile', 'rename', 'copyDir'], |
|
|
|
|
'contentImport': ['resolveAndSave'], |
|
|
|
|
'web3Provider': ['sendAsync'], |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function isNative(name) { |
|
|
|
|
const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider', 'solidityStaticAnalysis', 'solidityUnitTesting', 'layout', 'notification', 'hardhat-provider', 'ganache-provider'] |
|
|
|
|
return nativePlugins.includes(name) || requiredModules.includes(name) |
|
|
|
@ -65,6 +71,7 @@ export class RemixAppManager extends PluginManager { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async canCall(from, to, method, message) { |
|
|
|
|
const isSensitiveCall = sensitiveCalls[to] && sensitiveCalls[to].includes(method) |
|
|
|
|
// Make sure the caller of this methods is the target plugin
|
|
|
|
|
if (to !== this.currentRequest.from) { |
|
|
|
|
return false |
|
|
|
@ -73,8 +80,9 @@ export class RemixAppManager extends PluginManager { |
|
|
|
|
if (isNative(from)) { |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ask the user for permission
|
|
|
|
|
return await this.call('permissionhandler', 'askPermission', this.profiles[from], this.profiles[to], method, message) |
|
|
|
|
return await this.call('permissionhandler', 'askPermission', this.profiles[from], this.profiles[to], method, message, isSensitiveCall) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onPluginActivated(plugin) { |
|
|
|
|