@atom8n/n8n 2.4.7 → 2.5.1

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.
Files changed (231) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/chat/chat-service.types.d.ts +6 -6
  3. package/dist/commands/execute-batch.d.ts +2 -2
  4. package/dist/commands/execute.js +0 -0
  5. package/dist/commands/import/credentials.d.ts +2 -2
  6. package/dist/commands/import/credentials.js +0 -0
  7. package/dist/commands/import/workflow.d.ts +2 -2
  8. package/dist/commands/ldap/reset.d.ts +2 -2
  9. package/dist/commands/mcp.d.ts +23 -0
  10. package/dist/commands/mcp.js +315 -0
  11. package/dist/commands/run.d.ts +23 -0
  12. package/dist/commands/run.js +162 -0
  13. package/dist/controllers/annotation-tags.controller.ee.d.ts +1 -1
  14. package/dist/controllers/cli.controller.d.ts +26 -0
  15. package/dist/controllers/cli.controller.js +334 -0
  16. package/dist/controllers/orchestration.controller.js +0 -0
  17. package/dist/controllers/users.controller.d.ts +1 -1
  18. package/dist/environments.ee/source-control/source-control-status.service.ee.d.ts +2 -2
  19. package/dist/environments.ee/source-control/source-control.controller.ee.d.ts +4 -4
  20. package/dist/environments.ee/source-control/source-control.service.ee.d.ts +2 -2
  21. package/dist/environments.ee/source-control/types/source-control-set-branch.js +0 -0
  22. package/dist/eventbus/event-message-classes/index.js +0 -0
  23. package/dist/events/relays/workflow-failure-notification.event-relay.d.ts +13 -0
  24. package/dist/events/relays/workflow-failure-notification.event-relay.js +77 -0
  25. package/dist/executions/execution-data/types.d.ts +17 -0
  26. package/dist/executions/execution-data/types.js +2 -0
  27. package/dist/executions/failed-run-factory.d.ts +4 -0
  28. package/dist/executions/failed-run-factory.js +71 -0
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.js +8 -0
  31. package/dist/interfaces.d.ts +1 -1
  32. package/dist/license.js +1 -1
  33. package/dist/middlewares/webview-frame-options.d.ts +2 -0
  34. package/dist/middlewares/webview-frame-options.js +22 -0
  35. package/dist/modules/chat-hub/chat-hub-extractor.d.ts +22 -0
  36. package/dist/modules/chat-hub/chat-hub-extractor.js +63 -0
  37. package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-user-entry-storage.d.ts +11 -0
  38. package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-user-entry-storage.js +58 -0
  39. package/dist/modules/dynamic-credentials.ee/database/entities/dynamic-credential-user-entry.d.ts +12 -0
  40. package/dist/modules/dynamic-credentials.ee/database/entities/dynamic-credential-user-entry.js +64 -0
  41. package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.d.ts +5 -0
  42. package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.js +25 -0
  43. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.d.ts +5 -0
  44. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.js +36 -0
  45. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.d.ts +12 -0
  46. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js +69 -0
  47. package/dist/modules/dynamic-credentials.ee/services/resolver-config-expression.service.d.ts +7 -0
  48. package/dist/modules/dynamic-credentials.ee/services/resolver-config-expression.service.js +46 -0
  49. package/dist/modules/insights/database/entities/insights-metadata.js +1 -1
  50. package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js +4 -1
  51. package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +1 -1
  52. package/dist/modules/insights/insights.module.d.ts +1 -1
  53. package/dist/modules/insights/insights.service.d.ts +1 -1
  54. package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.d.ts +6 -0
  55. package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.js +28 -0
  56. package/dist/modules/log-streaming.ee/database/entities/index.d.ts +1 -0
  57. package/dist/modules/log-streaming.ee/database/entities/index.js +5 -0
  58. package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.d.ts +5 -0
  59. package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.js +25 -0
  60. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-from-db.d.ts +4 -0
  61. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-from-db.js +24 -0
  62. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.d.ts +17 -0
  63. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.js +131 -0
  64. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.d.ts +22 -0
  65. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.js +116 -0
  66. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.d.ts +35 -0
  67. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.js +328 -0
  68. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination.ee.d.ts +28 -0
  69. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination.ee.js +74 -0
  70. package/dist/modules/log-streaming.ee/log-streaming-destination.service.d.ts +32 -0
  71. package/dist/modules/log-streaming.ee/log-streaming-destination.service.js +175 -0
  72. package/dist/modules/log-streaming.ee/log-streaming.controller.d.ts +15 -0
  73. package/dist/modules/log-streaming.ee/log-streaming.controller.js +149 -0
  74. package/dist/modules/log-streaming.ee/log-streaming.module.d.ts +5 -0
  75. package/dist/modules/log-streaming.ee/log-streaming.module.js +66 -0
  76. package/dist/modules/mcp/mcp-oauth.helpers.js +0 -0
  77. package/dist/modules/mcp/mcp.oauth-clients.controller.js +0 -0
  78. package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +10 -10
  79. package/dist/modules/mcp/tools/schemas.d.ts +10 -10
  80. package/dist/modules/source-control.ee/constants.d.ts +17 -0
  81. package/dist/modules/source-control.ee/constants.js +22 -0
  82. package/dist/modules/source-control.ee/middleware/source-control-enabled-middleware.ee.d.ts +2 -0
  83. package/dist/modules/source-control.ee/middleware/source-control-enabled-middleware.ee.js +18 -0
  84. package/dist/modules/source-control.ee/source-control-export.service.ee.d.ts +37 -0
  85. package/dist/modules/source-control.ee/source-control-export.service.ee.js +426 -0
  86. package/dist/modules/source-control.ee/source-control-git.service.ee.d.ts +59 -0
  87. package/dist/modules/source-control.ee/source-control-git.service.ee.js +427 -0
  88. package/dist/modules/source-control.ee/source-control-helper.ee.d.ts +49 -0
  89. package/dist/modules/source-control.ee/source-control-helper.ee.js +241 -0
  90. package/dist/modules/source-control.ee/source-control-import.service.ee.d.ts +110 -0
  91. package/dist/modules/source-control.ee/source-control-import.service.ee.js +957 -0
  92. package/dist/modules/source-control.ee/source-control-preferences.service.ee.d.ts +46 -0
  93. package/dist/modules/source-control.ee/source-control-preferences.service.ee.js +309 -0
  94. package/dist/modules/source-control.ee/source-control-resource-helper.d.ts +4 -0
  95. package/dist/modules/source-control.ee/source-control-resource-helper.js +20 -0
  96. package/dist/modules/source-control.ee/source-control-scoped.service.d.ts +17 -0
  97. package/dist/modules/source-control.ee/source-control-scoped.service.js +134 -0
  98. package/dist/modules/source-control.ee/source-control-status.service.ee.d.ts +90 -0
  99. package/dist/modules/source-control.ee/source-control-status.service.ee.js +596 -0
  100. package/dist/modules/source-control.ee/source-control.config.d.ts +3 -0
  101. package/dist/modules/source-control.ee/source-control.config.js +26 -0
  102. package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +157 -0
  103. package/dist/modules/source-control.ee/source-control.controller.ee.js +347 -0
  104. package/dist/modules/source-control.ee/source-control.module.d.ts +4 -0
  105. package/dist/modules/source-control.ee/source-control.module.js +59 -0
  106. package/dist/modules/source-control.ee/source-control.service.ee.d.ts +125 -0
  107. package/dist/modules/source-control.ee/source-control.service.ee.js +466 -0
  108. package/dist/modules/source-control.ee/types/export-result.d.ts +10 -0
  109. package/dist/modules/source-control.ee/types/export-result.js +2 -0
  110. package/dist/modules/source-control.ee/types/exportable-credential.d.ts +14 -0
  111. package/dist/modules/source-control.ee/types/exportable-credential.js +2 -0
  112. package/dist/modules/source-control.ee/types/exportable-folders.d.ts +11 -0
  113. package/dist/modules/source-control.ee/types/exportable-folders.js +2 -0
  114. package/dist/modules/source-control.ee/types/exportable-project.d.ts +17 -0
  115. package/dist/modules/source-control.ee/types/exportable-project.js +2 -0
  116. package/dist/modules/source-control.ee/types/exportable-tags.d.ts +5 -0
  117. package/dist/modules/source-control.ee/types/exportable-tags.js +2 -0
  118. package/dist/modules/source-control.ee/types/exportable-variable.d.ts +7 -0
  119. package/dist/modules/source-control.ee/types/exportable-variable.js +2 -0
  120. package/dist/modules/source-control.ee/types/exportable-workflow.d.ts +14 -0
  121. package/dist/modules/source-control.ee/types/exportable-workflow.js +2 -0
  122. package/dist/modules/source-control.ee/types/import-result.d.ts +20 -0
  123. package/dist/modules/source-control.ee/types/import-result.js +2 -0
  124. package/dist/modules/source-control.ee/types/key-pair-type.d.ts +1 -0
  125. package/dist/modules/source-control.ee/types/key-pair-type.js +2 -0
  126. package/dist/modules/source-control.ee/types/key-pair.d.ts +4 -0
  127. package/dist/modules/source-control.ee/types/key-pair.js +2 -0
  128. package/dist/modules/source-control.ee/types/requests.d.ts +21 -0
  129. package/dist/modules/source-control.ee/types/requests.js +2 -0
  130. package/dist/modules/source-control.ee/types/resource-owner.d.ts +17 -0
  131. package/dist/modules/source-control.ee/types/resource-owner.js +2 -0
  132. package/dist/modules/source-control.ee/types/source-control-commit.d.ts +3 -0
  133. package/dist/modules/source-control.ee/types/source-control-commit.js +20 -0
  134. package/dist/modules/source-control.ee/types/source-control-context.d.ts +7 -0
  135. package/dist/modules/source-control.ee/types/source-control-context.js +16 -0
  136. package/dist/modules/source-control.ee/types/source-control-disconnect.d.ts +3 -0
  137. package/dist/modules/source-control.ee/types/source-control-disconnect.js +21 -0
  138. package/dist/modules/source-control.ee/types/source-control-generate-key-pair.d.ts +4 -0
  139. package/dist/modules/source-control.ee/types/source-control-generate-key-pair.js +21 -0
  140. package/dist/modules/source-control.ee/types/source-control-get-status.d.ts +10 -0
  141. package/dist/modules/source-control.ee/types/source-control-get-status.js +42 -0
  142. package/dist/modules/source-control.ee/types/source-control-preferences.d.ts +17 -0
  143. package/dist/modules/source-control.ee/types/source-control-preferences.js +88 -0
  144. package/dist/modules/source-control.ee/types/source-control-push.d.ts +3 -0
  145. package/dist/modules/source-control.ee/types/source-control-push.js +21 -0
  146. package/dist/modules/source-control.ee/types/source-control-set-branch.d.ts +3 -0
  147. package/dist/modules/source-control.ee/types/source-control-set-branch.js +20 -0
  148. package/dist/modules/source-control.ee/types/source-control-set-read-only.d.ts +3 -0
  149. package/dist/modules/source-control.ee/types/source-control-set-read-only.js +20 -0
  150. package/dist/modules/source-control.ee/types/source-control-stage.d.ts +5 -0
  151. package/dist/modules/source-control.ee/types/source-control-stage.js +31 -0
  152. package/dist/modules/source-control.ee/types/source-control-workflow-version-id.d.ts +12 -0
  153. package/dist/modules/source-control.ee/types/source-control-workflow-version-id.js +2 -0
  154. package/dist/modules/sso-oidc/constants.d.ts +3 -0
  155. package/dist/modules/sso-oidc/constants.js +6 -0
  156. package/dist/modules/sso-oidc/oidc.controller.ee.d.ts +23 -0
  157. package/dist/modules/sso-oidc/oidc.controller.ee.js +123 -0
  158. package/dist/modules/sso-oidc/oidc.service.ee.d.ts +56 -0
  159. package/dist/modules/sso-oidc/oidc.service.ee.js +468 -0
  160. package/dist/modules/sso-oidc/sso-oidc.module.d.ts +4 -0
  161. package/dist/modules/sso-oidc/sso-oidc.module.js +55 -0
  162. package/dist/modules/sso-saml/constants.d.ts +3 -0
  163. package/dist/modules/sso-saml/constants.js +6 -0
  164. package/dist/modules/sso-saml/errors/invalid-saml-metadata-url.error.d.ts +4 -0
  165. package/dist/modules/sso-saml/errors/invalid-saml-metadata-url.error.js +10 -0
  166. package/dist/modules/sso-saml/errors/invalid-saml-metadata.error.d.ts +4 -0
  167. package/dist/modules/sso-saml/errors/invalid-saml-metadata.error.js +10 -0
  168. package/dist/modules/sso-saml/middleware/saml-enabled-middleware.d.ts +3 -0
  169. package/dist/modules/sso-saml/middleware/saml-enabled-middleware.js +22 -0
  170. package/dist/modules/sso-saml/saml-helpers.d.ts +19 -0
  171. package/dist/modules/sso-saml/saml-helpers.js +129 -0
  172. package/dist/modules/sso-saml/saml-validator.d.ts +16 -0
  173. package/dist/modules/sso-saml/saml-validator.js +129 -0
  174. package/dist/modules/sso-saml/saml.controller.ee.d.ts +50 -0
  175. package/dist/modules/sso-saml/saml.controller.ee.js +227 -0
  176. package/dist/modules/sso-saml/saml.service.ee.d.ts +52 -0
  177. package/dist/modules/sso-saml/saml.service.ee.js +462 -0
  178. package/dist/modules/sso-saml/schema/metadata-exchange.xsd.d.ts +2 -0
  179. package/dist/modules/sso-saml/schema/metadata-exchange.xsd.js +118 -0
  180. package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.d.ts +2 -0
  181. package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.js +201 -0
  182. package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.d.ts +2 -0
  183. package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.js +114 -0
  184. package/dist/modules/sso-saml/schema/saml-schema-assertion-2.0.xsd.d.ts +2 -0
  185. package/dist/modules/sso-saml/schema/saml-schema-assertion-2.0.xsd.js +289 -0
  186. package/dist/modules/sso-saml/schema/saml-schema-metadata-2.0.xsd.d.ts +2 -0
  187. package/dist/modules/sso-saml/schema/saml-schema-metadata-2.0.xsd.js +344 -0
  188. package/dist/modules/sso-saml/schema/saml-schema-protocol-2.0.xsd.d.ts +2 -0
  189. package/dist/modules/sso-saml/schema/saml-schema-protocol-2.0.xsd.js +308 -0
  190. package/dist/modules/sso-saml/schema/ws-addr.xsd.d.ts +2 -0
  191. package/dist/modules/sso-saml/schema/ws-addr.xsd.js +143 -0
  192. package/dist/modules/sso-saml/schema/ws-authorization.xsd.d.ts +2 -0
  193. package/dist/modules/sso-saml/schema/ws-authorization.xsd.js +151 -0
  194. package/dist/modules/sso-saml/schema/ws-federation.xsd.d.ts +2 -0
  195. package/dist/modules/sso-saml/schema/ws-federation.xsd.js +476 -0
  196. package/dist/modules/sso-saml/schema/ws-securitypolicy-1.2.xsd.d.ts +2 -0
  197. package/dist/modules/sso-saml/schema/ws-securitypolicy-1.2.xsd.js +1211 -0
  198. package/dist/modules/sso-saml/schema/xenc-schema.xsd.d.ts +2 -0
  199. package/dist/modules/sso-saml/schema/xenc-schema.xsd.js +151 -0
  200. package/dist/modules/sso-saml/schema/xml.xsd.d.ts +2 -0
  201. package/dist/modules/sso-saml/schema/xml.xsd.js +123 -0
  202. package/dist/modules/sso-saml/schema/xmldsig-core-schema.xsd.d.ts +2 -0
  203. package/dist/modules/sso-saml/schema/xmldsig-core-schema.xsd.js +324 -0
  204. package/dist/modules/sso-saml/service-provider.ee.d.ts +6 -0
  205. package/dist/modules/sso-saml/service-provider.ee.js +44 -0
  206. package/dist/modules/sso-saml/sso-saml.module.d.ts +4 -0
  207. package/dist/modules/sso-saml/sso-saml.module.js +55 -0
  208. package/dist/modules/sso-saml/types.d.ts +4 -0
  209. package/dist/modules/sso-saml/types.js +2 -0
  210. package/dist/modules/sso-saml/views/init-sso-post.d.ts +2 -0
  211. package/dist/modules/sso-saml/views/init-sso-post.js +16 -0
  212. package/dist/node-lib.d.ts +10 -0
  213. package/dist/node-lib.js +137 -0
  214. package/dist/push/index.d.ts +1 -1
  215. package/dist/server.d.ts +1 -0
  216. package/dist/server.js +1 -0
  217. package/dist/services/cors-service.d.ts +7 -0
  218. package/dist/services/cors-service.js +50 -0
  219. package/dist/services/static-auth-service.d.ts +4 -0
  220. package/dist/services/static-auth-service.js +29 -0
  221. package/dist/sso.ee/saml/schema/metadata-exchange.xsd.js +0 -0
  222. package/dist/task-runners/task-broker/errors/task-runner-accept-timeout.error.js +0 -0
  223. package/dist/typecheck.tsbuildinfo +1 -0
  224. package/dist/user-management/email/templates/workflow-failure.handlebars +211 -0
  225. package/dist/utils/cors.util.d.ts +2 -0
  226. package/dist/utils/cors.util.js +17 -0
  227. package/dist/webhooks/waiting-forms.js +3 -3
  228. package/dist/webhooks/waiting-webhooks.js +2 -0
  229. package/dist/workflows/workflow.service.d.ts +2 -2
  230. package/dist/workflows/workflows.controller.d.ts +6 -6
  231. package/package.json +22 -21
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.OidcModule = void 0;
43
+ const decorators_1 = require("@n8n/decorators");
44
+ const di_1 = require("@n8n/di");
45
+ let OidcModule = class OidcModule {
46
+ async init() {
47
+ await Promise.resolve().then(() => __importStar(require('./oidc.controller.ee')));
48
+ const { OidcService } = await Promise.resolve().then(() => __importStar(require('./oidc.service.ee')));
49
+ await di_1.Container.get(OidcService).init();
50
+ }
51
+ };
52
+ exports.OidcModule = OidcModule;
53
+ exports.OidcModule = OidcModule = __decorate([
54
+ (0, decorators_1.BackendModule)({ name: 'sso-oidc', licenseFlag: 'feat:oidc', instanceTypes: ['main'] })
55
+ ], OidcModule);
@@ -0,0 +1,3 @@
1
+ export declare const SAML_PREFERENCES_DB_KEY = "features.saml";
2
+ export declare const SAML_LOGIN_LABEL = "sso.saml.loginLabel";
3
+ export declare const SAML_LOGIN_ENABLED = "sso.saml.loginEnabled";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SAML_LOGIN_ENABLED = exports.SAML_LOGIN_LABEL = exports.SAML_PREFERENCES_DB_KEY = void 0;
4
+ exports.SAML_PREFERENCES_DB_KEY = 'features.saml';
5
+ exports.SAML_LOGIN_LABEL = 'sso.saml.loginLabel';
6
+ exports.SAML_LOGIN_ENABLED = 'sso.saml.loginEnabled';
@@ -0,0 +1,4 @@
1
+ import { UserError } from 'n8n-workflow';
2
+ export declare class InvalidSamlMetadataUrlError extends UserError {
3
+ constructor(url: string);
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidSamlMetadataUrlError = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ class InvalidSamlMetadataUrlError extends n8n_workflow_1.UserError {
6
+ constructor(url) {
7
+ super(`Failed to produce valid SAML metadata from ${url}`);
8
+ }
9
+ }
10
+ exports.InvalidSamlMetadataUrlError = InvalidSamlMetadataUrlError;
@@ -0,0 +1,4 @@
1
+ import { UserError } from 'n8n-workflow';
2
+ export declare class InvalidSamlMetadataError extends UserError {
3
+ constructor(detail?: string);
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidSamlMetadataError = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ class InvalidSamlMetadataError extends n8n_workflow_1.UserError {
6
+ constructor(detail = '') {
7
+ super(`Invalid SAML metadata${detail ? ': ' + detail : ''}`);
8
+ }
9
+ }
10
+ exports.InvalidSamlMetadataError = InvalidSamlMetadataError;
@@ -0,0 +1,3 @@
1
+ import type { RequestHandler } from 'express';
2
+ export declare const samlLicensedAndEnabledMiddleware: RequestHandler;
3
+ export declare const samlLicensedMiddleware: RequestHandler;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.samlLicensedMiddleware = exports.samlLicensedAndEnabledMiddleware = void 0;
4
+ const sso_helpers_1 = require("../../../sso.ee/sso-helpers");
5
+ const samlLicensedAndEnabledMiddleware = (_, res, next) => {
6
+ if ((0, sso_helpers_1.isSamlLicensedAndEnabled)()) {
7
+ next();
8
+ }
9
+ else {
10
+ res.status(403).json({ status: 'error', message: 'Unauthorized' });
11
+ }
12
+ };
13
+ exports.samlLicensedAndEnabledMiddleware = samlLicensedAndEnabledMiddleware;
14
+ const samlLicensedMiddleware = (_, res, next) => {
15
+ if ((0, sso_helpers_1.isSamlLicensed)()) {
16
+ next();
17
+ }
18
+ else {
19
+ res.status(403).json({ status: 'error', message: 'Unauthorized' });
20
+ }
21
+ };
22
+ exports.samlLicensedMiddleware = samlLicensedMiddleware;
@@ -0,0 +1,19 @@
1
+ import type { SamlAcsDto, SamlPreferences } from '@n8n/api-types';
2
+ import type { User } from '@n8n/db';
3
+ import type { FlowResult } from 'samlify/types/src/flow';
4
+ import type { SamlAttributeMapping, SamlUserAttributes } from './types';
5
+ export declare function setSamlLoginEnabled(enabled: boolean): Promise<void>;
6
+ export declare function setSamlLoginLabel(label: string): void;
7
+ export declare const isSamlPreferences: (candidate: unknown) => candidate is SamlPreferences;
8
+ export declare function createUserFromSamlAttributes(attributes: SamlUserAttributes): Promise<User>;
9
+ export declare function updateUserFromSamlAttributes(user: User, attributes: SamlUserAttributes): Promise<User>;
10
+ type GetMappedSamlReturn = {
11
+ attributes: SamlUserAttributes | undefined;
12
+ missingAttributes: string[];
13
+ };
14
+ export declare function getMappedSamlAttributesFromFlowResult(flowResult: FlowResult, attributeMapping: SamlAttributeMapping, jitClaimNames: {
15
+ instanceRole: string | null;
16
+ projectRoles: string | null;
17
+ }): GetMappedSamlReturn;
18
+ export declare function isConnectionTestRequest(payload: SamlAcsDto): boolean;
19
+ export {};
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSamlPreferences = void 0;
4
+ exports.setSamlLoginEnabled = setSamlLoginEnabled;
5
+ exports.setSamlLoginLabel = setSamlLoginLabel;
6
+ exports.createUserFromSamlAttributes = createUserFromSamlAttributes;
7
+ exports.updateUserFromSamlAttributes = updateUserFromSamlAttributes;
8
+ exports.getMappedSamlAttributesFromFlowResult = getMappedSamlAttributesFromFlowResult;
9
+ exports.isConnectionTestRequest = isConnectionTestRequest;
10
+ const config_1 = require("@n8n/config");
11
+ const db_1 = require("@n8n/db");
12
+ const di_1 = require("@n8n/di");
13
+ const n8n_workflow_1 = require("n8n-workflow");
14
+ const auth_error_1 = require("../../errors/response-errors/auth.error");
15
+ const internal_server_error_1 = require("../../errors/response-errors/internal-server.error");
16
+ const password_utility_1 = require("../../services/password.utility");
17
+ const sso_helpers_1 = require("../../sso.ee/sso-helpers");
18
+ const service_provider_ee_1 = require("./service-provider.ee");
19
+ async function setSamlLoginEnabled(enabled) {
20
+ const currentAuthenticationMethod = (0, sso_helpers_1.getCurrentAuthenticationMethod)();
21
+ if (enabled && !(0, sso_helpers_1.isEmailCurrentAuthenticationMethod)() && !(0, sso_helpers_1.isSamlCurrentAuthenticationMethod)()) {
22
+ throw new internal_server_error_1.InternalServerError(`Cannot switch SAML login enabled state when an authentication method other than email or saml is active (current: ${currentAuthenticationMethod})`);
23
+ }
24
+ const targetAuthenticationMethod = !enabled && currentAuthenticationMethod === 'saml' ? 'email' : currentAuthenticationMethod;
25
+ di_1.Container.get(config_1.GlobalConfig).sso.saml.loginEnabled = enabled;
26
+ await (0, sso_helpers_1.setCurrentAuthenticationMethod)(enabled ? 'saml' : targetAuthenticationMethod);
27
+ }
28
+ function setSamlLoginLabel(label) {
29
+ di_1.Container.get(config_1.GlobalConfig).sso.saml.loginLabel = label;
30
+ }
31
+ const isSamlPreferences = (candidate) => {
32
+ const o = candidate;
33
+ return (typeof o === 'object' &&
34
+ typeof o.metadata === 'string' &&
35
+ typeof o.mapping === 'object' &&
36
+ o.mapping !== null &&
37
+ o.loginEnabled !== undefined);
38
+ };
39
+ exports.isSamlPreferences = isSamlPreferences;
40
+ async function createUserFromSamlAttributes(attributes) {
41
+ const randomPassword = (0, n8n_workflow_1.randomString)(18);
42
+ const userRepository = di_1.Container.get(db_1.UserRepository);
43
+ return await userRepository.manager.transaction(async (trx) => {
44
+ const { user } = await userRepository.createUserWithProject({
45
+ email: attributes.email.toLowerCase(),
46
+ firstName: attributes.firstName,
47
+ lastName: attributes.lastName,
48
+ role: { slug: 'global:member' },
49
+ password: await di_1.Container.get(password_utility_1.PasswordUtility).hash(randomPassword),
50
+ }, trx);
51
+ await trx.save(trx.create(db_1.AuthIdentity, {
52
+ providerId: attributes.userPrincipalName,
53
+ providerType: 'saml',
54
+ userId: user.id,
55
+ }));
56
+ return user;
57
+ });
58
+ }
59
+ async function updateUserFromSamlAttributes(user, attributes) {
60
+ if (!attributes.email)
61
+ throw new auth_error_1.AuthError('Email is required to update user');
62
+ if (!user)
63
+ throw new auth_error_1.AuthError('User not found');
64
+ let samlAuthIdentity = user?.authIdentities.find((e) => e.providerType === 'saml');
65
+ if (!samlAuthIdentity) {
66
+ samlAuthIdentity = new db_1.AuthIdentity();
67
+ samlAuthIdentity.providerId = attributes.userPrincipalName;
68
+ samlAuthIdentity.providerType = 'saml';
69
+ samlAuthIdentity.user = user;
70
+ user.authIdentities.push(samlAuthIdentity);
71
+ }
72
+ else {
73
+ samlAuthIdentity.providerId = attributes.userPrincipalName;
74
+ }
75
+ await di_1.Container.get(db_1.AuthIdentityRepository).save(samlAuthIdentity, { transaction: false });
76
+ user.firstName = attributes.firstName;
77
+ user.lastName = attributes.lastName;
78
+ const resultUser = await di_1.Container.get(db_1.UserRepository).save(user, { transaction: false });
79
+ if (!resultUser)
80
+ throw new auth_error_1.AuthError('Could not update User');
81
+ const userWithRole = await di_1.Container.get(db_1.UserRepository).findOne({
82
+ where: { id: resultUser.id },
83
+ relations: ['role'],
84
+ transaction: false,
85
+ });
86
+ if (!userWithRole)
87
+ throw new auth_error_1.AuthError('Failed to fetch user!');
88
+ return userWithRole;
89
+ }
90
+ function getMappedSamlAttributesFromFlowResult(flowResult, attributeMapping, jitClaimNames) {
91
+ const result = {
92
+ attributes: undefined,
93
+ missingAttributes: [],
94
+ };
95
+ if (flowResult?.extract?.attributes) {
96
+ const attributes = flowResult.extract.attributes;
97
+ const email = attributes[attributeMapping.email];
98
+ const firstName = attributes[attributeMapping.firstName];
99
+ const lastName = attributes[attributeMapping.lastName];
100
+ const userPrincipalName = attributes[attributeMapping.userPrincipalName];
101
+ result.attributes = {
102
+ email,
103
+ firstName,
104
+ lastName,
105
+ userPrincipalName,
106
+ };
107
+ if (jitClaimNames.instanceRole && typeof attributes[jitClaimNames.instanceRole] === 'string') {
108
+ result.attributes.n8nInstanceRole = attributes[jitClaimNames.instanceRole];
109
+ }
110
+ if (jitClaimNames.projectRoles && attributes[jitClaimNames.projectRoles]) {
111
+ const projectRolesFromFlowResult = attributes[jitClaimNames.projectRoles];
112
+ result.attributes.n8nProjectRoles = Array.isArray(projectRolesFromFlowResult)
113
+ ? projectRolesFromFlowResult
114
+ : [projectRolesFromFlowResult];
115
+ }
116
+ if (!email)
117
+ result.missingAttributes.push(attributeMapping.email);
118
+ if (!userPrincipalName)
119
+ result.missingAttributes.push(attributeMapping.userPrincipalName);
120
+ if (!firstName)
121
+ result.missingAttributes.push(attributeMapping.firstName);
122
+ if (!lastName)
123
+ result.missingAttributes.push(attributeMapping.lastName);
124
+ }
125
+ return result;
126
+ }
127
+ function isConnectionTestRequest(payload) {
128
+ return payload.RelayState === (0, service_provider_ee_1.getServiceProviderConfigTestReturnUrl)();
129
+ }
@@ -0,0 +1,16 @@
1
+ import { Logger } from '@n8n/backend-common';
2
+ import type { IdentityProviderInstance } from 'samlify';
3
+ export declare class SamlValidator {
4
+ private readonly logger;
5
+ private xmlMetadata;
6
+ private xmlProtocol;
7
+ private preload;
8
+ constructor(logger: Logger);
9
+ private xmllint;
10
+ init(): Promise<void>;
11
+ validateIdentiyProvider(idp: IdentityProviderInstance): void;
12
+ validateMetadata(metadata: string): Promise<boolean>;
13
+ validateResponse(response: string): Promise<boolean>;
14
+ private loadSchemas;
15
+ private validateXml;
16
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.SamlValidator = void 0;
46
+ const backend_common_1 = require("@n8n/backend-common");
47
+ const di_1 = require("@n8n/di");
48
+ const samlify_1 = require("samlify");
49
+ const invalid_saml_metadata_error_1 = require("./errors/invalid-saml-metadata.error");
50
+ let SamlValidator = class SamlValidator {
51
+ constructor(logger) {
52
+ this.logger = logger;
53
+ this.preload = [];
54
+ }
55
+ async init() {
56
+ await this.loadSchemas();
57
+ this.xmllint = await Promise.resolve().then(() => __importStar(require('xmllint-wasm')));
58
+ }
59
+ validateIdentiyProvider(idp) {
60
+ const binding = idp.entityMeta.getSingleSignOnService(samlify_1.Constants.wording.binding.redirect);
61
+ if (typeof binding !== 'string') {
62
+ throw new invalid_saml_metadata_error_1.InvalidSamlMetadataError('only SAML redirect binding is supported.');
63
+ }
64
+ }
65
+ async validateMetadata(metadata) {
66
+ const validXML = await this.validateXml('metadata', metadata);
67
+ if (validXML) {
68
+ const idp = (0, samlify_1.IdentityProvider)({
69
+ metadata,
70
+ });
71
+ this.validateIdentiyProvider(idp);
72
+ }
73
+ return validXML;
74
+ }
75
+ async validateResponse(response) {
76
+ return await this.validateXml('response', response);
77
+ }
78
+ async loadSchemas() {
79
+ this.xmlProtocol = (await Promise.resolve().then(() => __importStar(require('./schema/saml-schema-protocol-2.0.xsd')))).xmlFileInfo;
80
+ this.xmlMetadata = (await Promise.resolve().then(() => __importStar(require('./schema/saml-schema-metadata-2.0.xsd')))).xmlFileInfo;
81
+ this.preload = (await Promise.all([
82
+ Promise.resolve().then(() => __importStar(require('./schema/saml-schema-assertion-2.0.xsd'))),
83
+ Promise.resolve().then(() => __importStar(require('./schema/xmldsig-core-schema.xsd'))),
84
+ Promise.resolve().then(() => __importStar(require('./schema/xenc-schema.xsd'))),
85
+ Promise.resolve().then(() => __importStar(require('./schema/xml.xsd'))),
86
+ Promise.resolve().then(() => __importStar(require('./schema/ws-federation.xsd'))),
87
+ Promise.resolve().then(() => __importStar(require('./schema/oasis-200401-wss-wssecurity-secext-1.0.xsd'))),
88
+ Promise.resolve().then(() => __importStar(require('./schema/oasis-200401-wss-wssecurity-utility-1.0.xsd'))),
89
+ Promise.resolve().then(() => __importStar(require('./schema/ws-addr.xsd'))),
90
+ Promise.resolve().then(() => __importStar(require('./schema/metadata-exchange.xsd'))),
91
+ Promise.resolve().then(() => __importStar(require('./schema/ws-securitypolicy-1.2.xsd'))),
92
+ Promise.resolve().then(() => __importStar(require('./schema/ws-authorization.xsd'))),
93
+ ])).map((m) => m.xmlFileInfo);
94
+ }
95
+ async validateXml(type, contents) {
96
+ const fileName = `${type}.xml`;
97
+ const schema = type === 'metadata' ? [this.xmlMetadata] : [this.xmlProtocol];
98
+ const preload = [type === 'metadata' ? this.xmlProtocol : this.xmlMetadata, ...this.preload];
99
+ try {
100
+ const validationResult = await this.xmllint.validateXML({
101
+ xml: [{ fileName, contents }],
102
+ extension: 'schema',
103
+ schema,
104
+ preload,
105
+ });
106
+ if (validationResult?.valid) {
107
+ this.logger.debug(`SAML ${type} is valid`);
108
+ return true;
109
+ }
110
+ else {
111
+ this.logger.debug(`SAML ${type} is invalid`);
112
+ this.logger.warn(validationResult
113
+ ? validationResult.errors
114
+ .map((error) => `${error.message} - ${error.rawMessage}`)
115
+ .join('\n')
116
+ : '');
117
+ }
118
+ }
119
+ catch (error) {
120
+ this.logger.warn(error);
121
+ }
122
+ return false;
123
+ }
124
+ };
125
+ exports.SamlValidator = SamlValidator;
126
+ exports.SamlValidator = SamlValidator = __decorate([
127
+ (0, di_1.Service)(),
128
+ __metadata("design:paramtypes", [backend_common_1.Logger])
129
+ ], SamlValidator);
@@ -0,0 +1,50 @@
1
+ import { SamlAcsDto, SamlPreferences, SamlToggleDto } from '@n8n/api-types';
2
+ import { AuthenticatedRequest } from '@n8n/db';
3
+ import { Response } from 'express';
4
+ import { AuthService } from '../../auth/auth.service';
5
+ import { EventService } from '../../events/event.service';
6
+ import { AuthlessRequest } from '../../requests';
7
+ import { UrlService } from '../../services/url.service';
8
+ import { SamlService } from './saml.service.ee';
9
+ export declare class SamlController {
10
+ private readonly authService;
11
+ private readonly samlService;
12
+ private readonly urlService;
13
+ private readonly eventService;
14
+ constructor(authService: AuthService, samlService: SamlService, urlService: UrlService, eventService: EventService);
15
+ getServiceProviderMetadata(_: AuthlessRequest, res: Response): Promise<Response<any, Record<string, any>>>;
16
+ configGet(): Promise<{
17
+ entityID: string;
18
+ returnUrl: string;
19
+ ignoreSSL: boolean;
20
+ loginBinding: "redirect" | "post";
21
+ authnRequestsSigned: boolean;
22
+ wantAssertionsSigned: boolean;
23
+ wantMessageSigned: boolean;
24
+ acsBinding: "redirect" | "post";
25
+ signatureConfig: {
26
+ prefix: string;
27
+ location: {
28
+ action: "before" | "after" | "prepend" | "append";
29
+ reference: string;
30
+ };
31
+ };
32
+ relayState: string;
33
+ mapping?: import("@n8n/api-types").SamlPreferencesAttributeMapping | undefined;
34
+ metadata?: string | undefined;
35
+ metadataUrl?: string | undefined;
36
+ loginEnabled?: boolean | undefined;
37
+ loginLabel?: string | undefined;
38
+ }>;
39
+ configPost(_req: AuthenticatedRequest, _res: Response, payload: SamlPreferences): Promise<SamlPreferences | undefined>;
40
+ toggleEnabledPost(_req: AuthenticatedRequest, res: Response, { loginEnabled }: SamlToggleDto): Promise<Response<any, Record<string, any>>>;
41
+ acsGet(req: AuthlessRequest, res: Response): Promise<void | Response<any, Record<string, any>>>;
42
+ acsPost(req: AuthlessRequest, res: Response, payload: SamlAcsDto): Promise<void | Response<any, Record<string, any>>>;
43
+ private acsHandler;
44
+ initSsoGet(req: AuthlessRequest<{}, {}, {}, {
45
+ redirect?: string;
46
+ }>, res: Response): Promise<string | Response<any, Record<string, any>>>;
47
+ configTestGet(_: AuthenticatedRequest, res: Response): Promise<string | Response<any, Record<string, any>>>;
48
+ private handleInitSSO;
49
+ private validateRedirectUrl;
50
+ }