Skip to content

SourceControl: add basic support for symlinks #7092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

compnerd
Copy link
Member

The contents of a symlink is the path to which it points. We can simply read the contents as a new path, and use getEntry to get the contents of the symbolic link. This implementation should also fully traverse any path that is a series of symbolic link. This does allow for a DoS attack by creating a recursive symbolic link cycle (e.g. a -> b -> a).

Fixes: #7081

The contents of a symlink is the path to which it points.  We can simply
read the contents as a new path, and use `getEntry` to get the contents
of the symbolic link.  This implementation should also fully traverse
any path that is a series of symbolic link.  This does allow for a DoS
attack by creating a recursive symbolic link cycle (e.g.
`a` -> `b` -> `a`).

Fixes: swiftlang#7081
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MaxDesiatov
Copy link
Contributor

@swift-ci test windows

@compnerd compnerd merged commit 786c513 into swiftlang:main Nov 14, 2023
@compnerd compnerd deleted the symlink branch November 14, 2023 20:39
case .blob:
return try self.repository.readBlob(hash: hash)
default:
fatalError()
Copy link
Contributor

@tomerd tomerd Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should avoid using fatalError which would crash the program. see #7096

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal error. Please file a bug at https://github.com/apple/swift-package-manager/issues with this info. symlinks not supported
3 participants