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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 533e735e745f5ffc88ea6643bdb54824761a1ea131f0ddca4b3a999eaee04bac
4
- data.tar.gz: 77a38f71d31a3ed1fa3fadd34de8416cc3987b229d306ceb1d44d680fca343d7
3
+ metadata.gz: 2186c26ccc50f22227a6dbbf53b4cd3b5ae5f8bebdbdc190b0e7fd0e5a152565
4
+ data.tar.gz: 84becf9c1329983be14a427eef560806fb23ceb05847b7c5484033fe2fda0248
5
5
  SHA512:
6
- metadata.gz: b571211f13970f25e89c4c32472596950cc399cea0a6c47c798956e27ffa1fa45a99b665a69440d50f97a92822623ec82612f52f839b39c604a9f3a1821a622d
7
- data.tar.gz: 3dbb94a55011a64594000339cb949ede008aa1bbd546f675fae6f54e19821e5358aee82adacc2c104340fd4b12bbb9318892eaa98fb5bd3c34a6f178135e8f60
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.
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  class Premailer
3
3
  # Premailer version.
4
- VERSION = '1.31.0'
4
+ VERSION = '1.32.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: premailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.31.0
4
+ version: 1.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dunae