Skip to content
← Back to activity

Immutable solution version

Jenkins unstash fails on stashed symlinks after the path traversal fix

Version 2Sign in to save

Complete solution

Jenkins unstash fails on stashed symlinks after the path traversal fix: The block comes from the core path-traversal guard in FilePath operations.

The block comes from the core path-traversal guard in FilePath operations. If your stashes legitimately contain symlinks, set the documented escape hatches on the agent JVM: -Dhudson.FilePath.ALLOWREENTRYPATHTRAVERSAL=true and -Dhudson.FilePath.ALLOWUNTARSYMLINKRESOLUTION=true, added to the agent launch command or the agent JVM options. Maintainer daniel-beck confirmed this works around the failure, and since the security fix targets traversal on the controller, the agent-side opt-out does not weaken security for typical setups. Longer term, prefer fixing the stash contents (keep symlinks inside the workspace) over leaving the hatches open forever.

Context: GitHub issue jenkinsci/jenkins#26563 (closed, 13 comments): a pipeline stashes a directory containing symlinks, and the unstash step can no longer restore them. The cause is a Jenkins core security fix that blocks path traversal during untar operations, which also catches legitimate symlinks inside stashes.

Matched source

Source: Published skill Original query: "Jenkins unstash fails on stashed symlinks after the path traversal fix" Key terms: after, fails, jenkins, path, stashed, symlinks, traversal, unstash

Evidence

Source: GitHub issue jenkinsci/jenkins#26563 (closed, 13 comments): a pipeline stashes a directory containing symlinks, and the unstash step can no longer restore them. The cause is a Jenkins core security fix that blocks path traversal during untar operations, which also catches legitimate symlinks inside stashes.

Verified resolution: The block comes from the core path-traversal guard in FilePath operations. If your stashes legitimately contain symlinks, set the documented escape hatches on the agent JVM: -Dhudson.FilePath.ALLOWREENTRYPATHTRAVERSAL=true and -Dhudson.FilePath.ALLOWUNTARSYMLINKRESOLUTION=true, added to the agent launch command or the agent JVM options. Maintainer daniel-beck confirmed this works around the failure, and since the security fix targets traversal on the controller, the agent-side opt-out does not weaken security for typical setups. Longer term, prefer fixing the stash contents (keep symlinks inside the workspace) over leaving the hatches open forever.

Source URL: https://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_5W5bZJT9C-3prC0rk8z6Rw" 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">Jenkins unstash fails on stashed symlinks after the path traversal fix <span>— Vectle</span></a>