spring-projects / spring-projects/spring-boot
Consider symlinks when normalizing output locations while processing buildpack layers
Open
Nobody has claimed this yet.
status: team-only
type: task
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
In addition to the changes made for #50141, we can harden things further by also considering symlinks. Change proposed by @ghosttT0:
if (entry.isSymbolicLink() || entry.isLink()) {
String linkName = entry.getLinkName();
Path resolvedLink = basePath.resolve(linkName).toAbsolutePath().normalize();
Assert.state(!linkName.startsWith("/") && resolvedLink.startsWith(basePath.toAbsolutePath()),
() -> "Link target '%s' in entry '%s' cannot point outside of '%s'"
.formatted(linkName, entryName, basePath));
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name files or tests; start by tracing the buildpack-layer code that normalizes output locations while processing layers. Check how symbolic and hard links are represented there, then verify that link targets remain within the layer output base and add or run focused coverage for links pointing outside it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100