Skip to content

Commit f02be34

Browse files
committed
v2.3.0
1 parent 87f1486 commit f02be34

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
### Unreleased
44

5+
### Version 3.0.0
6+
* Harden read_remote_file, use `allow_local_network: true` and `allow_file_uris: true` to bypass
7+
58
### Version 2.2.0
69
* Accept CSS `<number>` values with an omitted integer part (e.g. `.1`) inside `rgb()`/`rgba()`/`hsl()`/`hsla()`. Previously `RE_COLOUR_NUMERIC` and `RE_COLOUR_NUMERIC_ALPHA` required at least one digit before the decimal point, which caused colours such as `rgba(0,0,0,.1)` to be silently dropped during shorthand expansion (`background-color` from `background:`, `border-*-color` from `border:`).
710

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
css_parser (2.2.0)
4+
css_parser (3.0.0)
55
addressable
66
ssrf_filter (~> 1.5)
77

lib/css_parser/parser.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Parser
3838
REMOTE_ALLOWED_SCHEMES = %w[http https].freeze
3939

4040
# Array of CSS files that have been loaded.
41-
attr_reader :loaded_uris
41+
attr_reader :loaded_uris
4242

4343
def initialize(options = {})
4444
@options = {
@@ -644,7 +644,7 @@ def read_local_file(uri) # :nodoc:
644644
# LFI gate; refuse to read rather than silently leak.
645645
unless @options[:allow_file_uris]
646646
raise "BUG: #{self.class}##{__method__} reached with " \
647-
"allow_file_uris=false (LFI gate bypassed)"
647+
'allow_file_uris=false (LFI gate bypassed)'
648648
end
649649

650650
return nil unless circular_reference_check(uri.to_s)
@@ -735,7 +735,7 @@ def fetch_via_net_http(uri, redirect_count = 0) # :nodoc:
735735
# because the option does not change mid-request.
736736
unless @options[:allow_local_network]
737737
raise "BUG: #{self.class}##{__method__} reached with " \
738-
"allow_local_network=false (SSRF gate bypassed)"
738+
'allow_local_network=false (SSRF gate bypassed)'
739739
end
740740

741741
raise RemoteFileError, uri.to_s unless REMOTE_ALLOWED_SCHEMES.include?(uri.scheme)

lib/css_parser/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module CssParser
4-
VERSION = '2.2.0'.freeze
4+
VERSION = '3.0.0'.freeze
55
end

0 commit comments

Comments
 (0)