Compare commits

...

39 Commits

Author SHA1 Message Date
Parker Moore
0e20ced151 Release 1.4.3 2014-01-13 18:10:33 -08:00
Parker Moore
13742c7503 Merge pull request #1945 from jekyll/release-1.4.3
Release 1.4.3
2014-01-13 18:08:31 -08:00
Parker Moore
73beb3986a Require Liquid 2.5.5 2014-01-13 18:07:25 -08:00
Parker Moore
a5e0403d1d Update history 2014-01-13 18:06:02 -08:00
Parker Moore
6eccb11d88 I may as well identify myself here 2014-01-13 17:49:28 -08:00
Parker Moore
fbc2c7e56e Update History & gemspec with version release info. 2014-01-13 17:48:30 -08:00
Parker Moore
4df2b9346a Add 1.4.3 release post by @BenBalter. 2014-01-13 17:47:15 -08:00
Parker Moore
53259039a4 Update history to reflect merge of #1944 2014-01-13 17:42:49 -08:00
Parker Moore
71bb0289e5 Merge pull request #1944 from jekyll/vuln-patch 2014-01-13 17:42:19 -08:00
Parker Moore
780c9302f4 Patch File.realpath for Ruby 1.8.7 2014-01-13 17:35:05 -08:00
Andy Lindeman
b55fb3d816 Prevents disclosure of file existence
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
3901c88805 sanity check for pages permalink traversal
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
10d1f49902 escape relative post permalinks, cleanup
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
98b366e5d5 patch symlink vuln and properly test
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
b1a7e145c0 test symlinkd dir, not file
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
6277335ba0 rebreak tests, move sanitization closer to write
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
e7cf42b624 fix symlink so tests fail
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
69b439904b unbreak tests
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
033971053e add symlink failing test
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
93a6d4d9c0 test multiple traversals
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
827eed78b9 fix failing post count test
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
a06dff4eca url escape before sanitizing
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:08 -08:00
Ben Balter
823f875836 failing test
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
2014-01-13 17:22:07 -08:00
Parker Moore
4af594916f Add link to 'a regression' in 1.4.2 release post 2013-12-16 20:29:27 -05:00
Parker Moore
92da39eb6f Release 1.4.2 2013-12-16 20:18:33 -05:00
Parker Moore
f8983194c8 Update history to reflect release of v1.4.2 2013-12-16 20:16:00 -05:00
Parker Moore
b716cc62fe Bump to v1.4.2 2013-12-16 20:14:42 -05:00
Parker Moore
24495c6355 Rakefile's site:releases:new should use 'release' variable instead of 'version' function to specify version in YAML front-matter 2013-12-16 20:14:33 -05:00
Parker Moore
8d6c09cc4f Add 1.4.2 release post 2013-12-16 20:13:55 -05:00
Matt Rogers
9cc1a8f178 Update history to reflect merge of #1830 2013-12-16 08:01:39 -06:00
Matt Rogers
0d6b208380 Merge pull request #1830 from jekyll/support-maruku-fenced-code-blocks
Support Maruku fenced code blocks
2013-12-16 06:01:32 -08:00
Parker Moore
3fdc91eb78 Add two tests for Maruku fenced code blocks 2013-12-15 15:10:17 -05:00
Parker Moore
6b0c511b9d Support Maruku fenced code blocks
In Maruku v0.7.0, they default to off. Need to default them on our end to on.
2013-12-15 14:54:13 -05:00
Matt Rogers
aa5c98d281 Release 1.4.1 2013-12-09 20:56:36 -06:00
Matt Rogers
eb54b7f90d Allow releases from the v1-stable branch 2013-12-09 20:56:22 -06:00
Matt Rogers
e92b67dfb9 Bump the gemspec version to 1.4.1 2013-12-09 20:55:56 -06:00
Matt Rogers
3a870fd09e Prep for a 1.4.1 release 2013-12-09 20:36:19 -06:00
Matt Rogers
3607ac5e5f Update history to reflect merge of #1796 2013-12-09 20:25:15 -06:00
Parker Moore
ca95e75976 Reject nil entries in Site#read_things 2013-12-09 20:25:04 -06:00
24 changed files with 225 additions and 27 deletions

View File

