Skip to content

Commit

Permalink
Merge branch 'feature/resource-mapping-component' into node-396-postg…
Browse files Browse the repository at this point in the history
…res-node-resorce-mapper

* feature/resource-mapping-component:
  ci: Fix saml.api.test.ts (no-changelog) (#5764)
  docs: Refer to docker.n8n.io/n8nio/n8n for pulling n8n docker images (no-changelog) (#5763)
  🚀 Release 0.221.0 (#5726)
  fix(core): Persist CurrentAuthenticationMethod setting change (#5762)
  feat(core): Limit user invites when SAML is enabled (#5761)
  fix(core): Setup nodeHelpers that aren't exposed in the code sandbox (no-changelog) (#5753)
  fix(HTTP Request Node): Fix AWS credentials to automatically deconstruct the url (#5751)
  fix(core): Require Auth on icons and nodes/credentials types static files (no-changelog) (#5745)
  fix(Split In Batches Node): Roll back changes in v1 and create v2 (#5747)
  • Loading branch information
MiloradFilipovic committed Mar 23, 2023
2 parents 8830397 + 8f3cb59 commit e3d4ff5
Show file tree
Hide file tree
Showing 27 changed files with 182 additions and 109 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# [0.221.0](https://github.com/n8n-io/n8n/compare/[email protected]@0.221.0) (2023-03-23)


### Bug Fixes

* **core:** Fix calling error workflows in main mode recovery ([#5698](https://github.com/n8n-io/n8n/issues/5698)) ([e0ea97a](https://github.com/n8n-io/n8n/commit/e0ea97af8d7aaa014680f5f9d5702d1cafd49757))
* **core:** Fix telemetry execution status for manual workflows executions ([#5712](https://github.com/n8n-io/n8n/issues/5712)) ([a28396e](https://github.com/n8n-io/n8n/commit/a28396ee91bfbccc6596812606c237a8e2c34088))
* **core:** Return saml attributes after connection test ([#5717](https://github.com/n8n-io/n8n/issues/5717)) ([be172cb](https://github.com/n8n-io/n8n/commit/be172cb720c8a44ebd1f0b86dddab321e1e3c9fd))
* **editor:** Disable tooltip for display modes that don't support mapping ([#5715](https://github.com/n8n-io/n8n/issues/5715)) ([fb8755e](https://github.com/n8n-io/n8n/commit/fb8755ea3c720c98f002a6756c39b8fed11482c0))
* **editor:** Fix execution list item selection ([#5606](https://github.com/n8n-io/n8n/issues/5606)) ([7a352ef](https://github.com/n8n-io/n8n/commit/7a352efff944c52062412e53ea2c1a034a25f908))
* **editor:** Fix for large notifications being cut off ([#5705](https://github.com/n8n-io/n8n/issues/5705)) ([c07f838](https://github.com/n8n-io/n8n/commit/c07f838ce60dc33261fe3e1b5e7dd6fe05f1d63b))
* **editor:** Fix redo in code and expression editor ([#5708](https://github.com/n8n-io/n8n/issues/5708)) ([cd7a55b](https://github.com/n8n-io/n8n/commit/cd7a55ba5aeb83d1e540a65b5c6b2c74fd742461))
* **editor:** Fix the canvas node distance when automatically injecting manual trigger ([#5716](https://github.com/n8n-io/n8n/issues/5716)) ([cb2ba97](https://github.com/n8n-io/n8n/commit/cb2ba97f3837b572e237da1256b9f2ee376767a9))
* **HTTP Request Node:** Fix AWS credentials to automatically deconstruct the url ([#5751](https://github.com/n8n-io/n8n/issues/5751)) ([4ac944a](https://github.com/n8n-io/n8n/commit/4ac944af3028b70ae600000300c16de77c1af1d5))
* **Split In Batches Node:** Roll back changes in v1 and create v2 ([#5747](https://github.com/n8n-io/n8n/issues/5747)) ([cefec77](https://github.com/n8n-io/n8n/commit/cefec7739b6da820d64f9476476e1901d4f386bf))


### Features

* **core:** Augment data instead of copying it ([#5487](https://github.com/n8n-io/n8n/issues/5487)) ([0876c38](https://github.com/n8n-io/n8n/commit/0876c38aaeb8355141fecbc14e84cdda0b2c737b))
* **editor:** Move canvas by holding Space or Middle mouse button ([#5719](https://github.com/n8n-io/n8n/issues/5719)) ([19dded1](https://github.com/n8n-io/n8n/commit/19dded18c9a588a30b9ac1fc274dcd967e9b7b6b))
* **editor:** Recommend and pre-select auth type with overrides ([#5684](https://github.com/n8n-io/n8n/issues/5684)) ([f59b591](https://github.com/n8n-io/n8n/commit/f59b591c93ecd7cbd279668abe6494ef2b88c831))
* **editor:** SSO login button ([#5615](https://github.com/n8n-io/n8n/issues/5615)) ([6916628](https://github.com/n8n-io/n8n/commit/6916628a9f11e07cbcdf390f747f396fb0ef9e3c))
* **QuickChart Node:** Add QuickChart node ([#3572](https://github.com/n8n-io/n8n/issues/3572)) ([233f1fa](https://github.com/n8n-io/n8n/commit/233f1fa7ec230e92e868de0247e315aa6a705ead))



## [0.220.1](https://github.com/n8n-io/n8n/compare/[email protected]@0.220.1) (2023-03-22)


### Bug Fixes

* **Split In Batches Node:** Roll back changes in v1 and create v2 ([#5747](https://github.com/n8n-io/n8n/issues/5747)) ([6d1c88e](https://github.com/n8n-io/n8n/commit/6d1c88ea8c2e5dc72c6e6edeeeef52dc1fba4075))



# [0.220.0](https://github.com/n8n-io/n8n/compare/[email protected]@0.220.0) (2023-03-16)


Expand Down
2 changes: 1 addition & 1 deletion docker/compose/subfolderWithSSL/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- ${DATA_FOLDER}/letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
n8n:
image: n8nio/n8n
image: docker.n8n.io/n8nio/n8n
ports:
- '127.0.0.1:5678:5678'
labels:
Expand Down
2 changes: 1 addition & 1 deletion docker/compose/withMariaDB/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
retries: 10

n8n:
image: n8nio/n8n
image: docker.n8n.io/n8nio/n8n
restart: always
environment:
- DB_TYPE=mariadb
Expand Down
2 changes: 1 addition & 1 deletion docker/compose/withPostgres/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
retries: 10

n8n:
image: n8nio/n8n
image: docker.n8n.io/n8nio/n8n
restart: always
environment:
- DB_TYPE=postgresdb
Expand Down
4 changes: 2 additions & 2 deletions docker/compose/withPostgresAndWorker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ services:

n8n:
<<: *shared
image: n8nio/n8n
image: docker.n8n.io/n8nio/n8n
command: /bin/sh -c "n8n start --tunnel"
ports:
- 5678:5678

n8n-worker:
<<: *shared
image: n8nio/n8n
image: docker.n8n.io/n8nio/n8n
command: /bin/sh -c "sleep 5; n8n worker"
depends_on:
- n8n
127 changes: 66 additions & 61 deletions docker/images/n8n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ Additional information and example workflows on the n8n.io website: [https://n8n

## Start n8n in Docker

```
```bash
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
```

You can then access n8n by opening:
Expand All @@ -62,13 +62,13 @@ n8n instance.

To use it simply start n8n with `--tunnel`

```
```bash
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n \
n8n start --tunnel
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
docker.n8n.io/n8nio/n8n \
n8n start --tunnel
```

## Securing n8n
Expand All @@ -79,7 +79,7 @@ to make sure that n8n is protected!
Right now we have very basic protection via basic-auth in place. It can be activated
by setting the following environment variables:

```
```text
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=<USER>
N8N_BASIC_AUTH_PASSWORD=<PASSWORD>
Expand All @@ -91,12 +91,12 @@ The workflow data gets by default saved in an SQLite database in the user
folder (`/home/node/.n8n`). That folder also additionally contains the
settings like webhook URL and encryption key.

```
```bash
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
```

### Start with other Database
Expand All @@ -123,20 +123,20 @@ Replace the following placeholders with the actual data:
- POSTGRES_USER
- POSTGRES_SCHEMA

```
```bash
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-e DB_TYPE=postgresdb \
-e DB_POSTGRESDB_DATABASE=<POSTGRES_DATABASE> \
-e DB_POSTGRESDB_HOST=<POSTGRES_HOST> \
-e DB_POSTGRESDB_PORT=<POSTGRES_PORT> \
-e DB_POSTGRESDB_USER=<POSTGRES_USER> \
-e DB_POSTGRESDB_SCHEMA=<POSTGRES_SCHEMA> \
-e DB_POSTGRESDB_PASSWORD=<POSTGRES_PASSWORD> \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n \
n8n start
--name n8n \
-p 5678:5678 \
-e DB_TYPE=postgresdb \
-e DB_POSTGRESDB_DATABASE=<POSTGRES_DATABASE> \
-e DB_POSTGRESDB_HOST=<POSTGRES_HOST> \
-e DB_POSTGRESDB_PORT=<POSTGRES_PORT> \
-e DB_POSTGRESDB_USER=<POSTGRES_USER> \
-e DB_POSTGRESDB_SCHEMA=<POSTGRES_SCHEMA> \
-e DB_POSTGRESDB_PASSWORD=<POSTGRES_PASSWORD> \
-v ~/.n8n:/home/node/.n8n \
docker.n8n.io/n8nio/n8n \
n8n start
```

A full working setup with docker-compose can be found [here](https://github.com/n8n-io/n8n/blob/master/docker/compose/withPostgres/README.md)
Expand All @@ -151,19 +151,19 @@ Replace the following placeholders with the actual data:
- MYSQLDB_PORT
- MYSQLDB_USER

```
```bash
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-e DB_TYPE=mysqldb \
-e DB_MYSQLDB_DATABASE=<MYSQLDB_DATABASE> \
-e DB_MYSQLDB_HOST=<MYSQLDB_HOST> \
-e DB_MYSQLDB_PORT=<MYSQLDB_PORT> \
-e DB_MYSQLDB_USER=<MYSQLDB_USER> \
-e DB_MYSQLDB_PASSWORD=<MYSQLDB_PASSWORD> \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n \
n8n start
--name n8n \
-p 5678:5678 \
-e DB_TYPE=mysqldb \
-e DB_MYSQLDB_DATABASE=<MYSQLDB_DATABASE> \
-e DB_MYSQLDB_HOST=<MYSQLDB_HOST> \
-e DB_MYSQLDB_PORT=<MYSQLDB_PORT> \
-e DB_MYSQLDB_USER=<MYSQLDB_USER> \
-e DB_MYSQLDB_PASSWORD=<MYSQLDB_PASSWORD> \
-v ~/.n8n:/home/node/.n8n \
docker.n8n.io/n8nio/n8n \
n8n start
```

## Passing Sensitive Data via File
Expand Down Expand Up @@ -191,16 +191,21 @@ A basic step by step example setup of n8n with docker-compose and Lets Encrypt i

## Updating a running docker-compose instance

```
# Pull down the latest version from dockerhub
docker pull n8nio/n8n
# Stop current setup
sudo docker-compose stop
# Delete it (will only delete the docker-containers, data is stored separately)
sudo docker-compose rm
# Then start it again
sudo docker-compose up -d
```
1. Pull the latest version from the registry

`docker pull docker.n8n.io/n8nio/n8n`

2. Stop the current setup

`sudo docker-compose stop`

3. Delete it (will only delete the docker-containers, data is stored separately)

`sudo docker-compose rm`

4. Then start it again

`sudo docker-compose up -d`

## Setting Timezone

Expand All @@ -212,22 +217,22 @@ the environment variable `TZ`.

Example to use the same timezone for both:

```
```bash
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-e GENERIC_TIMEZONE="Europe/Berlin" \
-e TZ="Europe/Berlin" \
n8nio/n8n
--name n8n \
-p 5678:5678 \
-e GENERIC_TIMEZONE="Europe/Berlin" \
-e TZ="Europe/Berlin" \
docker.n8n.io/n8nio/n8n
```

## Build Docker-Image

```
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg N8N_VERSION=<VERSION> -t n8nio/n8n:<VERSION> .
```bash
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg N8N_VERSION=<VERSION> -t n8n:<VERSION> .

# For example:
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg N8N_VERSION=0.114.0 -t n8nio/n8n:0.114.0 .
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg N8N_VERSION=0.114.0 -t n8n:0.114.0 .
```

## What does n8n mean and how do you pronounce it?
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "n8n",
"version": "0.220.0",
"version": "0.221.0",
"private": true,
"homepage": "https://n8n.io",
"engines": {
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ To play around with n8n, you can also start it using Docker:
docker run -it --rm \
--name n8n \
-p 5678:5678 \
n8nio/n8n
docker.n8n.io/n8nio/n8n
```

Be aware that all the data will be lost once the Docker container gets removed. To persist the data mount the `~/.n8n` folder:
Expand All @@ -68,11 +68,9 @@ docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
docker.n8n.io/n8nio/n8n
```

n8n also offers a Docker image for Raspberry Pi: `n8nio/n8n:latest-rpi`.

Refer to the [documentation](https://github.com/n8n-io/n8n/blob/master/docker/images/n8n/README.md) for more information on the Docker setup.

### Install with npm
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "n8n",
"version": "0.220.0",
"version": "0.221.0",
"description": "n8n Workflow Automation Tool",
"license": "SEE LICENSE IN LICENSE.md",
"homepage": "https://n8n.io",
Expand Down
14 changes: 8 additions & 6 deletions packages/cli/src/controllers/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
getInstanceBaseUrl,
hashPassword,
isEmailSetUp,
isUserManagementEnabled,
sanitizeUser,
validatePassword,
withFeatureFlags,
Expand All @@ -35,6 +34,8 @@ import type {
import type { ActiveWorkflowRunner } from '@/ActiveWorkflowRunner';
import { AuthIdentity } from '@db/entities/AuthIdentity';
import type { PostHogClient } from '@/posthog';
import { userManagementEnabledMiddleware } from '../middlewares/userManagementEnabled';
import { isSamlLicensedAndEnabled } from '../sso/saml/samlHelpers';

@RestController('/users')
export class UsersController {
Expand Down Expand Up @@ -98,14 +99,15 @@ export class UsersController {
/**
* Send email invite(s) to one or multiple users and create user shell(s).
*/
@Post('/')
@Post('/', { middlewares: [userManagementEnabledMiddleware] })
async sendEmailInvites(req: UserRequest.Invite) {
// TODO: this should be checked in the middleware rather than here
if (!isUserManagementEnabled()) {
if (isSamlLicensedAndEnabled()) {
this.logger.debug(
'Request to send email invite(s) to user(s) failed because user management is disabled',
'SAML is enabled, so users are managed by the Identity Provider and cannot be added through invites',
);
throw new BadRequestError(
'SAML is enabled, so users are managed by the Identity Provider and cannot be added through invites',
);
throw new BadRequestError('User management is disabled');
}

if (!this.config.getEnv('userManagement.isInstanceOwnerSetUp')) {
Expand Down
12 changes: 12 additions & 0 deletions packages/cli/src/middlewares/userManagementEnabled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { RequestHandler } from 'express';
import { LoggerProxy } from 'n8n-workflow';
import { isUserManagementEnabled } from '../UserManagement/UserManagementHelper';

export const userManagementEnabledMiddleware: RequestHandler = (req, res, next) => {
if (isUserManagementEnabled()) {
next();
} else {
LoggerProxy.debug('Request failed because user management is disabled');
res.status(400).json({ status: 'error', message: 'User management is disabled' });
}
};
2 changes: 1 addition & 1 deletion packages/cli/src/sso/saml/saml.service.ee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class SamlService {
}
this._samlPreferences.metadata = prefs.metadata;
}
setSamlLoginEnabled(prefs.loginEnabled ?? isSamlLoginEnabled());
await setSamlLoginEnabled(prefs.loginEnabled ?? isSamlLoginEnabled());
setSamlLoginLabel(prefs.loginLabel ?? getSamlLoginLabel());
this.getIdentityProviderInstance(true);
const result = await this.saveSamlPreferencesToDb();
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/sso/saml/samlHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export function getSamlLoginLabel(): string {
}

// can only toggle between email and saml, not directly to e.g. ldap
export function setSamlLoginEnabled(enabled: boolean): void {
export async function setSamlLoginEnabled(enabled: boolean): Promise<void> {
if (enabled) {
if (isEmailCurrentAuthenticationMethod()) {
config.set(SAML_LOGIN_ENABLED, true);
setCurrentAuthenticationMethod('saml');
await setCurrentAuthenticationMethod('saml');
}
} else {
config.set(SAML_LOGIN_ENABLED, false);
setCurrentAuthenticationMethod('email');
await setCurrentAuthenticationMethod('email');
}
}

Expand Down
Loading

0 comments on commit e3d4ff5

Please sign in to comment.