1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-12 01:17:04 +02:00
unleash.unleash/src/lib/routes/admin-api
Thomas Heartman 2bad98a121
fix: disallow invalid tag values (#7268)
This PR fixes how Unleash handles tag values. Specifically, it does
these things:
1. Trims leading and trailing whitespace from tag values before
inserting them into the database
2. Updates OpenAPI validation to not allow whitespace-only and to ignore
leading and trailing whitespace

Additionally, it moves the tag length constants into the constants file
from the Joi tag schema file. This is because importing the values
previously rendered them as undefined (probably due to a circular
dependency somewhere in the system). This means that the previous values
were also ignored by OpenAPI.

UI updates reflecting this wil follow.

## Background
When you tag a flag, there's nothing stopping you from using an entirely
empty tag or a tag with leading/trailing whitespace.

Empty tags make little sense and leading trailing whitespace differences
are incredibly subtle:

![image](https://github.com/Unleash/unleash/assets/17786332/ec8fe193-8837-4c6a-b7bf-8766eff34eed)


Additionally, leading and trailing whitespace is not shown in the
dropdown list, so you'd have to guess at which is the right one.

![image](https://github.com/Unleash/unleash/assets/17786332/a14698ab-2bfd-4ec3-8814-b8e876d0aadb)
2024-06-05 08:31:30 +02:00
..
project chore: rename toggle to flag #6 (#7122) 2024-05-23 11:32:11 +03:00
user feat: use audit info in events (#6872) 2024-04-18 16:32:35 +02:00
addon.ts feat: use audit info in events (#6872) 2024-04-18 16:32:35 +02:00
api-token.test.ts feat: added killswitch for admin tokens (#5905) 2024-01-17 10:27:36 +01:00
api-token.ts feat: use audit info in events (#6872) 2024-04-18 16:32:35 +02:00
config.test.ts chore: upgrade edge banner version (#7180) 2024-05-28 12:16:42 +03:00
config.ts chore: upgrade edge banner version (#7180) 2024-05-28 12:16:42 +03:00
constraints.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
context.test.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
context.ts feat: use audit info in events (#6872) 2024-04-18 16:32:35 +02:00
email.test.ts
email.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
environments.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
event.ts chore: rename toggle to flag #6 (#7122) 2024-05-23 11:32:11 +03:00
events.test.ts feat: use audit info in events (#6872) 2024-04-18 16:32:35 +02:00
favorites.ts feat: use audit info in events (#6872) 2024-04-18 16:32:35 +02:00
feature-type.ts chore: rename toggle to flag #6 (#7122) 2024-05-23 11:32:11 +03:00
index.ts chore: remove state service (#7184) 2024-05-28 14:47:31 +02:00
instance-admin.ts feat: lifecycle prometheus metrics per project (#7032) 2024-05-10 15:24:27 +03:00
metrics.test.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
metrics.ts feat: private projects in application overview (#6775) 2024-04-04 14:56:21 +02:00
public-signup.test.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
public-signup.ts feat: use audit info in events (#6872) 2024-04-18 16:32:35 +02:00
strategy.test.ts chore!: [v6] remove error.description in error messages (#7157) 2024-05-27 11:26:19 +02:00
strategy.ts chore: deprecate custom strategies (#7186) 2024-05-28 12:33:53 +02:00
tag.test.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
tag.ts fix: disallow invalid tag values (#7268) 2024-06-05 08:31:30 +02:00
telemetry.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
user-admin.ts feat: use audit info in events (#6872) 2024-04-18 16:32:35 +02:00
user-feedback.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
user-splash.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00