mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
4 Commits
log-cache-
...
debug-7328
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33faf349c1 | ||
|
|
cc52cac81a | ||
|
|
91abe9f741 | ||
|
|
d9a2758ff6 |
@@ -1,3 +1,9 @@
|
||||
## 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
version: 3.8.3
|
||||
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
|
||||
|
||||
@@ -4,6 +4,15 @@ 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}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.8.3
|
||||
3.8.4
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
VERSION = "3.8.3".freeze
|
||||
VERSION = "3.8.4".freeze
|
||||
end
|
||||
|
||||
1
test/source/symlink-test/symlinked-file-outside-source
Symbolic link
1
test/source/symlink-test/symlinked-file-outside-source
Symbolic link
@@ -0,0 +1 @@
|
||||
/etc/passwd
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user