@@ -10,6 +10,22 @@
### Site Enhancements
## 1.4.3 / 2014-01-13
### Bug Fixes
* Patch show-stopping security vulnerabilities (#1944)
## 1.4.2 / 2013-12-16
### Bug Fixes
* Turn on Maruku fenced code blocks by default (#1830)
## 1.4.1 / 2013-12-09
### Bug Fixes
* Don't allow nil entries when loading posts (#1796)
## 1.4.0 / 2013-12-07
### Major Enhancements

View File

@@ -233,7 +233,7 @@ namespace :site do
post.puts("title: 'Jekyll #{release} Released'")
post.puts("date: #{Time.new.strftime('%Y-%m-%d %H:%M:%S %z')}")
post.puts("author: ")
post.puts("version: #{version}")
post.puts("version: #{release}")
post.puts("categories: [release]")
post.puts("---")
post.puts
@@ -252,8 +252,8 @@ end
#############################################################################
task :release => :build do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
unless `git branch` =~ /^(\* master|\* v1-stable)$/
puts "You must be on the master branch or the v1-stable branch to release!"
exit!
end
sh "git commit --allow-empty -m 'Release #{version}'"

View File

@@ -28,3 +28,40 @@ Feature: Markdown
And I should see "Index" in "_site/index.html"
And I should see "<h1 id=\"my_title\">My Title</h1>" in "_site/index.html"
Scenario: Maruku fenced codeblocks
Given I have a configuration file with "markdown" set to "maruku"
And I have an "index.markdown" file with content:
"""
---
title: My title
---
# My title
```
My awesome code
```
"""
When I run jekyll
Then the _site directory should exist
And I should see "My awesome code" in "_site/index.html"
And I should see "<pre><code>\nMy awesome code\n</code></pre>" in "_site/index.html"
Scenario: Maruku fenced codeblocks
Given I have a configuration file with "markdown" set to "maruku"
And I have an "index.markdown" file with content:
"""
---
title: My title
---
# My title
```ruby
puts "My awesome string"
```
"""
When I run jekyll
Then the _site directory should exist
And I should see "My awesome string" in "_site/index.html"
And I should see "<pre class="ruby"><code class="ruby">\nputs &quot;My awesome string&quot;\n</code></pre>" in "_site/index.html"

View File

@@ -4,9 +4,9 @@ Gem::Specification.new do |s|
s.rubygems_version = '1.3.5'
s.name = 'jekyll'
s.version = '1.4.0'
s.version = '1.4.3'
s.license = 'MIT'
s.date = '2013-12-07'
s.date = '2014-01-13'
s.rubyforge_project = 'jekyll'
s.summary = "A simple, blog aware, static site generator."
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.extra_rdoc_files = %w[README.markdown LICENSE]
s.add_runtime_dependency('liquid', "~> 2.5.2")
s.add_runtime_dependency('liquid', "~> 2.5.5")
s.add_runtime_dependency('classifier', "~> 1.3")
s.add_runtime_dependency('listen', "~> 1.3")
s.add_runtime_dependency('maruku', "~> 0.7.0")
@@ -160,6 +160,8 @@ Gem::Specification.new do |s|
site/_posts/2013-11-04-jekyll-1-3-0-released.markdown
site/_posts/2013-11-26-jekyll-1-3-1-released.markdown
site/_posts/2013-12-07-jekyll-1-4-0-released.markdown
site/_posts/2013-12-16-jekyll-1-4-2-released.markdown
site/_posts/2014-01-13-jekyll-1-4-3-released.markdown
site/css/gridism.css
site/css/normalize.css
site/css/pygments.css
@@ -219,6 +221,7 @@ Gem::Specification.new do |s|
test/source/_data/products.yml
test/source/_includes/params.html
test/source/_includes/sig.markdown
test/source/_includes/tmp
test/source/_layouts/default.html
test/source/_layouts/post/simple.html
test/source/_layouts/simple.html
@@ -256,6 +259,7 @@ Gem::Specification.new do |s|
test/source/_posts/2013-05-10-number-category.textile
test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown
test/source/_posts/2013-08-01-mkdn-extension.mkdn
test/source/_posts/2014-01-06-permalink-traversal.md
test/source/_posts/es/2008-11-21-nested.textile
test/source/about.html
test/source/category/_posts/2008-9-23-categories.textile
@@ -264,6 +268,7 @@ Gem::Specification.new do |s|
test/source/contacts/index.html
test/source/css/screen.css
test/source/deal.with.dots.html
test/source/exploit.md
test/source/foo/_posts/bar/2008-12-12-topical-post.textile
test/source/index.html
test/source/products.yml

View File

@@ -63,7 +63,7 @@ require_all 'jekyll/tags'
SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll
VERSION = '1.4.0'
VERSION = '1.4.3'
# Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top.

View File

@@ -45,6 +45,7 @@ module Jekyll
'excerpt_separator' => "\n\n",
'maruku' => {
'fenced_code_blocks' => true,
'use_tex' => false,
'use_divs' => false,
'png_engine' => 'blahtex',

View File

@@ -8,6 +8,7 @@ module Jekyll
@errors = []
load_divs_library if @config['maruku']['use_divs']
load_blahtext_library if @config['maruku']['use_tex']
enable_fenced_code_blocks if @config['maruku']['fenced_code_blocks']
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install maruku'
@@ -35,6 +36,10 @@ module Jekyll
MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
end
def enable_fenced_code_blocks
MaRuKu::Globals[:fenced_code_blocks] = true
end
def print_errors_and_fail
print @errors.join
raise MaRuKu::Exception, "MaRuKu encountered problem(s) while converting your markup."

View File

@@ -78,6 +78,10 @@ class File
def self.read_with_options(path, opts = {})
self.read(path)
end
def self.realpath(filename)
Pathname.new(filename).realpath.to_s
end
else
def self.read_with_options(path, opts = {})
self.read(path, opts)

View File

@@ -133,7 +133,7 @@ module Jekyll
#
# Returns the destination file path String.
def destination(dest)
path = File.join(dest, self.url)
path = File.join(dest, File.expand_path(self.url, "/"))
path = File.join(path, "index.html") if self.url =~ /\/$/
path
end

View File

@@ -266,7 +266,7 @@ module Jekyll
# Returns destination file path String.
def destination(dest)
# The url needs to be unescaped in order to preserve the correct filename
path = File.join(dest, CGI.unescape(self.url))
path = File.join(dest, File.expand_path(CGI.unescape(self.url), "/"))
path = File.join(path, "index.html") if path[/\.html$/].nil?
path
end

View File

@@ -193,8 +193,10 @@ module Jekyll
end
def read_things(dir, magic_dir, klass)
things = get_entries(dir, magic_dir).map do |entry|
get_entries(dir, magic_dir).map do |entry|
klass.new(self, self.source, dir, entry) if klass.valid?(entry)
end.reject do |entry|
entry.nil?
end
end

View File

@@ -87,14 +87,13 @@ eos
end
def render(context)
dir = File.join(context.registers[:site].source, INCLUDES_DIR)
validate_dir(dir, context.registers[:site].safe)
dir = File.join(File.realpath(context.registers[:site].source), INCLUDES_DIR)
file = retrieve_variable(context) || @file
validate_file_name(file)
path = File.join(dir, file)
validate_file(path, context.registers[:site].safe)
validate_path(path, dir, context.registers[:site].safe)
begin
partial = Liquid::Template.parse(source(path, context))
@@ -108,18 +107,16 @@ eos
end
end
def validate_dir(dir, safe)
if File.symlink?(dir) && safe
raise IOError.new "Includes directory '#{dir}' cannot be a symlink"
def validate_path(path, dir, safe)
if safe && !realpath_prefixed_with?(path, dir)
raise IOError.new "The included file '#{path}' should exist and should not be a symlink"
elsif !File.exist?(path)
raise IOError.new "Included file '#{path}' not found"
end
end
def validate_file(file, safe)
if !File.exists?(file)
raise IOError.new "Included file '#{@file}' not found in '#{INCLUDES_DIR}' directory"
elsif File.symlink?(file) && safe
raise IOError.new "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
end
def realpath_prefixed_with?(path, dir)
File.exist?(path) && File.realpath(path).start_with?(dir)
end
def blank?

View File

@@ -50,6 +50,7 @@ module Jekyll
# Returns a sanitized String URL
def sanitize_url(in_url)
# Remove all double slashes
url = in_url.gsub(/\/\//, "/")
@@ -61,6 +62,7 @@ module Jekyll
# Always add a leading slash
url.gsub!(/\A([^\/])/, '/\1')
url
end
end

View File

@@ -0,0 +1,18 @@
---
layout: news_item
title: 'Jekyll 1.4.2 Released'
date: 2013-12-16 19:48:13 -0500
author: parkr
version: 1.4.2
categories: [release]
---
This release fixes [a regression][] where Maruku fenced code blocks were turned
off, instead of the previous default to on. We've added a new default
configuration to our `maruku` config key: `fenced_code_blocks` and set it to
default to `true`.
If you do not wish to use Maruku fenced code blocks, you may turn this option
off in your site's configuration file.
[a regression]: https://github.com/jekyll/jekyll/pull/1830

View File

@@ -0,0 +1,27 @@
---
layout: news_item
title: 'Jekyll 1.4.3 Released'
date: 2014-01-13 17:43:32 -0800
author: benbalter
version: 1.4.3
categories: [release]
---
Jekyll 1.4.3 contains two **critical** security fixes. If you run Jekyll locally
and do not run Jekyll in "safe" mode (e.g. you do not build Jekyll sites on behalf
of others), you are not affected and are not required to update at this time.
([See pull request.]({{ site.repository }}/pull/1944))
Versions of Jekyll prior to 1.4.3 and greater than 1.2.0 may allow malicious
users to expose the content of files outside the source directory in the
generated output via improper symlink sanitization, potentially resulting in an
inadvertent information disclosure.
Versions of Jekyll prior to 1.4.3 may also allow malicious users to write
arbitrary `.html` files outside of the destination folder via relative path
traversal, potentially overwriting otherwise-trusted content with arbitrary HTML
or Javascript depending on your server's configuration.
*Maintainer's note: Many thanks to @gregose and @charliesome for discovering
these vulnerabilities, and to @BenBalter and @alindeman for writing the patch.
-@parkr*

View File

@@ -316,6 +316,7 @@ maruku:
png_engine: blahtex
png_dir: images/latex
png_url: /images/latex
fenced_code_blocks: true
rdiscount:
extensions: []

View File

@@ -1,10 +1,26 @@
---
layout: docs
title: History
permalink: /docs/history/
---
prev_section: contributing
title: History
layout: docs
permalink: /docs/history/
---
## 1.4.3 / 2014-01-13
### Bug Fixes
- Patch show-stopping security vulnerabilities ([#1944]({{ site.repository }}/issues/1944))
## 1.4.2 / 2013-12-16
### Bug Fixes
- Turn on Maruku fenced code blocks by default ([#1830]({{ site.repository }}/issues/1830))
## 1.4.1 / 2013-12-09
### Bug Fixes
- Don't allow nil entries when loading posts ([#1796]({{ site.repository }}/issues/1796))
## 1.4.0 / 2013-12-07
### Major Enhancements

1
test/source/_includes/tmp Symbolic link
View File

@@ -0,0 +1 @@
/tmp

View File

@@ -0,0 +1,5 @@
---
permalink: /%2e%2e/%2e%2e/%2e%2e/baddie.html
---
# Test

5
test/source/exploit.md Normal file
View File

@@ -0,0 +1,5 @@
---
permalink: /%2e%2e/%2e%2e/%2e%2e/baddie.html
---
# Test

View File

@@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
end
should "ensure post count is as expected" do
assert_equal 36, @site.posts.size
assert_equal 37, @site.posts.size
end
should "insert site.posts into the index" do

View File

@@ -101,6 +101,16 @@ class TestPage < Test::Unit::TestCase
assert_equal @page.permalink, @page.url
assert_equal "/about/", @page.dir
end
should "not be writable outside of destination" do
unexpected = File.expand_path("../../../baddie.html", dest_dir)
File.delete unexpected if File.exist?(unexpected)
page = setup_page("exploit.md")
do_render(page)
page.write(dest_dir)
assert !File.exist?(unexpected)
end
end
context "with specified layout of nil" do

View File

@@ -75,6 +75,17 @@ class TestPost < Test::Unit::TestCase
assert_equal "/my_category/permalinked-post", @post.url
end
should "not be writable outside of destination" do
unexpected = File.expand_path("../../../baddie.html", dest_dir)
File.delete unexpected if File.exist?(unexpected)
post = setup_post("2014-01-06-permalink-traversal.md")
do_render(post)
post.write(dest_dir)
assert !File.exist?(unexpected)
assert File.exist?(File.expand_path("baddie.html", dest_dir))
end
context "with CRLF linebreaks" do
setup do
@real_file = "2009-05-24-yaml-linebreak.markdown"

View File

@@ -347,6 +347,41 @@ CONTENT
end
context "include tag with parameters" do
context "with symlink'd include" do
should "not allow symlink includes" do
File.open("/tmp/pages-test", 'w') { |file| file.write("SYMLINK TEST") }
assert_raise IOError do
content = <<CONTENT
---
title: Include symlink
---
{% include tmp/pages-test %}
CONTENT
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
end
assert_no_match /SYMLINK TEST/, @result
end
should "not expose the existence of symlinked files" do
ex = assert_raise IOError do
content = <<CONTENT
---
title: Include symlink
---
{% include tmp/pages-test-does-not-exist %}
CONTENT
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
end
assert_match /should exist and should not be a symlink/, ex.message
end
end
context "with one parameter" do
setup do
content = <<CONTENT