1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

fix: added stronger tag validations (#5585)

Now it is impossible to filter based on invalid tag syntax.
This commit is contained in:
Jaanus Sellin 2023-12-11 13:34:51 +02:00 committed by GitHub
parent ec670450fd
commit e8f19e6341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 4 deletions

View File

@ -303,6 +303,10 @@ test('should filter features by tag', async () => {
{ name: 'my_feature_c' },
],
});
await filterFeaturesByTag('EXCLUDE_ALL:simple', 400);
await filterFeaturesByTag('EXCLUDE_ALL:simple,simple', 400);
await filterFeaturesByTag('EXCLUDE_ALL:simple,simple:jest', 400);
});
test('should filter features by environment status', async () => {
@ -786,9 +790,18 @@ test('should filter features by segment', async () => {
});
test('should search features by state with operators', async () => {
await app.createFeature({ name: 'my_feature_a', stale: false });
await app.createFeature({ name: 'my_feature_b', stale: true });
await app.createFeature({ name: 'my_feature_c', stale: true });
await app.createFeature({
name: 'my_feature_a',
stale: false,
});
await app.createFeature({
name: 'my_feature_b',
stale: true,
});
await app.createFeature({
name: 'my_feature_c',
stale: true,
});
const { body } = await filterFeaturesByState('IS:active');
expect(body).toMatchObject({

View File

@ -51,7 +51,7 @@ export const featureSearchQueryParameters = [
schema: {
type: 'string',
pattern:
'^(INCLUDE|DO_NOT_INCLUDE|INCLUDE_ALL_OF|INCLUDE_ANY_OF|EXCLUDE_IF_ANY_OF|EXCLUDE_ALL):(.*?)(,([a-zA-Z0-9_]+))*$',
'^(INCLUDE|DO_NOT_INCLUDE|INCLUDE_ALL_OF|INCLUDE_ANY_OF|EXCLUDE_IF_ANY_OF|EXCLUDE_ALL):(?:\\s*[^,:]+:[^,:]+\\s*)(?:,\\s*[^,:]+:[^,:]+\\s*)*$',
example: 'INCLUDE:simple:my_tag',
},
description: