premailer 1.31.0 → 1.32.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/README.md +10 -0
- data/lib/premailer/premailer.rb +4 -1
- data/lib/premailer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2186c26ccc50f22227a6dbbf53b4cd3b5ae5f8bebdbdc190b0e7fd0e5a152565
|
|
4
|
+
data.tar.gz: 84becf9c1329983be14a427eef560806fb23ceb05847b7c5484033fe2fda0248
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c489d4a76330f66eeb60793faebc2839591870ee261179c0d9369ef95e5194d967f2b0f1aec31f16edb9355e363766fcb9245e67f13d2bb39b53cf1598ab8e36
|
|
7
|
+
data.tar.gz: 48a0cf85f5d2c2e3cbc2e7a5b21e70bf0e9e9215b2067703b9f9e5574342be25901aa639b1fcbdc3889e1d883905ad30e1e300d188fee68fd043f0de1588e2f2
|
data/README.md
CHANGED
|
@@ -127,6 +127,16 @@ Premailer.new(
|
|
|
127
127
|
|
|
128
128
|
[available options](https://premailer.github.io/premailer/Premailer.html#initialize-instance_method)
|
|
129
129
|
|
|
130
|
+
### Loading CSS from local/private hosts
|
|
131
|
+
|
|
132
|
+
css_parser 3+ blocks fetching remote CSS (`<link>`, `@import`) from hosts that resolve to loopback/private IPs
|
|
133
|
+
or do not resolve at all, to prevent SSRF.
|
|
134
|
+
Those styles are silently dropped (unless `io_exceptions: true`).
|
|
135
|
+
To allow them, when the html is trusted:
|
|
136
|
+
```ruby
|
|
137
|
+
Premailer.new(html, with_html_string: true, allow_local_network: true)
|
|
138
|
+
```
|
|
139
|
+
|
|
130
140
|
## Support for CSS variables
|
|
131
141
|
|
|
132
142
|
The gem does not automatically replace CSS variables with their static values.
|
data/lib/premailer/premailer.rb
CHANGED
|
@@ -171,6 +171,7 @@ class Premailer
|
|
|
171
171
|
# @option options [Boolean] :verbose Whether to print errors and warnings to <tt>$stderr</tt>. Default is false.
|
|
172
172
|
# @option options [Boolean] :io_exceptions Throws exceptions on I/O errors. Default is false.
|
|
173
173
|
# @option options [Boolean] :rule_set_exceptions Throws exceptions on invalid values in CSS Parser rule sets. Default is true.
|
|
174
|
+
# @option options [Boolean] :allow_local_network Allow css_parser to fetch remote CSS from local/private network hosts (disables its SSRF protection). Default is false.
|
|
174
175
|
# @option options [Boolean] :include_link_tags Whether to include css from <tt>link rel=stylesheet</tt> tags. Default is true.
|
|
175
176
|
# @option options [Boolean] :include_style_tags Whether to include css from <tt>style</tt> tags. Default is true.
|
|
176
177
|
# @option options [String] :input_encoding Manually specify the source documents encoding. This is a good idea. Default is ASCII-8BIT.
|
|
@@ -204,6 +205,7 @@ class Premailer
|
|
|
204
205
|
:debug => false,
|
|
205
206
|
:io_exceptions => false,
|
|
206
207
|
:rule_set_exceptions => true,
|
|
208
|
+
:allow_local_network => false,
|
|
207
209
|
:include_link_tags => true,
|
|
208
210
|
:include_style_tags => true,
|
|
209
211
|
:input_encoding => 'ASCII-8BIT',
|
|
@@ -239,7 +241,8 @@ class Premailer
|
|
|
239
241
|
:absolute_paths => true,
|
|
240
242
|
:import => true,
|
|
241
243
|
:io_exceptions => @options[:io_exceptions],
|
|
242
|
-
:rule_set_exceptions => @options[:rule_set_exceptions]
|
|
244
|
+
:rule_set_exceptions => @options[:rule_set_exceptions],
|
|
245
|
+
:allow_local_network => @options[:allow_local_network]
|
|
243
246
|
}
|
|
244
247
|
)
|
|
245
248
|
|
data/lib/premailer/version.rb
CHANGED