ff4j-spring-boot-starter-parent icon indicating copy to clipboard operation
ff4j-spring-boot-starter-parent copied to clipboard

Web Console stopped working after transitioning from FF4J 1.9 to 2.0.0

Open emecas opened this issue 1 year ago • 5 comments

Describe the bug

I have started from the documentation available here https://ff4j.org/#10min section: 2. Build the project step-by-step

I was able to setup a project from scratch and made it work (including Web Console), using version 1.9 (since 2.0.0 was not available), with the following configuration was:

implementation 'org.ff4j:ff4j-spring-boot-starter:1.9'
implementation 'org.ff4j:ff4j-web:1.9'

To Reproduce

Keeping the same configuration provided in the available documentation (FF4jConfig and FF4jWebConsoleConfiguration ):

@Configuration
public class FF4jConfig {
    
    @Bean
    public FF4j getFF4j() {
        FF4j ff4j = new FF4j();
        
        /* 
         * Implementation of each store. Here this is boiler plate as if nothing 
         * is specified the inmemory is used. Those are really the one that will
         * change depending on your technology.
         */
        ff4j.setFeatureStore(new InMemoryFeatureStore());
        ff4j.setPropertiesStore(new InMemoryPropertyStore());
        ff4j.setEventRepository(new InMemoryEventRepository());
 
        // Enabling audit and monitoring, default value is false
        ff4j.audit(true);
 
        // When evaluting not existing features, ff4j will create then but disabled 
        ff4j.autoCreate(true);
 
        // To define RBAC access, the application must have a logged user
        //ff4j.setAuthManager(...);
 
        // To define a cacher layer to relax the DB, multiple implementations
        //ff4j.cache([a cache Manager]);
        
        return ff4j;
    }
}
@Configuration
// Enable the REST API documentation
@EnableFF4jSwagger
// The class should be on classpath : FF4jDispatcherServlet
@ConditionalOnClass({FF4jDispatcherServlet.class})
// Setup FF4j first, not is required
@AutoConfigureAfter(FF4jConfig.class)
public class FF4jWebConsoleConfiguration extends SpringBootServletInitializer {
	
    @Bean
    @ConditionalOnMissingBean
    public FF4jDispatcherServlet defineFF4jServlet(FF4j ff4j) {
        FF4jDispatcherServlet ff4jConsoleServlet = new FF4jDispatcherServlet();
        ff4jConsoleServlet.setFf4j(ff4j);
        return ff4jConsoleServlet;
    }
    
    @Bean
    @SuppressWarnings({"rawtypes","unchecked"})
    public ServletRegistrationBean registerFF4jServlet(FF4jDispatcherServlet ff4jDispatcherServlet) {
        return new ServletRegistrationBean((javax.servlet.Servlet)ff4jDispatcherServlet, "/ff4j-web-console/*");
    }
}

I have tried these 3 different sets of dependencies with no success :

Set 1:

implementation 'org.ff4j:ff4j-spring-boot-starter-webmvc:2.0.0'
 

Set 2:

implementation 'org.ff4j:ff4j-spring-boot-starter-webmvc:2.0.0'
implementation 'org.ff4j:ff4j-spring-boot-starter-webflux:2.0.0' 

Set 3:

implementation 'org.ff4j:ff4j-spring-boot-starter-webmvc:2.0.0'
implementation 'org.ff4j:ff4j-spring-boot-starter-webflux:2.0.0' 
implementation 'org.ff4j:ff4j-web:2.0.0'

Noticed features expected functionality seems to still working properly, but Web Consoled is not available anymore, see screenshot.

Expected behavior

Web Consoled working same as when using version 1.9:

image

Otherways, available documentation about possible required configuration changes to make the Web Console works with 2.0.0 (I can help with the documentation once overcome the issue)

Screenshots

image

emecas avatar Aug 10 '23 13:08 emecas

Have you tried https://github.com/ff4j/ff4j-samples/tree/master/ff4j-spring-boot-samples/ff4j-spring-boot-starter-webmvc-sample ?

implementation 'org.ff4j:ff4j-spring-boot-starter-webmvc:2.0.0'

It comes by default with the web console, so you wouldn't need the additional web configuration that you proposed i.e. FF4jWebConsoleConfiguration

paul58914080 avatar Aug 10 '23 14:08 paul58914080

yes, I did, and from there I added to my app CORSConfig and removed FF4jWebConsoleConfiguration configuration, but starting to think that 2.0.0 is only compatible to SpringBoot 3.x , since even the available examples here and here for the console using SpringBoot 2.x are still using FF4J 1.8.5

emecas avatar Aug 10 '23 15:08 emecas

Yes, indeed the starters of 2x i.e. ff4j-spring-boot-starter-webmvc:2.0.0 is ONLY compatible with spring boot 3x.

The examples needs to be updated. I take that point.

paul58914080 avatar Aug 14 '23 10:08 paul58914080

@paul58914080 Is there a plan to release a version 19.1, since it is not yet possible for me to upgrade to version 2.0.0/spring boot 3x.

Here is a list of the main security threats related to version 1.9:

Security-Critical org.springframework : spring-web : 5.3.18
Security-Critical org.springframework.security : spring-security-config : 5.6.2
Security-Critical org.springframework.security : spring-security-web : 5.6.2
Security-Critical org.yaml : snakeyaml : 1.29
Security-High com.fasterxml.jackson.core : jackson-core : 2.13.2
Security-High com.fasterxml.jackson.core : jackson-databind : 2.13.2.2
Security-High com.google.code.gson : gson : 2.6.2
Security-High commons-fileupload : commons-fileupload : 1.4
Security-High org.apache.tomcat.embed : tomcat-embed-core : 9.0.60
Security-High org.springframework : spring-webmvc : 5.3.18
Security-High org.springframework.boot : spring-boot-autoconfigure : 2.6.6
Security-High org.thymeleaf : thymeleaf : 3.0.15.RELEASE

emecas avatar Sep 22 '23 16:09 emecas

@emecas , I did not plan about it much. I will try to publish a bump of new version by next week

paul58914080 avatar Sep 23 '23 12:09 paul58914080