Skip to content

Validate download symlink targets stay within the output directory#657

Closed
adilburaksen wants to merge 1 commit into
bazelbuild:masterfrom
adilburaksen:client/validate-symlink-target
Closed

Validate download symlink targets stay within the output directory#657
adilburaksen wants to merge 1 commit into
bazelbuild:masterfrom
adilburaksen:client/validate-symlink-target

Conversation

@adilburaksen

Copy link
Copy Markdown

DownloadOutputs (go/pkg/client/cas_download.go) creates symlinks from output trees using the SymlinkTarget value returned by the server, used verbatim. A server could therefore return a symlink whose target is an absolute path or uses .. to point outside the output directory, creating links to arbitrary locations on the client filesystem.

This rejects symlink targets that resolve outside outDir before the link is created, mirroring the containment already applied to output paths. Targets that stay within the output directory are unaffected.

DownloadOutputs creates symlinks from output trees using the
SymlinkTarget value returned by the server. The target was used verbatim,
so a server could return a symlink whose target is an absolute path or
uses '..' to point outside the output directory, creating links to
arbitrary locations on the client filesystem.

Reject symlink targets that resolve outside outDir before creating the
link. This mirrors the containment already applied to output paths.
@adilburaksen

Copy link
Copy Markdown
Author

Closing in favor of #650, which addresses the same unvalidated download symlink target and additionally covers the os.RemoveAll output-directory traversal in DownloadActionOutputs. Deferring to that earlier, more complete fix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant