bridgetown-content-security-policy 1.2.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +2 -2
- data/.rubocop.yml +26 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -6
- data/Rakefile +1 -0
- data/bridgetown-content-security-policy.gemspec +1 -1
- data/bridgetown.automation.rb +3 -2
- data/lib/bridgetown-content-security-policy/builder.rb +8 -10
- data/lib/bridgetown-content-security-policy/version.rb +1 -1
- data/lib/bridgetown-content-security-policy.rb +3 -1
- metadata +7 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 81decbc66abeba86a607d1a66667bbe9da1509fbb4d41f5965fc432d650cd308
|
|
4
|
+
data.tar.gz: d36a2c6a8cb1dabd51c264a308c26b1e0f92e399107ad0911dd0bbdbe18824be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b5c956da517a75a8cc80ce492b2bbe2671367bd02c31bf87c59b76c1ab578432b61701032c6cc1cfbb1826d54dae87491faf8716f019b066f0013f5d2e7a7d4e
|
|
7
|
+
data.tar.gz: 4fb5ce9e341174f174a8ad88e2ba7eee820186eb9eefaba29d086e371aefd3fa583e80f2beed3a09d44d7565dfd187086d8641717953bb0e93362eadcfaf0512
|
data/.github/workflows/tests.yml
CHANGED
|
@@ -13,8 +13,8 @@ jobs:
|
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
strategy:
|
|
15
15
|
matrix:
|
|
16
|
-
ruby_version: [2.
|
|
17
|
-
bridgetown_version: [
|
|
16
|
+
ruby_version: [3.2.4, 3.3.6, 3.4.2]
|
|
17
|
+
bridgetown_version: [2.0.0, 2.1.0]
|
|
18
18
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
|
19
19
|
# Has to be top level to cache properly
|
|
20
20
|
env:
|
data/.rubocop.yml
CHANGED
|
@@ -4,19 +4,41 @@ inherit_gem:
|
|
|
4
4
|
rubocop-bridgetown: .rubocop.yml
|
|
5
5
|
|
|
6
6
|
AllCops:
|
|
7
|
-
TargetRubyVersion: 2.
|
|
8
|
-
Include:
|
|
9
|
-
- lib/**/*.rb
|
|
7
|
+
TargetRubyVersion: 2.7
|
|
10
8
|
|
|
11
9
|
Exclude:
|
|
12
10
|
- .gitignore
|
|
13
|
-
- .rspec
|
|
14
11
|
- .rubocop.yml
|
|
12
|
+
- "*.gemspec"
|
|
15
13
|
|
|
16
14
|
- Gemfile.lock
|
|
17
15
|
- CHANGELOG.md
|
|
18
16
|
- LICENSE.txt
|
|
19
17
|
- README.md
|
|
18
|
+
- Rakefile
|
|
19
|
+
- bridgetown.automation.rb
|
|
20
20
|
|
|
21
21
|
- script/**/*
|
|
22
|
+
- test/fixtures/**/*
|
|
22
23
|
- vendor/**/*
|
|
24
|
+
|
|
25
|
+
Layout/LineLength:
|
|
26
|
+
Max: 140
|
|
27
|
+
|
|
28
|
+
Metrics/BlockLength:
|
|
29
|
+
Enabled: false
|
|
30
|
+
|
|
31
|
+
Bundler/OrderedGems:
|
|
32
|
+
Enabled: false
|
|
33
|
+
|
|
34
|
+
Style/IfUnlessModifier:
|
|
35
|
+
Enabled: false
|
|
36
|
+
|
|
37
|
+
Layout/IndentationConsistency:
|
|
38
|
+
Enabled: false
|
|
39
|
+
|
|
40
|
+
Layout/IndentationWidth:
|
|
41
|
+
Enabled: false
|
|
42
|
+
|
|
43
|
+
Style/OptionalBooleanParameter:
|
|
44
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -5,13 +5,8 @@ gemspec
|
|
|
5
5
|
|
|
6
6
|
gem "bridgetown", ENV["BRIDGETOWN_VERSION"] if ENV["BRIDGETOWN_VERSION"]
|
|
7
7
|
|
|
8
|
-
group :development, :test do
|
|
9
|
-
gem "byebug"
|
|
10
|
-
end
|
|
11
|
-
|
|
12
8
|
group :test do
|
|
13
9
|
gem "minitest"
|
|
14
10
|
gem "minitest-profile"
|
|
15
11
|
gem "minitest-reporters"
|
|
16
|
-
|
|
17
|
-
end
|
|
12
|
+
end
|
data/Rakefile
CHANGED
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
|
|
19
19
|
spec.required_ruby_version = ">= 2.7.0"
|
|
20
20
|
|
|
21
|
-
spec.add_dependency "bridgetown", ">=
|
|
21
|
+
spec.add_dependency "bridgetown", ">= 2.0", "< 4.0"
|
|
22
22
|
|
|
23
23
|
spec.add_development_dependency "bundler"
|
|
24
24
|
spec.add_development_dependency "nokogiri"
|
data/bridgetown.automation.rb
CHANGED
|
@@ -36,6 +36,7 @@ create_file "config/content_security_policy.config.rb" do
|
|
|
36
36
|
RUBY
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
say_status :content_security_policy, "All done!
|
|
40
|
-
say_status :content_security_policy, "
|
|
39
|
+
say_status :content_security_policy, "All done! Add `init :\"bridgetown-content-security-policy\"` to your `config/initializers.rb`"
|
|
40
|
+
say_status :content_security_policy, "Add <% content_security_policy %> to the head tag in your layouts to render the CSP."
|
|
41
|
+
say_status :content_security_policy, "See the new content_security_policy.rb file for details"
|
|
41
42
|
say_status :content_security_policy, "More info available at: https://github.com/ayushn21/bridgetown-content-security-policy"
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module BridgetownContentSecurityPolicy
|
|
4
|
-
|
|
4
|
+
@policies ||= {}
|
|
5
5
|
|
|
6
6
|
def self.configure(name, &block)
|
|
7
|
-
|
|
7
|
+
@policies[name.to_sym] = BridgetownContentSecurityPolicy::Policy.new(&block)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.policies
|
|
11
|
+
@policies || {}
|
|
8
12
|
end
|
|
9
13
|
|
|
10
14
|
class Builder < Bridgetown::Builder
|
|
@@ -12,22 +16,16 @@ module BridgetownContentSecurityPolicy
|
|
|
12
16
|
require_relative site.in_root_dir("config", "content_security_policy.config.rb")
|
|
13
17
|
|
|
14
18
|
unless default_policy
|
|
15
|
-
# rubocop:disable Layout/LineLength
|
|
16
19
|
Bridgetown.logger.error "\nDefault Content Security Policy not configured"
|
|
17
20
|
Bridgetown.logger.info "Please configure a default CSP in content_security_policy.config.rb\n"
|
|
18
|
-
# rubocop:enable Layout/LineLength
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
liquid_tag "content_security_policy" do |_attributes, tag|
|
|
22
24
|
render tag.context["page"]["content_security_policy"]
|
|
23
25
|
end
|
|
24
26
|
|
|
25
|
-
helper "
|
|
26
|
-
render
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
helper "content_security_policy", helpers_scope: true do
|
|
30
|
-
_csp view.page.data.content_security_policy
|
|
27
|
+
helper "content_security_policy" do
|
|
28
|
+
render helpers.view.page.data.content_security_policy
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
|
|
@@ -4,4 +4,6 @@ require "bridgetown"
|
|
|
4
4
|
require "bridgetown-content-security-policy/policy"
|
|
5
5
|
require "bridgetown-content-security-policy/builder"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Bridgetown.initializer :"bridgetown-content-security-policy" do |config|
|
|
8
|
+
config.builder BridgetownContentSecurityPolicy::Builder
|
|
9
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bridgetown-content-security-policy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ayush Newatia
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-01-29 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bridgetown
|
|
@@ -16,20 +15,20 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '2.0'
|
|
20
19
|
- - "<"
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
21
|
+
version: '4.0'
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
25
|
requirements:
|
|
27
26
|
- - ">="
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
28
|
+
version: '2.0'
|
|
30
29
|
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
31
|
+
version: '4.0'
|
|
33
32
|
- !ruby/object:Gem::Dependency
|
|
34
33
|
name: bundler
|
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,7 +85,6 @@ dependencies:
|
|
|
86
85
|
- - ">="
|
|
87
86
|
- !ruby/object:Gem::Version
|
|
88
87
|
version: '0'
|
|
89
|
-
description:
|
|
90
88
|
email: ayush@hey.com
|
|
91
89
|
executables: []
|
|
92
90
|
extensions: []
|
|
@@ -110,7 +108,6 @@ homepage: https://github.com/ayushn21/bridgetown-content-security-policy
|
|
|
110
108
|
licenses:
|
|
111
109
|
- MIT
|
|
112
110
|
metadata: {}
|
|
113
|
-
post_install_message:
|
|
114
111
|
rdoc_options: []
|
|
115
112
|
require_paths:
|
|
116
113
|
- lib
|
|
@@ -125,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
125
122
|
- !ruby/object:Gem::Version
|
|
126
123
|
version: '0'
|
|
127
124
|
requirements: []
|
|
128
|
-
rubygems_version: 3.2
|
|
129
|
-
signing_key:
|
|
125
|
+
rubygems_version: 3.6.2
|
|
130
126
|
specification_version: 4
|
|
131
127
|
summary: Add a content security policy to your website using a convenient Ruby DSL
|
|
132
128
|
test_files: []
|