1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-28 19:06:12 +01:00
unleash.unleash/src
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
..
lib fix: disallow invalid tag values (#7268) 2024-06-05 08:31:30 +02:00
mailtemplates
migrations chore: rename roles toggles to flag (#7123) 2024-05-23 12:01:04 +03:00
test chore: sync user groups is a system action (#7214) 2024-05-30 11:47:30 +02:00
migrator.ts
server-dev.ts feat: new sidebar by default for OSS (#7239) 2024-06-03 11:05:10 +02:00
server.ts