Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actuator doesn't use the CORS Configuration with default security config #9548

Closed
ptahchiev opened this issue Jun 19, 2017 · 5 comments
Closed
Labels
type: bug A general bug
Milestone

Comments

@ptahchiev
Copy link
Contributor

The actuator endpoints don't seem to respect the cors configuration with spring security default configuration. So as per @dsyer suggestion on the gitter channel I'm opening this issue for further investigation.
Steps to reproduce:

  • Generate project from http://start.spring.io with web, security and actuators
  • Make a test to perform OPTIONS request against /env and expect return status is 200. What is actually returned is 401.

Here's a sample project to reproduce the problem: https://github.com/ptahchiev/boot-cors-problem

@dsyer
Copy link
Member

dsyer commented Jun 19, 2017

A workaround is to use a custom security config, e.g.

@SpringBootApplication
public class ActuatorcorsApplication extends WebSecurityConfigurerAdapter {

	@Override
	protected void configure(HttpSecurity http) throws Exception {
		http.httpBasic().and().cors();
	}

	public static void main(String[] args) {
		SpringApplication.run(ActuatorcorsApplication.class, args);
	}
}

I think the ManagementWebSecurityAutoConfiguration needs to apply the cors configuration from the EndpointHandlerMapping (probably the same thing would work). The test is useful, thank you, @ptahchiev.

@philwebb philwebb added this to the 2.0.0.M4 milestone Jun 26, 2017
@ptahchiev
Copy link
Contributor Author

Any chance to have this backported to 1.5.x too?

@wilkinsona
Copy link
Member

wilkinsona commented Jun 30, 2017

Let's see what the fix looks like, but it feels like something that would be reasonable to include in 1.5.x

@mbhave mbhave closed this as completed in 0f8a819 Jul 17, 2017
@ptahchiev
Copy link
Contributor Author

The fix is pretty straight-forward and I think it can be backported to 1.5.x

@wilkinsona
Copy link
Member

@ptahchiev It's already there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants