n8n 2.31.6 → 2.31.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/security-audit/risk-reporters/credentials-risk-reporter.d.ts +4 -6
- package/dist/security-audit/risk-reporters/credentials-risk-reporter.js +13 -22
- package/dist/security-audit/risk-reporters/credentials-risk-reporter.js.map +1 -1
- package/package.json +17 -17
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { SecurityConfig } from '@n8n/config';
|
|
2
|
-
import { CredentialsRepository } from '@n8n/db';
|
|
2
|
+
import { CredentialsRepository, ExecutionRepository } from '@n8n/db';
|
|
3
3
|
import type { IWorkflowBase } from 'n8n-workflow';
|
|
4
|
-
import { ExecutionPersistence } from '../../executions/execution-persistence';
|
|
5
4
|
import type { RiskReporter, Risk } from '../../security-audit/types';
|
|
6
5
|
export declare class CredentialsRiskReporter implements RiskReporter {
|
|
7
6
|
private readonly credentialsRepository;
|
|
8
|
-
private readonly
|
|
7
|
+
private readonly executionRepository;
|
|
9
8
|
private readonly securityConfig;
|
|
10
|
-
constructor(credentialsRepository: CredentialsRepository,
|
|
9
|
+
constructor(credentialsRepository: CredentialsRepository, executionRepository: ExecutionRepository, securityConfig: SecurityConfig);
|
|
11
10
|
report(workflows: IWorkflowBase[]): Promise<Risk.StandardReport | null>;
|
|
12
11
|
private getAllCredsInUse;
|
|
13
12
|
private getAllExistingCreds;
|
|
14
|
-
private
|
|
15
|
-
private getCredsInRecentlyExecutedWorkflows;
|
|
13
|
+
private getCredentialsInRecentlyExecutedWorkflows;
|
|
16
14
|
}
|
|
@@ -13,19 +13,18 @@ exports.CredentialsRiskReporter = void 0;
|
|
|
13
13
|
const config_1 = require("@n8n/config");
|
|
14
14
|
const db_1 = require("@n8n/db");
|
|
15
15
|
const di_1 = require("@n8n/di");
|
|
16
|
-
const execution_persistence_1 = require("../../executions/execution-persistence");
|
|
17
16
|
const constants_1 = require("../../security-audit/constants");
|
|
18
17
|
let CredentialsRiskReporter = class CredentialsRiskReporter {
|
|
19
|
-
constructor(credentialsRepository,
|
|
18
|
+
constructor(credentialsRepository, executionRepository, securityConfig) {
|
|
20
19
|
this.credentialsRepository = credentialsRepository;
|
|
21
|
-
this.
|
|
20
|
+
this.executionRepository = executionRepository;
|
|
22
21
|
this.securityConfig = securityConfig;
|
|
23
22
|
}
|
|
24
23
|
async report(workflows) {
|
|
25
24
|
const days = this.securityConfig.daysAbandonedWorkflow;
|
|
26
25
|
const allExistingCreds = await this.getAllExistingCreds();
|
|
27
26
|
const { credsInAnyUse, credsInActiveUse } = this.getAllCredsInUse(workflows);
|
|
28
|
-
const recentlyExecutedCreds = await this.
|
|
27
|
+
const recentlyExecutedCreds = await this.getCredentialsInRecentlyExecutedWorkflows(workflows, days);
|
|
29
28
|
const credsNotInAnyUse = allExistingCreds.filter((c) => !credsInAnyUse.has(c.id));
|
|
30
29
|
const credsNotInActiveUse = allExistingCreds.filter((c) => !credsInActiveUse.has(c.id));
|
|
31
30
|
const credsNotRecentlyExecuted = allExistingCreds.filter((c) => !recentlyExecutedCreds.has(c.id));
|
|
@@ -99,32 +98,24 @@ let CredentialsRiskReporter = class CredentialsRiskReporter {
|
|
|
99
98
|
const credentials = await this.credentialsRepository.find({ select: ['id', 'name'] });
|
|
100
99
|
return credentials.map(({ id, name }) => ({ kind: 'credential', id, name }));
|
|
101
100
|
}
|
|
102
|
-
async
|
|
101
|
+
async getCredentialsInRecentlyExecutedWorkflows(workflows, days) {
|
|
103
102
|
const date = new Date();
|
|
104
103
|
date.setDate(date.getDate() - days);
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Object.values(node.credentials).forEach((c) => {
|
|
114
|
-
if (c.id)
|
|
115
|
-
acc.add(c.id);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
return acc;
|
|
120
|
-
}, new Set());
|
|
104
|
+
const recentlyExecutedWorkflowIds = new Set(await this.executionRepository.getWorkflowIdsWithExecutionsSince(date));
|
|
105
|
+
const credentialIds = workflows
|
|
106
|
+
.filter((workflow) => recentlyExecutedWorkflowIds.has(workflow.id))
|
|
107
|
+
.flatMap((workflow) => workflow.nodes)
|
|
108
|
+
.flatMap((node) => Object.values(node.credentials ?? {}))
|
|
109
|
+
.map((credential) => credential.id)
|
|
110
|
+
.filter((id) => id !== undefined);
|
|
111
|
+
return new Set(credentialIds);
|
|
121
112
|
}
|
|
122
113
|
};
|
|
123
114
|
exports.CredentialsRiskReporter = CredentialsRiskReporter;
|
|
124
115
|
exports.CredentialsRiskReporter = CredentialsRiskReporter = __decorate([
|
|
125
116
|
(0, di_1.Service)(),
|
|
126
117
|
__metadata("design:paramtypes", [db_1.CredentialsRepository,
|
|
127
|
-
|
|
118
|
+
db_1.ExecutionRepository,
|
|
128
119
|
config_1.SecurityConfig])
|
|
129
120
|
], CredentialsRiskReporter);
|
|
130
121
|
//# sourceMappingURL=credentials-risk-reporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials-risk-reporter.js","sourceRoot":"","sources":["../../../src/security-audit/risk-reporters/credentials-risk-reporter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"credentials-risk-reporter.js","sourceRoot":"","sources":["../../../src/security-audit/risk-reporters/credentials-risk-reporter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA6C;AAC7C,gCAAqE;AACrE,gCAAkC;AAGlC,0DAAgE;AAIzD,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IACnC,YACkB,qBAA4C,EAC5C,mBAAwC,EACxC,cAA8B;QAF9B,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,mBAAc,GAAd,cAAc,CA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IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAEpC,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAC1C,MAAM,IAAI,CAAC,mBAAmB,CAAC,iCAAiC,CAAC,IAAI,CAAC,CACtE,CAAC;QAEF,MAAM,aAAa,GAAG,SAAS;aAC7B,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,2BAA2B,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;aAClE,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;aACrC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;aACxD,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;aAClC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;QAEjD,OAAO,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B,CAAC;CACD,CAAA;AAhIY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,YAAO,GAAE;qCAGgC,0BAAqB;QACvB,wBAAmB;QACxB,uBAAc;GAJpC,uBAAuB,CAgInC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n",
|
|
3
|
-
"version": "2.31.
|
|
3
|
+
"version": "2.31.7",
|
|
4
4
|
"description": "n8n Workflow Automation Tool",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
"vite": "^8.0.2",
|
|
79
79
|
"vitest": "^4.1.9",
|
|
80
80
|
"vitest-mock-extended": "^3.1.0",
|
|
81
|
-
"@n8n/backend-test-utils": "1.31.3",
|
|
82
81
|
"@n8n/playwright-janitor": "0.1.0",
|
|
82
|
+
"n8n-containers": "1.0.0",
|
|
83
83
|
"@n8n/typescript-config": "1.9.0",
|
|
84
84
|
"@n8n/vitest-config": "1.18.0",
|
|
85
|
-
"n8n-
|
|
85
|
+
"@n8n/backend-test-utils": "1.31.4"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@1password/connect": "1.4.2",
|
|
@@ -209,35 +209,35 @@
|
|
|
209
209
|
"zod-to-json-schema": "3.23.3",
|
|
210
210
|
"@n8n/agents": "0.16.3",
|
|
211
211
|
"@n8n/ai-node-sdk": "0.21.3",
|
|
212
|
+
"@n8n/ai-workflow-builder": "1.31.3",
|
|
212
213
|
"@n8n/ai-utilities": "0.24.3",
|
|
213
|
-
"@n8n/api-types": "1.31.3",
|
|
214
|
-
"@n8n/backend-common": "1.31.3",
|
|
215
214
|
"@n8n/backend-network": "1.5.3",
|
|
216
|
-
"@n8n/
|
|
215
|
+
"@n8n/api-types": "1.31.3",
|
|
217
216
|
"@n8n/chat-hub": "1.24.3",
|
|
218
217
|
"@n8n/config": "2.29.1",
|
|
218
|
+
"@n8n/backend-common": "1.31.3",
|
|
219
219
|
"@n8n/constants": "0.31.0",
|
|
220
|
+
"@n8n/client-oauth2": "1.13.0",
|
|
221
|
+
"@n8n/db": "1.31.4",
|
|
222
|
+
"@n8n/di": "0.15.0",
|
|
220
223
|
"@n8n/decorators": "1.31.3",
|
|
221
|
-
"@n8n/ai-workflow-builder": "1.31.3",
|
|
222
224
|
"@n8n/errors": "0.12.0",
|
|
223
|
-
"@n8n/di": "0.15.0",
|
|
224
|
-
"@n8n/db": "1.31.3",
|
|
225
225
|
"@n8n/instance-ai": "1.16.3",
|
|
226
|
-
"@n8n/expression-runtime": "0.22.1",
|
|
227
|
-
"@n8n/mcp-apps": "0.8.2",
|
|
228
226
|
"@n8n/mcp-browser": "0.14.0",
|
|
229
|
-
"@n8n/n8n-nodes-langchain": "2.31.3",
|
|
230
|
-
"@n8n/permissions": "0.68.0",
|
|
231
227
|
"@n8n/scheduler": "0.3.3",
|
|
228
|
+
"@n8n/expression-runtime": "0.22.1",
|
|
229
|
+
"@n8n/mcp-apps": "0.8.2",
|
|
232
230
|
"@n8n/syslog-client": "1.8.0",
|
|
233
231
|
"@n8n/task-runner": "2.31.3",
|
|
234
|
-
"@n8n/
|
|
232
|
+
"@n8n/permissions": "0.68.0",
|
|
233
|
+
"@n8n/n8n-nodes-langchain": "2.31.4",
|
|
235
234
|
"@n8n/typeorm": "0.5.0",
|
|
235
|
+
"@n8n/utils": "1.39.0",
|
|
236
236
|
"@n8n/workflow-sdk": "0.24.3",
|
|
237
|
+
"n8n-core": "2.31.3",
|
|
237
238
|
"n8n-editor-ui": "2.31.5",
|
|
238
|
-
"n8n-nodes-base": "2.31.
|
|
239
|
-
"n8n-workflow": "2.31.3"
|
|
240
|
-
"n8n-core": "2.31.3"
|
|
239
|
+
"n8n-nodes-base": "2.31.4",
|
|
240
|
+
"n8n-workflow": "2.31.3"
|
|
241
241
|
},
|
|
242
242
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
243
243
|
"homepage": "https://n8n.io",
|