This PR relates to #34062. I created a loop at the beginning of the method that goes through the list of profiles and checks if there are any of these invalid characters: * & ! | ,. If so, an exception is thrown informing which profile is invalid and which characters are prohibited. I also created the necessary tests to verify the method changes.

Comment From: mhalbritter

Hey, thanks for that. What about the profile names ( and )? I think they should be prohibited, too.

, is interesting:

Of course it doesn't work in the

spring.profiles.active=a,b,

form. But it works in the

spring.profiles.active[0]=a
spring.profiles.active[1]=b
spring.profiles.active[2]=,

form. I still think it's a good idea to deny ,.

Comment From: wilkinsona

It has been several months now without the requested feedback so I'm going to close this one. https://github.com/spring-projects/spring-boot/issues/34062 continues to track the enhancement that we'd like to make here.