flowable-engine icon indicating copy to clipboard operation
flowable-engine copied to clipboard

Password "kermit" hardcoded all over java code.

Open mgrouch opened this issue 9 years ago • 7 comments

Password "kermit" hardcoded all over java code.

This is wrong on so many levels.

Thanks

mgrouch avatar Feb 10 '17 03:02 mgrouch

Some pointers to code lines would help. Are you talking about unit tests?

tijsrademakers avatar Feb 10 '17 06:02 tijsrademakers

No. It is in actual code. Global search for "kermit" across all java code. It shows hardcoding and in number of places which are not unit tests.

mgrouch avatar Feb 10 '17 07:02 mgrouch

Ok, but if you look at these places it's probably the Rest application that creates the test users. This is code that's there only to ease the startup with Flowable rest and is not used outside of demo purpose etc. So if you can point me to another place that would help. Making such a bold issue message brings some obligations.

tijsrademakers avatar Feb 10 '17 07:02 tijsrademakers

package org.flowable.rest.content.conf.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

  @Bean
  public AuthenticationManager authenticationManager() throws Exception {
    return super.authenticationManager();
  }

  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().csrf().disable().authorizeRequests().anyRequest().authenticated().and().httpBasic();
  }

  @Autowired
  public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication().withUser("kermit").password("kermit").roles("USER");
  }
}

Having something like this in code is very difficult to explain why would we use flowable as a product to security audit,

mgrouch avatar Feb 10 '17 08:02 mgrouch

And BTW index.html exposes Kermit password to a web client via comment. commented code with a password is sent to client. it just raises too many questions

        window.SwaggerTranslator.translate();
      }

// temp disabled; needed for basic auth on curl example // // var basicAuth = new SwaggerClient.PasswordAuthorization('basic', 'kermit', 'kermit'); // swaggerUi.api.clientAuthorizations.add("basicAuth", basicAuth);

    },
    onFailure: function(data) {
      log("Unable to Load SwaggerUI");

mgrouch avatar Feb 10 '17 08:02 mgrouch

the 'temp disabled' comments have been removed in a recent commit.

yvoswillens avatar Feb 10 '17 08:02 yvoswillens

@mgrouch if you would look again then you would see that the SecurityConfiguration class you are pointing to is part of the test classes of the flowable-content-rest module. So I really don't see any security issues with having a hardcoded password for usage in unit tests. Making a bold statement like "why would we use flowable as a product to security audit" is really not appropriate if you don't point to real security issues. Please be more precise when making such bold statements.

tijsrademakers avatar Feb 10 '17 11:02 tijsrademakers