spring-projects / spring-projects/spring-boot

Consider symlinks when normalizing output locations while processing buildpack layers

Open
#50,702 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.