twenty/packages/twenty-server
Weiko 9a116b08a4
User workspace middleware throws 401 if token is invalid (#5245)
## Context
Currently, this middleware validates the token and stores the user,
workspace and cacheversion in the request object.
It only does so when a token is provided and ignores the middleware
logic if not. If the token is invalid or expired, the exception is
swallowed.

This PR removes the try/catch and adds an allowlist to skip the token
validation for operations executed while not signed-in.
I don't know a better way to do that with Nestjs. We can't easily add
the middleware per resolver without refactoring the flexible schema
engine so I'm doing it the other way around.

Fixes https://github.com/twentyhq/twenty/issues/5224
2024-05-02 12:54:01 +02:00
..
@types Compile with swc on twenty-server (#4863) 2024-04-14 09:09:51 +02:00
patches Fix workspace schema caching when user is not logged in (#5173) 2024-04-25 14:45:14 +02:00
scripts Uniformize datasources (#5196) 2024-04-27 11:43:44 +02:00
src User workspace middleware throws 401 if token is invalid (#5245) 2024-05-02 12:54:01 +02:00
test chore: use Nx affected tasks in CI (#5110) 2024-04-30 16:28:25 +02:00
.env.example GH-3546 Recaptcha on login form (#4626) 2024-04-25 23:52:28 +02:00
.env.test File token chores (#4664) 2024-03-26 13:42:09 +01:00
.eslintrc.cjs chore: extend root eslint config in twenty-server (#5101) 2024-04-22 17:34:24 +02:00
.gitignore feat: workspace:health nullable fix (#3882) 2024-02-08 18:22:29 +01:00
.prettierignore Migrate to a monorepo structure (#2909) 2023-12-10 18:10:54 +01:00
.prettierrc Migrate to a monorepo structure (#2909) 2023-12-10 18:10:54 +01:00
.swcrc Compile with swc on twenty-server (#4863) 2024-04-14 09:09:51 +02:00
jest.config.ts Refactor backend folder structure (#4505) 2024-03-15 18:37:09 +01:00
nest-cli.json chore: use Nx affected tasks in CI (#5110) 2024-04-30 16:28:25 +02:00
package.json Bump to 0.10.5 2024-05-02 11:00:24 +02:00
project.json chore: use Nx affected tasks in CI (#5110) 2024-04-30 16:28:25 +02:00
tsconfig.build.json chore: set up twenty-emails config so build isn't needed in development (#3619) 2024-01-29 06:17:12 -03:00
tsconfig.json 4586 fix workspace member feature (#4680) 2024-03-28 17:59:48 +01:00