Skip to content
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

Improve handling cache folder and cache file paths #96

Merged
merged 1 commit into from
Sep 10, 2018

Conversation

ashmaroli
Copy link
Contributor

This is to ensure that the cache folder always resides under the site's source path.
A simple File.join leaves security holes for configs like following:

webmentions:
  cache_folder: "../../.foo-cache"

An additional gain is a utility method Jekyll::WebmentionIO.cache_file to simplify creating cache_file paths.

However, Jekyll::WebmentionIO.bootstrap has now changed its signature to accept a required-parameter site (which is simply the current Jekyll::Site instance)

@aarongustafson
Copy link
Owner

Thanks for this! What do you see as the risk of a signature change like this? I’m not seeing one from my end. Could it cause any issues for generators or commands?

@ashmaroli
Copy link
Contributor Author

What do you see as the risk of a signature change like this?

None from my side as well, since to me, this plugin is the only thing that's gonna be calling that method.. But still, I thought I'd emphasize the change in case you were aware of any add-ons for this gem that may use that method.....

@aarongustafson
Copy link
Owner

@ashmaroli I am not. But maybe I’ll make this a major version bump just to be safe.

@aarongustafson aarongustafson merged commit 0d41ed0 into aarongustafson:master Sep 10, 2018
@ashmaroli ashmaroli deleted the better-cache-paths branch September 11, 2018 03:28
@ashmaroli
Copy link
Contributor Author

An unforeseen side-effect of this is that the :after_init hook was introduced only in Jekyll 3.2.., ergo, older versions will now unfortunately break..

The gemspec will have to reflect this, IMO..

s.add_runtime_dependency "jekyll", ">= 2.0", "< 4.0"

Let's not rush into a patch release immediately, though.. I may open a couple of "cleanup PRs" based on RuboCop reports.. 😉 ...

@aarongustafson
Copy link
Owner

Is there a good way to provide a fallback? We have a few of those in the source.

@ashmaroli
Copy link
Contributor Author

Is there a good way to provide a fallback? We have a few of those in the source.

You mean continue support for < Jekyll 3.2.0 ..?
The sane way would be to add a :respond_to? check..

This repo really needs a working Continuous Integration Coverage to prevent such mistakes in the future..

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.

2 participants