feat(#306): module whitelisting support

This commit is contained in:
Anoop M D
2023-10-07 03:20:44 +05:30
parent e3679c9ee9
commit 8f1f41374c
5 changed files with 109 additions and 21 deletions

View File

@@ -24,7 +24,7 @@
"package.json"
],
"dependencies": {
"@usebruno/js": "0.6.0",
"@usebruno/js": "0.8.0",
"@usebruno/lang": "0.5.0",
"axios": "^1.5.1",
"chai": "^4.3.7",

View File

@@ -29,7 +29,7 @@ const runSingleRequest = async function (
request = prepareRequest(bruJson.request);
const allowScriptFilesystemAccess = get(brunoConfig, 'filesystemAccess.allow', false);
const scriptingConfig = get(brunoConfig, 'scripts', {});
// make axios work in node using form data
// reference: https://github.com/axios/axios/issues/1006#issuecomment-320165427
@@ -68,7 +68,7 @@ const runSingleRequest = async function (
collectionPath,
null,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
}
@@ -210,7 +210,7 @@ const runSingleRequest = async function (
collectionPath,
null,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
}
@@ -252,7 +252,7 @@ const runSingleRequest = async function (
collectionPath,
null,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
testResults = get(result, 'results', []);
}

View File

@@ -14,7 +14,7 @@
"test": "jest"
},
"dependencies": {
"@usebruno/js": "0.6.0",
"@usebruno/js": "0.8.0",
"@usebruno/lang": "0.5.0",
"@usebruno/schema": "0.5.0",
"about-window": "^1.15.2",

View File

@@ -109,7 +109,7 @@ const registerNetworkIpc = (mainWindow) => {
const envVars = getEnvVars(environment);
const processEnvVars = getProcessEnvVars(collectionUid);
const brunoConfig = getBrunoConfig(collectionUid);
const allowScriptFilesystemAccess = get(brunoConfig, 'filesystemAccess.allow', false);
const scriptingConfig = get(brunoConfig, 'scripts', {});
try {
// make axios work in node using form data
@@ -162,7 +162,7 @@ const registerNetworkIpc = (mainWindow) => {
collectionPath,
onConsoleLog,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
mainWindow.webContents.send('main:script-environment-update', {
@@ -296,7 +296,7 @@ const registerNetworkIpc = (mainWindow) => {
collectionPath,
onConsoleLog,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
mainWindow.webContents.send('main:script-environment-update', {
@@ -342,7 +342,7 @@ const registerNetworkIpc = (mainWindow) => {
collectionPath,
onConsoleLog,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
mainWindow.webContents.send('main:run-request-event', {
@@ -421,7 +421,7 @@ const registerNetworkIpc = (mainWindow) => {
collectionPath,
onConsoleLog,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
mainWindow.webContents.send('main:run-request-event', {
@@ -514,7 +514,7 @@ const registerNetworkIpc = (mainWindow) => {
const collectionPath = collection.pathname;
const folderUid = folder ? folder.uid : null;
const brunoConfig = getBrunoConfig(collectionUid);
const allowScriptFilesystemAccess = get(brunoConfig, 'filesystemAccess.allow', false);
const scriptingConfig = get(brunoConfig, 'scripts', {});
const onConsoleLog = (type, args) => {
console[type](...args);
@@ -621,7 +621,7 @@ const registerNetworkIpc = (mainWindow) => {
collectionPath,
onConsoleLog,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
mainWindow.webContents.send('main:script-environment-update', {
@@ -735,7 +735,7 @@ const registerNetworkIpc = (mainWindow) => {
collectionPath,
onConsoleLog,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
mainWindow.webContents.send('main:script-environment-update', {
@@ -779,7 +779,7 @@ const registerNetworkIpc = (mainWindow) => {
collectionPath,
onConsoleLog,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
mainWindow.webContents.send('main:run-folder-event', {
@@ -859,7 +859,7 @@ const registerNetworkIpc = (mainWindow) => {
collectionPath,
onConsoleLog,
processEnvVars,
allowScriptFilesystemAccess
scriptingConfig
);
mainWindow.webContents.send('main:run-folder-event', {