Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
4ad149e1
Commit
4ad149e1
authored
Feb 19, 2021
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect against bad paths and URLs
See gh-21722
parent
88e9f1d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
BuildpackReference.java
...ork/boot/buildpack/platform/build/BuildpackReference.java
+7
-1
DirectoryBuildpack.java
...ork/boot/buildpack/platform/build/DirectoryBuildpack.java
+1
-1
TarGzipBuildpack.java
...ework/boot/buildpack/platform/build/TarGzipBuildpack.java
+1
-1
No files found.
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildpackReference.java
View file @
4ad149e1
...
...
@@ -53,11 +53,17 @@ public final class BuildpackReference {
if
(
url
.
getProtocol
().
equals
(
"file"
))
{
return
Paths
.
get
(
url
.
getPath
());
}
return
null
;
}
catch
(
MalformedURLException
ex
)
{
// not a URL, fall through to attempting to find a plain file path
}
return
Paths
.
get
(
this
.
value
);
try
{
return
Paths
.
get
(
this
.
value
);
}
catch
(
Exception
ex
)
{
return
null
;
}
}
@Override
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/DirectoryBuildpack.java
View file @
4ad149e1
...
...
@@ -93,7 +93,7 @@ final class DirectoryBuildpack implements Buildpack {
*/
static
Buildpack
resolve
(
BuildpackResolverContext
context
,
BuildpackReference
reference
)
{
Path
path
=
reference
.
asPath
();
if
(
Files
.
exists
(
path
)
&&
Files
.
isDirectory
(
path
))
{
if
(
path
!=
null
&&
Files
.
exists
(
path
)
&&
Files
.
isDirectory
(
path
))
{
return
new
DirectoryBuildpack
(
path
);
}
return
null
;
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/TarGzipBuildpack.java
View file @
4ad149e1
...
...
@@ -109,7 +109,7 @@ final class TarGzipBuildpack implements Buildpack {
*/
static
Buildpack
resolve
(
BuildpackResolverContext
context
,
BuildpackReference
reference
)
{
Path
path
=
reference
.
asPath
();
if
(
Files
.
exists
(
path
)
&&
Files
.
isRegularFile
(
path
))
{
if
(
path
!=
null
&&
Files
.
exists
(
path
)
&&
Files
.
isRegularFile
(
path
))
{
return
new
TarGzipBuildpack
(
path
);
}
return
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment