464556 - Restrict start module downloads to ${jetty.base} paths only

+ Restrict [files] section references (download/uri/maven) to
  output only in ${jetty.base} tree
This commit is contained in:
Joakim Erdfelt 2015-04-13 16:46:46 -07:00
parent cea577bd17
commit 0e2b1856b5
3 changed files with 11 additions and 1 deletions

View File

@ -251,6 +251,11 @@ public class BaseBuilder
{
if (startArgs.isDownload() && (arg.uri != null))
{
if (!file.startsWith(baseHome.getBasePath()))
{
throw new IOException("For security reasons, Jetty start is unable to process file resource not in ${jetty.base} - " + file);
}
URI uri = URI.create(arg.uri);
// Process via initializers

View File

@ -200,7 +200,7 @@ public class BaseHome
*/
public Path getBasePath(String path)
{
return baseDir.resolve(path);
return baseDir.resolve(path).normalize().toAbsolutePath();
}
public ConfigSources getConfigSources()

View File

@ -108,6 +108,11 @@ public class MavenLocalRepoFileInitializer extends UriFileInitializer implements
return true;
}
if (!file.startsWith(baseHome.getBasePath()))
{
throw new IOException("For security reasons, Jetty start is unable to process maven file resource not in ${jetty.base} - " + file);
}
// If using local repository
if (this.localRepositoryDir != null)
{