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

Whitelist jekyll-octicons for everyone #483

Merged
merged 3 commits into from
Sep 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
source "https://rubygems.org"

gemspec

# Whitelisted plugins not included in runtime dependencies.
gem "jekyll-octicons"
1 change: 1 addition & 0 deletions lib/github-pages/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Plugins
jekyll-default-layout
jekyll-titles-from-headings
jekyll-include-cache
jekyll-octicons
).freeze

# Plugins only allowed locally
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ source "https://rubygems.org"

gem "github-pages", :group => :jekyll_plugins, :path => "../../"
gem "jekyll_test_plugin_malicious"

# Whitelisted plugins not included in runtime dependencies.
gem "jekyll-octicons", :group => :jekyll_plugins
1 change: 1 addition & 0 deletions spec/fixtures/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ gems:
- jekyll-sitemap
- jekyll-redirect-from
- jekyll-feed
- jekyll-octicons
- jekyll-paginate
- jekyll-seo-tag
- jekyll-avatar
Expand Down
4 changes: 4 additions & 0 deletions spec/fixtures/jekyll-octicons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

{% octicon alert height:32 class:"right left" aria-label:hi %}
11 changes: 10 additions & 1 deletion spec/github-pages/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def env
{
"BUNDLE_GEMFILE" => "#{source}/Gemfile",
"JEKYLL_ENV" => "development",
"DISABLE_WHITELIST" => "", # Do not disable the whitelist.
}
end

Expand All @@ -29,7 +30,7 @@ def env
Dir.chdir(source) do
bundle_output, status = Open3.capture2e env, %w(bundle install)
raise StandardError, bundle_output if status.exitstatus != 0
cmd = %w(bundle exec jekyll build --verbose)
cmd = %w(bundle exec jekyll build --verbose --trace)
cmd = cmd.concat ["--source", source, "--destination", destination]
build_output, status = Open3.capture2e env, *cmd
raise StandardError, bundle_output + build_output if status.exitstatus != 0
Expand Down Expand Up @@ -222,4 +223,12 @@ def env
expect(contents).to match('<div class="container-lg px-3 my-5 markdown-body">')
end
end

context "jekyll-octicons" do
it "plops in the octicon" do
expect(contents).to match('<svg height="32"')
expect(contents).to match('class="octicon octicon-alert right left"')
expect(contents).to match('aria-label="hi"')
end
end
end
1 change: 1 addition & 0 deletions spec/github-pages/plugins_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
GitHubPages::Plugins::PLUGIN_WHITELIST.each do |plugin|
it "versions the #{plugin} plugin" do
next if plugin == "jekyll-include-cache"
next if plugin == "jekyll-octicons" # TODO: we should expose the version for these
expect(GitHubPages::Dependencies::VERSIONS.keys).to include(plugin)
end
end
Expand Down