Compare commits

...

13 Commits

Author SHA1 Message Date
Ashwin Maroli
33faf349c1 Debug Jekyll issue - 7328 2018-10-30 15:17:04 +05:30
Frank Taillandier
cc52cac81a Release 💎 3.8.4 2018-09-18 23:50:26 +02:00
Frank Taillandier
91abe9f741 Release 💎 3.8.4 2018-09-18 23:49:03 +02:00
Parker Moore
d9a2758ff6 3.8.x: security: fix include bypass of EntryFilter#filter symlink check (#7228)
Merge pull request 7228
2018-09-18 12:24:15 -04:00
Pat Hawks
48e2de862d Release 💎 3.8.3 2018-06-05 08:23:52 -05:00
Pat Hawks
5687a09255 Release 💎 3.8.3 2018-06-04 21:39:43 -05:00
jekyllbot
03c252ba4d Update history to reflect merge of #7027 [ci skip] 2018-05-20 11:32:29 -05:00
Philip Belesky
6792ff936c Fix --unpublished not affecting collection documents (#7027)
Merge pull request 7027
2018-05-20 11:31:28 -05:00
Pat Hawks
d22b8ee392 Release 💎 3.8.2 2018-05-19 10:30:00 -05:00
jekyllbot
b89efa5d5d Update history to reflect merge of #7016 [ci skip] 2018-05-18 12:38:33 -05:00
Nikita Skalkin
450da91b4b Update rubocop version (#7016)
Merge pull request 7016
2018-05-18 12:34:52 -05:00
jekyllbot
b18872b658 Update history to reflect merge of #7015 [ci skip] 2018-05-18 11:28:46 -05:00
Kyle Barbour
74581422e3 Add whitespace control to LIQUID_TAG_REGEX (#7015)
Merge pull request 7015
2018-05-18 11:27:43 -05:00
21 changed files with 351 additions and 16 deletions

View File

@@ -31,7 +31,7 @@ group :test do
gem "nokogiri", RUBY_VERSION >= "2.2" ? "~> 1.7" : "~> 1.7.0"
gem "rspec"
gem "rspec-mocks"
gem "rubocop", "~> 0.55.0"
gem "rubocop", "~> 0.56.0"
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)

View File

@@ -1,3 +1,25 @@
## 3.8.4 / 2018-09-18
### Bug Fixes
* security: fix `include` bypass of `EntryFilter#filter` symlink check (#7228)
## 3.8.3 / 2018-06-05
### Bug Fixes
* Fix --unpublished not affecting collection documents (#7027)
## 3.8.2 / 2018-05-18
### Development Fixes
* Update rubocop version (#7016)
### Bug Fixes
* Add whitespace control to LIQUID_TAG_REGEX (#7015)
## 3.8.1 / 2018-05-01
### Bug Fixes

View File

@@ -1,5 +1,5 @@
---
version: 3.8.1
version: 3.8.4
name: Jekyll • Simple, blog-aware, static sites
description: Transform your plain text into static websites and blogs
url: https://jekyllrb.com

View File

@@ -4,6 +4,38 @@ permalink: "/docs/history/"
note: This file is autogenerated. Edit /History.markdown instead.
---
## 3.8.4 / 2018-09-18
{: #v3-8-4}
### Bug Fixes
{: #bug-fixes-v3-8-4}
- security: fix `include` bypass of `EntryFilter#filter` symlink check ([#7228]({{ site.repository }}/issues/7228))
## 3.8.3 / 2018-06-05
{: #v3-8-3}
### Bug Fixes
{: #bug-fixes-v3-8-3}
- Fix --unpublished not affecting collection documents ([#7027]({{ site.repository }}/issues/7027))
## 3.8.2 / 2018-05-18
{: #v3-8-2}
### Development Fixes
{: #development-fixes-v3-8-2}
- Update rubocop version ([#7016]({{ site.repository }}/issues/7016))
### Bug Fixes
{: #bug-fixes-v3-8-2}
- Add whitespace control to LIQUID_TAG_REGEX ([#7015]({{ site.repository }}/issues/7015))
## 3.8.1 / 2018-05-01
{: #v3-8-1}

View File

@@ -0,0 +1,19 @@
---
title: 'Jekyll 3.8.2 Released'
date: 2018-05-19 10:30:00 -0500
author: pathawks
version: 3.8.2
categories: [release]
---
Hello Jekyllers!!
Today we are releasing `v3.8.2`, which fixes the way Jekyll generates excerpts
for posts when the first paragraph of the post contains Liquid tags that take
advantage of [Liquid's whitespace control feature][Liquid whitespace].
Big thanks to @kylebarbour, who first reported this issue and also very quickly
submitted a fix. Also thanks to @nickskalkin for making sure that we are using
the latest version of Rubocop to lint our code.
[Liquid whitespace]: https://shopify.github.io/liquid/basics/whitespace/

View File

@@ -0,0 +1,13 @@
---
title: 'Jekyll 3.8.3 Released'
date: 2018-06-05 09:00:00 -0500
author: pathawks
version: 3.8.3
categories: [release]
---
This release fixes a regression in 3.8 where collections with `published: false`
do not show when using the `--unpublished` flag.
Thanks to @philipbelesky for reporting and fixing this issue; collections with
`published: false` now behave the same way as Posts.

View File

@@ -1 +1 @@
3.8.1
3.8.4

View File

@@ -263,6 +263,104 @@ Feature: Collections
And the "_site/puppies/snowy.html" file should not exist
And the "_site/puppies/hardy.html" file should not exist
Scenario: Access rendered collection with future date and unpublished flag via Liquid
Given I have a _puppies directory
And I have the following documents under the puppies collection:
| title | date | content | published |
| Rover | 2007-12-31 | content for Rover. | true |
| Figor | 2007-12-31 | content for Figor. | false |
| Snowy | 2199-12-31 | content for Snowy. | true |
| Hardy | 2199-12-31 | content for Hardy. | false |
And I have a "_config.yml" file with content:
"""
collections:
puppies:
output: true
"""
And I have a "index.md" page that contains "{% for puppy in site.puppies %}<div>{{ puppy.title }}</div>{% endfor %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "<div>Rover</div>" in "_site/index.html"
But I should see "<div>Snowy</div>" in "_site/index.html"
And I should not see "<div>Figor</div>" in "_site/index.html"
And I should not see "<div>Hardy</div>" in "_site/index.html"
And the "_site/puppies/rover.html" file should exist
And the "_site/puppies/snowy.html" file should not exist
And the "_site/puppies/figor.html" file should not exist
And the "_site/puppies/hardy.html" file should not exist
When I run jekyll build --unpublished
Then I should get a zero exit status
And the _site directory should exist
And I should see "<div>Rover</div>" in "_site/index.html"
And I should see "<div>Snowy</div>" in "_site/index.html"
And I should see "<div>Figor</div>" in "_site/index.html"
But I should see "<div>Hardy</div>" in "_site/index.html"
And the "_site/puppies/rover.html" file should exist
And the "_site/puppies/snowy.html" file should not exist
And the "_site/puppies/figor.html" file should exist
And the "_site/puppies/hardy.html" file should not exist
When I run jekyll build --unpublished --future
Then I should get a zero exit status
And the _site directory should exist
And I should see "<div>Rover</div>" in "_site/index.html"
And I should see "<div>Snowy</div>" in "_site/index.html"
And I should see "<div>Figor</div>" in "_site/index.html"
But I should see "<div>Hardy</div>" in "_site/index.html"
And the "_site/puppies/rover.html" file should exist
And the "_site/puppies/snowy.html" file should exist
And the "_site/puppies/figor.html" file should exist
And the "_site/puppies/hardy.html" file should exist
Scenario: Access unrendered collection with future date and unpublished flag via Liquid
Given I have a _puppies directory
And I have the following documents under the puppies collection:
| title | date | content | published |
| Rover | 2007-12-31 | content for Rover. | true |
| Figor | 2007-12-31 | content for Figor. | false |
| Snowy | 2199-12-31 | content for Snowy. | true |
| Hardy | 2199-12-31 | content for Hardy. | false |
And I have a "_config.yml" file with content:
"""
collections:
puppies:
output: false
"""
And I have a "index.md" page that contains "{% for puppy in site.puppies %}<div>{{ puppy.title }}</div>{% endfor %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "<div>Rover</div>" in "_site/index.html"
But I should see "<div>Snowy</div>" in "_site/index.html"
And I should not see "<div>Figor</div>" in "_site/index.html"
And I should not see "<div>Hardy</div>" in "_site/index.html"
And the "_site/puppies/rover.html" file should not exist
And the "_site/puppies/snowy.html" file should not exist
And the "_site/puppies/figor.html" file should not exist
And the "_site/puppies/hardy.html" file should not exist
When I run jekyll build --unpublished
Then I should get a zero exit status
And the _site directory should exist
And I should see "<div>Rover</div>" in "_site/index.html"
And I should see "<div>Snowy</div>" in "_site/index.html"
And I should see "<div>Figor</div>" in "_site/index.html"
But I should see "<div>Hardy</div>" in "_site/index.html"
And the "_site/puppies/rover.html" file should not exist
And the "_site/puppies/snowy.html" file should not exist
And the "_site/puppies/figor.html" file should not exist
And the "_site/puppies/hardy.html" file should not exist
When I run jekyll build --unpublished --future
Then I should get a zero exit status
And the _site directory should exist
And I should see "<div>Rover</div>" in "_site/index.html"
And I should see "<div>Snowy</div>" in "_site/index.html"
And I should see "<div>Figor</div>" in "_site/index.html"
But I should see "<div>Hardy</div>" in "_site/index.html"
And the "_site/puppies/rover.html" file should not exist
And the "_site/puppies/snowy.html" file should not exist
And the "_site/puppies/figor.html" file should not exist
And the "_site/puppies/hardy.html" file should not exist
Scenario: All the documents
Given I have an "index.html" page that contains "All documents: {% for doc in site.documents %}{{ doc.relative_path }} {% endfor %}"
And I have fixture collections

View File

@@ -212,7 +212,9 @@ module Jekyll
def read_document(full_path)
doc = Document.new(full_path, :site => site, :collection => self)
doc.read
docs << doc unless doc.data["published"] == false
if site.unpublished || doc.published?
docs << doc
end
end
private

View File

@@ -31,9 +31,12 @@ module Jekyll
def filter(entries)
entries.reject do |e|
unless included?(e)
special?(e) || backup?(e) || excluded?(e) || symlink?(e)
end
# Reject this entry if it is a symlink.
next true if symlink?(e)
# Do not reject this entry if it is included.
next false if included?(e)
# Reject this entry if it is special, a backup file, or excluded.
special?(e) || backup?(e) || excluded?(e)
end
end

View File

@@ -128,7 +128,7 @@ module Jekyll
#
# Returns excerpt String
LIQUID_TAG_REGEX = %r!{%\s*(\w+).+\s*%}!m
LIQUID_TAG_REGEX = %r!{%-?\s*(\w+).+\s*-?%}!m
MKDWN_LINK_REF_REGEX = %r!^ {0,3}\[[^\]]+\]:.+$!
def extract_excerpt(doc_content)
@@ -141,7 +141,7 @@ module Jekyll
head =~ LIQUID_TAG_REGEX
tag_name = Regexp.last_match(1)
if liquid_block?(tag_name) && head.match(%r!{%\s*end#{tag_name}\s*%}!).nil?
if liquid_block?(tag_name) && head.match(%r!{%-?\s*end#{tag_name}\s*-?%}!).nil?
print_build_warning
head << "\n{% end#{tag_name} %}"
end
@@ -158,6 +158,11 @@ module Jekyll
def liquid_block?(tag_name)
Liquid::Template.tags[tag_name].superclass == Liquid::Block
rescue NoMethodError
Jekyll.logger.error "Error:",
"A Liquid tag in the excerpt of #{doc.relative_path} couldn't be " \
"parsed."
raise
end
def print_build_warning

View File

@@ -21,7 +21,12 @@ module Jekyll
end
def file(filename)
Jekyll.logger.info "FILENAME:", filename
filename.match(filename_regex)
Jekyll.logger.info "CAPTURES:", Regexp.last_match.captures
puts
filename =
if Regexp.last_match(1) == theme_dir("")
::File.join(::File.basename(Regexp.last_match(1)), Regexp.last_match(2))

View File

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Jekyll
VERSION = "3.8.1".freeze
VERSION = "3.8.4".freeze
end

View File

@@ -0,0 +1,9 @@
---
title: LIQUID_TAG_REGEX excerpt whitespace control test
layout: post
---
{%- for post in site.posts -%}
You are in a maze of twisty little passages, all alike.
There's lots more to say about this, but that's enough for now.
{%- endfor -%}

View File

@@ -0,0 +1,7 @@
---
title: LIQUID_TAG_REGEX excerpt whitespace control test
layout: post
---
{%- assign xyzzy = 'You are in a maze of twisty little passages, all alike.' %}
{{- xyzzy -}}

View File

@@ -0,0 +1,10 @@
---
title: LIQUID_TAG_REGEX excerpt whitespace control test
layout: post
---
{%- for post in site.posts -%}
You are in a maze of twisty little passages, all alike.
There's lots more to say about this, but that's enough for now.
{%- endfor -%}

View File

@@ -0,0 +1 @@
/etc/passwd

View File

@@ -5,7 +5,7 @@ require "helper"
class TestEntryFilter < JekyllUnitTest
context "Filtering entries" do
setup do
@site = Site.new(site_configuration)
@site = fixture_site
end
should "filter entries" do
@@ -87,7 +87,7 @@ class TestEntryFilter < JekyllUnitTest
# no support for symlinks on Windows
skip_if_windows "Jekyll does not currently support symlinks on Windows."
site = Site.new(site_configuration("safe" => true))
site = fixture_site("safe" => true)
site.reader.read_directories("symlink-test")
assert_equal %w(main.scss symlinked-file).length, site.pages.length
@@ -99,11 +99,22 @@ class TestEntryFilter < JekyllUnitTest
# no support for symlinks on Windows
skip_if_windows "Jekyll does not currently support symlinks on Windows."
site = Site.new(site_configuration)
@site.reader.read_directories("symlink-test")
refute_equal [], @site.pages
refute_equal [], @site.static_files
end
should "include only safe symlinks in safe mode even when included" do
# no support for symlinks on Windows
skip_if_windows "Jekyll does not currently support symlinks on Windows."
site = fixture_site("safe" => true, "include" => ["symlinked-file-outside-source"])
site.reader.read_directories("symlink-test")
refute_equal [], site.pages
refute_equal [], site.static_files
# rubocop:disable Performance/FixedSize
assert_equal %w(main.scss symlinked-file).length, site.pages.length
refute_includes site.static_files.map(&:name), "symlinked-file-outside-source"
# rubocop:enable Performance/FixedSize
end
end

View File

@@ -212,4 +212,56 @@ class TestExcerpt < JekyllUnitTest
assert_equal true, @excerpt.is_a?(Jekyll::Excerpt)
end
end
context "An excerpt with non-closed but valid Liquid block tag with whitespace control" do
setup do
clear_dest
@site = fixture_site
@post = setup_post("2018-05-15-open-liquid-block-excerpt-whitespace-control.md")
@excerpt = @post.data["excerpt"]
assert_includes @post.content, "{%- for"
refute_includes @post.content.split("\n\n")[0], "{%- endfor -%}"
end
should "be appended to as necessary and generated" do
assert_includes @excerpt.content, "{% endfor %}"
refute_includes @excerpt.content, "{% endfor %}\n\n{% endfor %}"
assert_equal true, @excerpt.is_a?(Jekyll::Excerpt)
end
end
context "An excerpt with valid closed Liquid block tag with whitespace control" do
setup do
clear_dest
@site = fixture_site
@post = setup_post("2018-05-15-closed-liquid-block-excerpt-whitespace-control.md")
@excerpt = @post.data["excerpt"]
assert_includes @post.content, "{%- for"
assert_includes @post.content.split("\n\n")[0], "{%- endfor -%}"
end
should "not be appended to but generated as is" do
assert_includes @excerpt.content, "{%- endfor -%}"
refute_includes @excerpt.content, "{% endfor %}\n\n{% endfor %}"
assert_equal true, @excerpt.is_a?(Jekyll::Excerpt)
end
end
context "An excerpt with valid Liquid variable with whitespace control" do
setup do
clear_dest
@site = fixture_site
@post = setup_post("2018-05-15-excerpt-whitespace-control-variable.md")
@excerpt = @post.data["excerpt"]
assert_includes @post.content, "{%- assign"
end
should "not be appended to but generated as is" do
assert_includes @excerpt.content, "{{- xyzzy -}}"
assert_equal true, @excerpt.is_a?(Jekyll::Excerpt)
end
end
end

View File

@@ -16,7 +16,7 @@ class TestGeneratedSite < JekyllUnitTest
end
should "ensure post count is as expected" do
assert_equal 54, @site.posts.size
assert_equal 57, @site.posts.size
end
should "insert site.posts into the index" do

View File

@@ -31,5 +31,51 @@ class TestLayoutReader < JekyllUnitTest
assert_equal LayoutReader.new(@site).layout_directory, source_dir("blah/_layouts")
end
end
context "when a layout is a symlink" do
setup do
FileUtils.ln_sf("/etc/passwd", source_dir("_layouts", "symlink.html"))
@site = fixture_site(
"safe" => true,
"include" => ["symlink.html"]
)
end
teardown do
FileUtils.rm(source_dir("_layouts", "symlink.html"))
end
should "only read the layouts which are in the site" do
skip_if_windows "Jekyll does not currently support symlinks on Windows."
layouts = LayoutReader.new(@site).read
refute layouts.key?("symlink"), "Should not read the symlinked layout"
end
end
context "with a theme" do
setup do
FileUtils.ln_sf("/etc/passwd", theme_dir("_layouts", "theme-symlink.html"))
@site = fixture_site(
"include" => ["theme-symlink.html"],
"theme" => "test-theme",
"safe" => true
)
end
teardown do
FileUtils.rm(theme_dir("_layouts", "theme-symlink.html"))
end
should "not read a symlink'd theme" do
skip_if_windows "Jekyll does not currently support symlinks on Windows."
layouts = LayoutReader.new(@site).read
refute layouts.key?("theme-symlink"), \
"Should not read symlinked layout from theme"
end
end
end
end