Skip to content

Preserve symlink targets in the local system - #8376

Draft
DavidS wants to merge 3 commits into
jekyll:masterfrom
DavidS:symlinks
Draft

DavidS wants to merge 3 commits into
jekyll:masterfrom
DavidS:symlinks

Conversation

@DavidS

@DavidS DavidS commented Sep 7, 2020

Copy link
Copy Markdown

This is a 🐛 bug fix.

Summary

Instead of copying symlinks verbatim to _site, this rewrites them to the absolute path so that they keep pointing at the right file.

Context

This is a rebase of #8299 with all comments from that PR addressed and tests added.

Fixes #6870, closes #8299

@DirtyF DirtyF added the fix label Sep 7, 2020
@ashmaroli
ashmaroli requested review from mattr- and parkr September 9, 2020 15:11
Comment thread lib/jekyll/static_file.rb Resolved
UnkindPartition and others added 3 commits November 8, 2020 15:04
This is a refresh of the changes by @feuerbach in jekyll#8299, using `FileUtils.ln_sf` to force overwriting instead of calling the `unlink` ourselves.

Fixes jekyll#6870, closes jekyll#8299
Co-authored-by: Michael Currin <18750745+MichaelCurrin@users.noreply.github.com>
@DavidS

DavidS commented Nov 8, 2020

Copy link
Copy Markdown
Author

Rebased to current HEAD. Anything else I can do to help here?

@ashmaroli

Copy link
Copy Markdown
Member

Anything else I can do to help here?

:) Thank you for resolving merge conflicts. What this needs is some documentation (and a nice title for this PR.. 😉)

Also, waiting for a review from @parkr or @mattr- since symlinks are security concerns..

@DavidS DavidS changed the title Symlinks Preserve symlink targets in the local system Nov 8, 2020
@DirtyF DirtyF added the security label Nov 8, 2020
@mattr-

mattr- commented Nov 9, 2020

Copy link
Copy Markdown
Member

At a minimum, this needs a check to ensure that the resolved symlink is inside the site's source directory. Dereferencing symlinks that point to outside the site source is a large security risk that this PR doesn't address yet.

@DirtyF
DirtyF marked this pull request as draft November 11, 2020 12:33
@DavidS

DavidS commented Dec 3, 2020

Copy link
Copy Markdown
Author

Oh yeah - I think I can see how that would be awful. Not quite sure how to address though.

My use-case is where I deploy approximately 50GB of files outside of git and want to reference those instead of copying around.

@fauno

fauno commented Dec 3, 2020

Copy link
Copy Markdown
Member

My use-case is where I deploy approximately 50GB of files outside of git and want to reference those instead of copying around.

Maybe you can use hardlinks instead? :)

@DavidS

DavidS commented Dec 6, 2020

Copy link
Copy Markdown
Author

Maybe you can use hardlinks instead? :)

This is dependent on another tool (git-annex), which reduces my flexibility a lot.

@fauno

fauno commented Dec 7, 2020 via email

Copy link
Copy Markdown
Member

@DavidS

DavidS commented Mar 7, 2021

Copy link
Copy Markdown
Author

Given the issues raised with this draft, I've decided to just eat the additional storage requirements instead of trying to improve on this code here.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Symbolic links are broken when being copied to _site

7 participants