Skip to content

Commit

Permalink
regression: apps without networking permission failing to start (Rock…
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert authored Nov 1, 2024
1 parent 6ec240b commit 8949e21
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,21 @@ export class DenoRuntimeSubprocessController extends EventEmitter {
// process must be able to read in order to include files that use NPM packages
const parentNodeModulesDir = path.dirname(path.join(appsEngineDir, '..'));

let hasNetworkingPermission = false;

// If the app doesn't request any permissions, it gets the default set of permissions, which includes "networking"
// If the app requests specific permissions, we need to check whether it requests "networking" or not
if (!this.appPackage.info.permissions || this.appPackage.info.permissions.findIndex((p) => p.name === 'networking.default') !== -1) {
hasNetworkingPermission = true;
}

const options = [
'run',
hasNetworkingPermission ? '--allow-net' : '',
`--allow-read=${appsEngineDir},${parentNodeModulesDir}`,
`--allow-env=${ALLOWED_ENVIRONMENT_VARIABLES.join(',')}`,
denoWrapperPath,
'--subprocess',
this.appPackage.info.id,
];

// If the app doesn't request any permissions, it gets the default set of permissions, which includes "networking"
// If the app requests specific permissions, we need to check whether it requests "networking" or not
if (!this.appPackage.info.permissions || this.appPackage.info.permissions.findIndex((p) => p.name === 'networking.default') !== -1) {
options.splice(1, 0, '--allow-net');
}

const environment = {
env: {
// We need to pass the PATH, otherwise the shell won't find the deno executable
Expand Down

0 comments on commit 8949e21

Please sign in to comment.