diff --git a/README.md b/README.md index 6d9eaa68..4be387b8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ gollum -- A git-based Wiki [![Open Source Helpers](https://www.codetriage.com/gollum/gollum/badges/users.svg)](https://www.codetriage.com/gollum/gollum) [![Cutting Edge Dependency Status](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum/svg 'Cutting Edge Dependency Status')](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum/info) -**Please update to gollum 5.1.1 to counter a recent exploit in the kramdown rendering gem, [CVE-2020-14001](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-14001)** +**Please update to gollum 5.1.2 to counter a recent exploit. More info will follow after CVE is assigned.** **Gollum version 5.0 is out!** See [here](https://github.com/gollum/gollum/wiki/5.0-release-notes) for a list of changes and new features compared to Gollum version 4.x, and see some [Screenshots](https://github.com/gollum/gollum/wiki/Screenshots) of Gollum's features. diff --git a/lib/gollum/views/overview.rb b/lib/gollum/views/overview.rb index 67a66c60..277ccfd7 100644 --- a/lib/gollum/views/overview.rb +++ b/lib/gollum/views/overview.rb @@ -25,9 +25,9 @@ module Precious title = crumb.basename if title == path.basename - breadcrumb << %{} + breadcrumb << %{} else - breadcrumb << %{} + breadcrumb << %{} end end breadcrumb << %{} diff --git a/lib/gollum/views/page.rb b/lib/gollum/views/page.rb index 061397ec..ba0a4114 100644 --- a/lib/gollum/views/page.rb +++ b/lib/gollum/views/page.rb @@ -32,7 +32,7 @@ module Precious path.descend do |crumb| element = "#{crumb.basename}" next if element == @page.title - breadcrumb << %{} + breadcrumb << %{} end breadcrumb << %{} breadcrumb.join("\n") diff --git a/test/test_overview_view.rb b/test/test_overview_view.rb index c3f20937..3cc1425e 100644 --- a/test/test_overview_view.rb +++ b/test/test_overview_view.rb @@ -43,6 +43,13 @@ context "Precious::Views::Overview" do @page.instance_variable_set("@base_url", "") assert_equal "", @page.breadcrumb end + + test 'guard against malicious filenames' do + malicious_title = '' + @page.instance_variable_set("@path", malicious_title) + @page.instance_variable_set("@base_url", "") + assert @page.breadcrumb.include?(">%3Cimg+src%3Dx+onerror%3Dalert%281%29+") + end test "breadcrumb with no path" do assert_equal 'Home', @page.breadcrumb diff --git a/test/test_page_view.rb b/test/test_page_view.rb index b1143af7..9cf3c239 100644 --- a/test/test_page_view.rb +++ b/test/test_page_view.rb @@ -12,6 +12,17 @@ context "Precious::Views::Page" do teardown do FileUtils.rm_rf(@path) end + + test 'guard against malicious filenames' do + malicious_title = '' + @wiki.write_page(malicious_title, :markdown, 'Is Bilbo a hobbit? Why certainly!') + page = @wiki.page(malicious_title) + @view = Precious::Views::Page.new + @view.instance_variable_set :@page, page + @view.instance_variable_set :@content, page.formatted_data + @view.instance_variable_set :@h1_title, false + assert @view.breadcrumb.include?(">%3Cimg+src%3Dx+onerror%3Dalert%281%29+") + end test "h1 title sanitizes correctly" do title = 'H1'