Skip to content

Windows volume streaming still broken for intra-repo symlinks due to os.Root.Symlink path separator bug (Go #80073) #9609

Closed

Description

@aliculPix4D

Summary

v8.2.4 includes #9601, which addressed #9597 by switching Windows tar extraction to os.Root. That unblocks the false-positive BreakoutError for safe intra-repo symlinks, but symlinks are still broken on Windows because os.Root.Symlink does not normalize path separators on Windows.

Tar headers from Linux/git use Unix-style forward slashes (e.g. ../shared/images-vars.tf). os.Symlink normalizes these to backslashes on Windows; os.Root.Symlink writes them verbatim into the NTFS reparse point. Windows requires backslashes for relative symlink targets, so the symlinks are created but unreadable.

This affects any input streamed to a Windows worker (git resources, task inputs, COW volumes via robocopy).

Regression timeline

Version Behaviour
≤ 8.1.0 Intra-repo symlinks work on Windows
≥ 8.1.1 (#9486) Safe intra-repo symlinks rejected with BreakoutError (#9597)
8.2.4 (#9601) Stream-in no longer rejected, but symlinks unreadable on Windows (Go #80073)

Root cause

In go-archive/tarfs/extract.go, PR #9601 calls:

err = root.Symlink(header.Linkname, filePath)

When header.Linkname contains forward slashes (typical for git repos created on Linux), root.Symlink stores them unchanged. On Windows, resolution fails with:

The filename, directory name, or volume label syntax is incorrect.

Standalone reproducers and build logs: https://github.com/Pix4D/concourse-tar-streaming-issue

Upstream Go issue: golang/go#80073

Steps to Reproduce

  1. Deploy Concourse v8.2.4 with Linux and Windows workers.
  2. Set the demo pipeline from https://github.com/Pix4D/concourse-tar-streaming-issue (ci/pipeline.yml).
  3. Run the Windows jobs (each uses an orphan demo branch with a single symlink fixture).

Or, on any Windows worker, run the standalone reproducer:

GOOS=windows GOARCH=amd64 go build -o symlink-robocopy-demo.exe symlink-robocopy.go

Script will fail on Windows Server 2019, and pass on Windows Server 2025 due to the difference in robocopy version on each.

Expected Results

  • Intra-repo relative symlinks (file and directory) stream to Windows workers and resolve correctly, as they did in ≤ 8.1.0.
  • Build/task logs surface actionable errors when stream-in fails (today only generic failed to stream in to volume / failed to create volume).

Observed behaviour (v8.2.4)

Scenario WS 2019 WS 2025
File symlink (workers/images-vars.tf → ../shared/images-vars.tf) Stream-in OK; task fails reading symlink Stream-in OK; task fails reading symlink
Directory symlink (config/access/data-vault → ../../assets/.../data-vault) Stream-in fails (failed to create volume, robocopy exit 9) Stream-in OK; task fails listing symlink

File symlink

Stream-in succeeds, symlink exists but is unreadable:

Target   : {../shared/images-vars.tf}
Get-Content : The filename, directory name, or volume label syntax is incorrect.

Build log: build-logs/safe-intra-repo-symlink-windows-15458.log

Directory symlink on WS 2019

COW volume creation fails during robocopy (broken dir symlinks):

find or create container on worker ...: failed to create volume

Worker log: exit status 9 (robocopy: 1 = some files copied + 8 = some failed)

Build log: build-logs/safe-intra-repo-dir-symlink-windows-2019-15453.log

Directory symlink on WS 2025

Stream-in succeeds, symlink unreadable:

Mode     : d----l
Target   : {../../assets/bundle/user/embedded/data-vault}
Get-ChildItem : The filename, directory name, or volume label syntax is incorrect.

Build log: build-logs/safe-intra-repo-dir-symlink-windows-2025-15454.log

Logs: standalone reproducer on WS 2019: robocopy failure

From build-logs/minimal-comparison-win2019.log:

Logs: standalone reproducer on WS 2025: robocopy success

From build-logs/minimal-comparison-win2025.log:

Why WS 2019 vs 2025 differ

Both OS versions produce identical broken symlinks (forward slashes in the reparse point). The difference is downstream:

  • WS 2025 (robocopy 10.x): tolerates broken file symlinks during /sl copy; stream-in completes but symlinks stay unreadable.
  • WS 2019 (older robocopy): fails on broken directory symlinks during COW volume materialization → exit status 9.

The standalone symlink-robocopy-demo.exe in the demo repo reproduces this with the same robocopy flags as baggageclaim (/e /mt /r:5 /w:5 /sl).

Suggested fix (Concourse-side)

Until Go fixes #80073, normalize symlink targets before calling root.Symlink:

- err = root.Symlink(header.Linkname, filePath)
+ err = root.Symlink(filepath.FromSlash(header.Linkname), filePath)

filepath.FromSlash converts ../shared/foo → ..\shared\foo, which root.Symlink accepts (confirmed in the demo repo: root.Symlink with backslash targets resolves correctly; only forward-slash targets fail).

os.Root path-escape checks in #9601 should be kept; only separator normalization is missing.

Web Node(s) configuration

No response

Worker(s) configuration

No response

Concourse Version

8.2.4

Browser (if applicable)

No response

Did this use to work?

Yes — ≤ 8.1.0

Activity

  1. changed the title [-]v8.2.4 (#9601): Windows volume streaming still broken for intra-repo symlinks due to `os.Root.Symlink` path separator bug (Go #80073)[/-] [+]Windows volume streaming still broken for intra-repo symlinks due to `os.Root.Symlink` path separator bug (Go #80073)[/+] on Jun 19, 2026
  2. taylorsilva commented on Jun 19, 2026

    @taylorsilva
    Member

    Thanks for the write up! I your suggested change sounds good until golang fixes this. Based on some of the related issues, not sure that'll happen soon. Great write up in the golang issue btw, very clear and concise.

    I'm not making another patch for this though because I have patch fatigue with 8.2.x now 😓

    There is a workaround though: Windows workers can run on <= 8.1.0 of Concourse, before all these changes were introduced. There were no changes in how the web and worker communicate between the latest version and 8.1.0, so I don't think there'd be any issues with running a web and Windows worker on different versions.

    I appreciate all the work you and your coworkers did looking into this. Terribly annoying and sorry it's probably been quite the blocker on your pipelines.

  3. taylorsilva commented on Jun 24, 2026

    @taylorsilva
    Member

    This issue has been annoying and so I wondered if there's a library we could pull in that would solve this for us. Found https://github.com/hashicorp/go-extract which looks like a more robust solution than our package.

    ugh nevermind, looks like they also haven't figured out a solution for absolute symlinks: hashicorp/go-extract#77

    The more I think about this, the more I'm inclined to just revert the whole thing back to it's original state, no inspecting of symlinks at all, and not use os.Root.

  4. aliculPix4D commented on Jun 24, 2026

    @aliculPix4D
    ContributorAuthor

    This issue has been annoying and so I wondered if there's a library we could pull in that would solve this for us. Found https://github.com/hashicorp/go-extract which looks like a more robust solution than our package.

    ugh nevermind, looks like they also haven't figured out a solution for absolute symlinks: hashicorp/go-extract#77

    The more I think about this, the more I'm inclined to just revert the whole thing back to it's original state, no inspecting of symlinks at all, and not use os.Root.

    Sorry for being late on this, but just a short update: we have just, finally, deployed our own release (v8.2.4+pix4d.1) in production after weeks of testing. Our release branch basically contains just this extra commit: Pix4D#823 that addresses this issue.

    In the meantime, Go fixed the issue upstream: golang/go#80073 and it will be included in v1.27.0 so I was wondering what to do here: wait or continue with: #9610

    Additionally, we were discussing internally in my team if a better long-term solution would be to use the same Go library on all the 3 OSes instead of sometimes using the platform tar.

    Funny thing, we had issues with tar, symlinks, garden and seccomp profiles in recent days after latest concourse unit docker image arrived with new version of tar :) Thankfully, containerd runtime doesn't suffer from this.

    Probably we will join tomorrow's Concourse Office hours meeting to discuss this further and share our feedback.

  5. taylorsilva commented on Jun 26, 2026

    @taylorsilva
    Member

    Sorry, I ended up not running the office hours due to a personal conflict! I'd love to chat about this though so I'll run it next week and we can discuss.

    I'm interested to hear how the recent tar broke things for you as well since I haven't gotten any failures in our CI so far.

  6. taylorsilva commented on Jul 3, 2026

    @taylorsilva
    Member

    Going to merge the existing PR and close this issue. I did find this other library which seems like it would protect from symlink traversal attacks: https://github.com/google/safearchive

    The "safe" Go libraries seem to be things Google supports: https://bughunters.google.com/blog/the-family-of-safe-golang-libraries-is-growing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions