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

DevTools exposes every file in classpath #7880

Closed
yreifschneider opened this issue Jan 5, 2017 · 3 comments
Closed

DevTools exposes every file in classpath #7880

yreifschneider opened this issue Jan 5, 2017 · 3 comments
Labels
type: blocker An issue that is blocking us from releasing type: bug A general bug type: regression A regression from a previous release
Milestone

Comments

@yreifschneider
Copy link

yreifschneider commented Jan 5, 2017

When I create a Spring Boot web application with DevTools in pom.xml every file on the classpath is exposed as static file to download. The documentation states:

Developer tools are automatically disabled when running a fully packaged application. If your application is launched using java -jar or if it’s started using a special classloader, then it is considered a “production application”.

But even when I run the application with java -jar every file is accessible to download. I have attached a simple demo project to illustrate this.

If you run the demo project for example with mvn spring-boot:run or by compiling it to a jar file and then java -jar, you can access the application.properties file in the browser under http://localhost:8080/application.properties.

Using SpringBoot Version 1.4.3

$ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

devtools-exposes-files.zip

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 5, 2017
@philwebb philwebb added type: blocker An issue that is blocking us from releasing type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 5, 2017
@philwebb philwebb added this to the 1.4.4 milestone Jan 5, 2017
@philwebb philwebb added the type: regression A regression from a previous release label Jan 5, 2017
@philwebb
Copy link
Member

philwebb commented Jan 5, 2017

It looks like this is a regression in 1.4.3 as downgrading to 1.4.2 fixes the problem.

@philwebb
Copy link
Member

philwebb commented Jan 6, 2017

The root cause is the new ClassLoaderFilesResourcePatternResolver which was resolving / patterns as classpath resources rather than servlet resources. This was fixed in #7752 but I'll add some tests to make sure it doesn't happen again.

@xak2000
Copy link
Contributor

xak2000 commented Jan 28, 2017

Oh! Actually, this is a big security issue. I surprised that this is not mentioned explicitly in release notes at https://spring.io/blog/2017/01/26/spring-boot-1-4-4-available-now.

Some people even have production passwords in their properties. :) It is bad practice of course and security issue in itself. But anyway, even when classpath contains no passwords, it's still contains many files not intended to be read by anyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: blocker An issue that is blocking us from releasing type: bug A general bug type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

4 participants