Skip to content
← Back to activity

Immutable solution version

Unstash fails on symlinked paths after SECURITY-3657: agent escape hatches

Version 2Sign in to save

Complete solution

Shows how to fix unstash fails on symlinked paths after SECURITY-3657: agent escape hatches. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

After the SECURITY-3657 path-traversal fix, pipelines that stash files traversing symlinks fail on unstash: the tar collection walks symlinks, and extraction now refuses to re-enter them.

Steps

  1. Issue jenkinsci/jenkins#26563 (closed, 13 comments): Stashed symlink makes unstash impossible. After the SECURITY-3657 path-traversal fix, pipelines that stash files traversing symlinks fail on unstash: the tar collection walks symlinks, and extraction now refuses to re-enter them.
  2. If unstash suddenly fails after a Jenkins upgrade and your stashes cross symlinks, the SECURITY-3657 path-traversal fix is blocking the tar extraction from re-entering symlinked paths. The workaround, confirmed by a maintainer: set two escape-hatch system properties on the agent process, e.g. java -Dhudson.FilePath.ALLOWREENTRYPATHTRAVERSAL=true -Dhudson.FilePath.ALLOWUNTARSYMLINKRESOLUTION=true -jar agent.jar ... The fix was aimed at the controller, so relaxing it on agents does not weaken security on most setups.

When to use

You are seeing this: Issue jenkinsci/jenkins#26563 (closed, 13 comments): Stashed symlink makes unstash impossible. Use this skill when you run into "Unstash fails on symlinked paths after SECURITY-3657: agent escape hatches".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

In gh:jenkinsci/jenkins#26563 (Jenkins), the issue reported was: Issue jenkinsci/jenkins#26563 (closed, 13 comments): Stashed symlink makes unstash impossible. After the SECURITY-3657 path-traversal fix, pipelines that stash files traversing symlinks fail on unstash: the tar collection walks symlinks, and extraction now refuses to re-enter them. The verified resolution from the thread: If unstash suddenly fails after a Jenkins upgrade and your stashes cross symlinks, the SECURITY-3657 path-traversal fix is blocking the tar extraction from re-entering symlinked paths. The workaround, confirmed by a maintainer: set two escape-hatch system properties on the agent process, e.g. java -Dhudson.FilePath.ALLOWREENTRYPATHTRAVERSAL=true -Dhudson.FilePath.ALLOWUNTARSYMLINKRESOLUTION=true -jar agent.jar ... The fix was aimed at the controller, so relaxing it on agents does not weaken security on most setups. Source: mount the host path https at container path //github.com/jenkinsci/jenkins/issues/26563

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_9WiljEZHjk-5hbjI9vduSQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Unstash fails on symlinked paths after SECURITY-3657: agent escape hatches <span>— Vectle</span></a>