Skip to content

Commit

Permalink
feat(core): Make it possible to block access to environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
janober committed Jun 8, 2022
1 parent a18081d commit ddb3baa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/workflow/src/WorkflowDataProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,20 @@ export class WorkflowDataProxy {
* @memberof WorkflowDataGetter
*/
private envGetter() {
const that = this;
return new Proxy(
{},
{
get(target, name, receiver) {
if (process.env.N8N_BLOCK_ENV_ACCESS_IN_NODE === 'true') {
throw new ExpressionError('Environment variable access got disabled', {
causeDetailed:
'If you need access please contact the administrator to remove the environment variable ‘N8N_BLOCK_ENV_ACCESS_IN_NODE‘',
runIndex: that.runIndex,
itemIndex: that.itemIndex,
failExecution: true,
});
}
return process.env[name.toString()];
},
},
Expand Down

0 comments on commit ddb3baa

Please sign in to comment.