mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: added stronger tag validations (#5585)
Now it is impossible to filter based on invalid tag syntax.
This commit is contained in:
		
							parent
							
								
									ec670450fd
								
							
						
					
					
						commit
						e8f19e6341
					
				@ -303,6 +303,10 @@ test('should filter features by tag', async () => {
 | 
				
			|||||||
            { name: 'my_feature_c' },
 | 
					            { 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 () => {
 | 
					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 () => {
 | 
					test('should search features by state with operators', async () => {
 | 
				
			||||||
    await app.createFeature({ name: 'my_feature_a', stale: false });
 | 
					    await app.createFeature({
 | 
				
			||||||
    await app.createFeature({ name: 'my_feature_b', stale: true });
 | 
					        name: 'my_feature_a',
 | 
				
			||||||
    await app.createFeature({ name: 'my_feature_c', stale: true });
 | 
					        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');
 | 
					    const { body } = await filterFeaturesByState('IS:active');
 | 
				
			||||||
    expect(body).toMatchObject({
 | 
					    expect(body).toMatchObject({
 | 
				
			||||||
 | 
				
			|||||||
@ -51,7 +51,7 @@ export const featureSearchQueryParameters = [
 | 
				
			|||||||
        schema: {
 | 
					        schema: {
 | 
				
			||||||
            type: 'string',
 | 
					            type: 'string',
 | 
				
			||||||
            pattern:
 | 
					            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',
 | 
					            example: 'INCLUDE:simple:my_tag',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        description:
 | 
					        description:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user