jekyll-content-security-policy-generator 1.6.10 → 1.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +128 -0
- data/README.md +8 -0
- data/lib/jekyll-content-security-policy-generator/hook.rb +12 -8
- data/lib/jekyll-content-security-policy-generator/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2033feca49aeb4a10933f1c7fd8f628b3053030c3e89017f4eff63e716a74afc
|
4
|
+
data.tar.gz: c0ec4dd232b0fa6daad0e73ca20bbd7b69b6ff6738620329b55a66f6ba748faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65f682c0f7d2b5c8e59918e3a93afb4c2f53ea3c933a860a52aec44325a931cf236d09ff900f3c4d2ad97889d10bc13a6d568710ba363364191de3a5e4b3a699
|
7
|
+
data.tar.gz: fbdbd9a95672881e602c0445a1030754cfdca0eefc7c931ecb09903250da3cadf6a95e6f9d87c83ac7091392f9ed9978b821a8b5ea561bf60f0811a97f12cb46
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
10
|
+
and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
26
|
+
overall community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
31
|
+
advances of any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email
|
35
|
+
address, without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
.
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
86
|
+
of actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
93
|
+
permanent ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
113
|
+
the community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.0, available at
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
123
|
+
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
125
|
+
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
128
|
+
https://www.contributor-covenant.org/translations.
|
data/README.md
CHANGED
@@ -20,6 +20,14 @@ To speed up development of Jekyll based sites whilst also helping to generate se
|
|
20
20
|
* Creates or reuses an HTTP meta tag for the content security policy.
|
21
21
|
* Finds all images, styles, scripts and frames with external URLs and builds CSP.
|
22
22
|
* Converts style attributes into ```<style>``` elements.
|
23
|
+
* If a page already has a content-security-policy tag, (such as your index.html file), the script will reuse it.
|
24
|
+
* Image URLs such as https://strongscot.com/images/logo.svg will have a rule such as https://strongscot.com/images/
|
25
|
+
|
26
|
+
## Upcoming Features
|
27
|
+
|
28
|
+
* Ability to specify how lax the domain rules can be. For example, ```https://strongscot.com/images/logo.svg``` would be converted to
|
29
|
+
```https://strongscot.com/images/``` under strict and ```https://strongscot.com``` under relaxed.
|
30
|
+
* Ability in site.yaml file to specify what files it should parse, at the moment its only ```.html```.
|
23
31
|
|
24
32
|
## Installation
|
25
33
|
|
@@ -95,7 +95,7 @@ module Jekyll
|
|
95
95
|
@csp_script_src.concat(policy_parts.drop(1))
|
96
96
|
elsif policy_parts[0] == 'style-src'
|
97
97
|
@csp_style_src.concat(policy_parts.drop(1))
|
98
|
-
elsif policy_parts[0] == '
|
98
|
+
elsif policy_parts[0] == 'img-src'
|
99
99
|
@csp_image_src.concat(policy_parts.drop(1))
|
100
100
|
elsif policy_parts[0] == 'frame-src'
|
101
101
|
@csp_frame_src.concat(policy_parts.drop(1))
|
@@ -107,6 +107,10 @@ module Jekyll
|
|
107
107
|
Jekyll.logger.warn "Incorrect existing content security policy meta tag found, skipping."
|
108
108
|
end
|
109
109
|
end
|
110
|
+
|
111
|
+
@nokogiri.search('meta[http-equiv="Content-Security-Policy"]').each do |el|
|
112
|
+
el.remove
|
113
|
+
end
|
110
114
|
end
|
111
115
|
end
|
112
116
|
|
@@ -120,7 +124,8 @@ module Jekyll
|
|
120
124
|
if find.attr('id')
|
121
125
|
element_id = find.attr('id')
|
122
126
|
else
|
123
|
-
|
127
|
+
hash = Digest::MD5.hexdigest find_src + "#{Random.rand(11)}"
|
128
|
+
element_id = "csp-gen-" + hash
|
124
129
|
find["id"] = element_id
|
125
130
|
end
|
126
131
|
|
@@ -148,7 +153,7 @@ module Jekyll
|
|
148
153
|
@nokogiri.css('img').each do |find|
|
149
154
|
find_src = find.attr('src')
|
150
155
|
|
151
|
-
if find_src.start_with?('http', 'https')
|
156
|
+
if find_src and find_src.start_with?('http', 'https')
|
152
157
|
@csp_image_src.push find_src.match(/(.*\/)+(.*$)/)[1]
|
153
158
|
end
|
154
159
|
end
|
@@ -174,7 +179,7 @@ module Jekyll
|
|
174
179
|
if find.attr('src')
|
175
180
|
find_src = find.attr('src')
|
176
181
|
|
177
|
-
if find_src.start_with?('http', 'https')
|
182
|
+
if find_src and find_src.start_with?('http', 'https')
|
178
183
|
@csp_script_src.push find_src.match(/(.*\/)+(.*$)/)[1]
|
179
184
|
end
|
180
185
|
|
@@ -191,7 +196,7 @@ module Jekyll
|
|
191
196
|
if find.attr('src')
|
192
197
|
find_src = find.attr('src')
|
193
198
|
|
194
|
-
if find_src.start_with?('http', 'https')
|
199
|
+
if find_src and find_src.start_with?('http', 'https')
|
195
200
|
@csp_style_src.push find_src.match(/(.*\/)+(.*$)/)[1]
|
196
201
|
end
|
197
202
|
|
@@ -207,7 +212,7 @@ module Jekyll
|
|
207
212
|
@nokogiri.css('iframe').each do |find|
|
208
213
|
find_src = find.attr('src')
|
209
214
|
|
210
|
-
if find_src.start_with?('http', 'https')
|
215
|
+
if find_src and find_src.start_with?('http', 'https')
|
211
216
|
@csp_frame_src.push find_src.match(/(.*\/)+(.*$)/)[1]
|
212
217
|
end
|
213
218
|
end
|
@@ -260,9 +265,8 @@ module Jekyll
|
|
260
265
|
if File.extname(dest_path) == ".html"
|
261
266
|
content_security_policy_generator = ContentSecurityPolicyGenerator.new output
|
262
267
|
output = content_security_policy_generator.run
|
268
|
+
write_file_contents(dest_path, output)
|
263
269
|
end
|
264
|
-
|
265
|
-
write_file_contents(dest_path, output)
|
266
270
|
end
|
267
271
|
|
268
272
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-content-security-policy-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- strongscot
|
@@ -105,6 +105,7 @@ extensions: []
|
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
107
|
- ".gitignore"
|
108
|
+
- CODE_OF_CONDUCT.md
|
108
109
|
- Cover.png
|
109
110
|
- LICENSE
|
110
111
|
- Makefile
|