Skip to content

Commit e27794c

Browse files
committed
Add configurable allowed directory for applications with 'any' option
This commit introduces the `APPLICATIONS_ALLOWEDDIRECTORY` configuration parameter to control application file access restrictions. The default value is set to 'app', maintaining current behavior, while 'any' allows unrestricted directory access by clearing the allowedPath check.
1 parent 042b999 commit e27794c

4 files changed

Lines changed: 4 additions & 0 deletions

File tree

components/ApplicationScope.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class ApplicationScope {
3232

3333
this.mode = env.get(CONFIG_PARAMS.APPLICATIONS_MODULELOADER) ?? 'vm';
3434
this.dependencyLoader = env.get(CONFIG_PARAMS.APPLICATIONS_DEPENDENCYLOADER);
35+
if (env.get(CONFIG_PARAMS.APPLICATIONS_ALLOWEDDIRECTORY) !== 'app') this.allowedPath = ''; // this is used to match paths by startsWith, so empty string matches everything
3536
}
3637

3738
/**

static/defaultConfig.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ applications:
3030
allowedSpawnCommands:
3131
- npm
3232
- node
33+
allowedDirectory: app
3334
componentsRoot: null
3435
localStudio:
3536
enabled: true

utility/hdbTerms.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ export const CONFIG_PARAMS = {
442442
APPLICATIONS_PACKAGEMANAGERPREFIX: 'applications_packageManagerPrefix',
443443
APPLICATIONS_ALLOWEDBUILTINMODULES: 'applications_allowedBuiltInModules',
444444
APPLICATIONS_ALLOWEDSPAWNCOMMANDS: 'applications_allowedSpawnCommands',
445+
APPLICATIONS_ALLOWEDDIRECTORY: 'applications_allowedDirectory',
445446
THREADS: 'threads',
446447
THREADS_COUNT: 'threads_count',
447448
THREADS_DEBUG: 'threads_debug',

utility/install/installer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const DEV_MODE_CONFIG = {
5656
[CONFIG_PARAMS.OPERATIONSAPI_NETWORK_PORT]: 9925,
5757
[CONFIG_PARAMS.LOCALSTUDIO_ENABLED]: true,
5858
[CONFIG_PARAMS.NODE_HOSTNAME]: DEFAULT_NODE_HOSTNAME,
59+
[CONFIG_PARAMS.APPLICATIONS_ALLOWEDDIRECTORY]: 'any',
5960
};
6061

6162
// Install prompts

0 commit comments

Comments
 (0)