crass 1.0.7 → 1.0.8
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/HISTORY.md +6 -0
- data/SECURITY.md +3 -0
- data/lib/crass/tokenizer.rb +10 -12
- data/lib/crass/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4519ecea822a7a2632913d4ed71cb69c7258f52be999546e0cf6c3e07b3c1977
|
|
4
|
+
data.tar.gz: 679720a3e80e1cd1b7a9a2e74918006deb3f515f1f1adef72675f2e34b031231
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f10e1e6862c2af99e8a703695cd88576cbe67d4bfd12f11d2eaed16d5a2d0bc1662a515b1e43e2e7371a0bef42f86a7af04dc1f5c4a84fe2136d7c6bebae0f47
|
|
7
|
+
data.tar.gz: c55f035f81dbaa5a3a0abfd0fcbb2636ec151ae24e50806e3bcd871a10af281a35b3d892281a15bade02fb36bc38de945fa547110c74442e2fac3f86b910a204
|
data/HISTORY.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Crass Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.8 (2026-10-21)
|
|
4
|
+
|
|
5
|
+
### Security
|
|
6
|
+
|
|
7
|
+
- Moderate: Fixed a tokenizer bug in which a `)` following an escaped backslash (`\\`) inside a bad URL didn't terminate the bad URL token, causing Crass to consume more input than a spec-compliant browser would. CSS sanitizers built on Crass could be tricked into passing through declarations, rules, or at-rules that a browser would then apply. (GHSA-pq4g-8rxf-4g29)
|
|
8
|
+
|
|
3
9
|
## 1.0.7 (2026-06-25)
|
|
4
10
|
|
|
5
11
|
### Security
|
data/SECURITY.md
ADDED
data/lib/crass/tokenizer.rb
CHANGED
|
@@ -89,7 +89,7 @@ module Crass
|
|
|
89
89
|
|
|
90
90
|
case char.to_sym
|
|
91
91
|
when :'"'
|
|
92
|
-
consume_string
|
|
92
|
+
consume_string(char)
|
|
93
93
|
|
|
94
94
|
when :'#'
|
|
95
95
|
if @s.peek =~ RE_NAME || valid_escape?(@s.peek(2))
|
|
@@ -109,7 +109,7 @@ module Crass
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
when :"'"
|
|
112
|
-
consume_string
|
|
112
|
+
consume_string(char)
|
|
113
113
|
|
|
114
114
|
when :'('
|
|
115
115
|
create_token(:'(')
|
|
@@ -132,7 +132,7 @@ module Crass
|
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
when :+
|
|
135
|
-
if start_number?
|
|
135
|
+
if start_number?(char + @s.peek(2))
|
|
136
136
|
@s.reconsume
|
|
137
137
|
consume_numeric
|
|
138
138
|
else
|
|
@@ -161,7 +161,7 @@ module Crass
|
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
when :'.'
|
|
164
|
-
if start_number?
|
|
164
|
+
if start_number?(char + @s.peek(2))
|
|
165
165
|
@s.reconsume
|
|
166
166
|
consume_numeric
|
|
167
167
|
else
|
|
@@ -196,7 +196,7 @@ module Crass
|
|
|
196
196
|
create_token(:'[')
|
|
197
197
|
|
|
198
198
|
when :'\\'
|
|
199
|
-
if valid_escape?
|
|
199
|
+
if valid_escape?(char + @s.peek)
|
|
200
200
|
@s.reconsume
|
|
201
201
|
consume_ident
|
|
202
202
|
else
|
|
@@ -277,9 +277,7 @@ module Crass
|
|
|
277
277
|
text = String.new
|
|
278
278
|
|
|
279
279
|
until @s.eos?
|
|
280
|
-
if valid_escape?
|
|
281
|
-
text << consume_escaped
|
|
282
|
-
elsif valid_escape?(@s.peek(2))
|
|
280
|
+
if valid_escape?(@s.peek(2))
|
|
283
281
|
@s.consume
|
|
284
282
|
text << consume_escaped
|
|
285
283
|
else
|
|
@@ -320,8 +318,8 @@ module Crass
|
|
|
320
318
|
# Consumes an escaped code point and returns its unescaped value.
|
|
321
319
|
#
|
|
322
320
|
# This method assumes that the `\` has already been consumed, and that the
|
|
323
|
-
# next character in the input has already been verified not to be a
|
|
324
|
-
#
|
|
321
|
+
# next character in the input has already been verified not to be a
|
|
322
|
+
# newline. If the input is at EOF, U+FFFD is returned.
|
|
325
323
|
#
|
|
326
324
|
# 4.3.8. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-an-escaped-code-point
|
|
327
325
|
def consume_escaped
|
|
@@ -384,7 +382,7 @@ module Crass
|
|
|
384
382
|
|
|
385
383
|
char = @s.consume
|
|
386
384
|
|
|
387
|
-
if valid_escape?
|
|
385
|
+
if valid_escape?(char + @s.peek)
|
|
388
386
|
result << consume_escaped
|
|
389
387
|
|
|
390
388
|
# Non-standard: IE * hack
|
|
@@ -567,7 +565,7 @@ module Crass
|
|
|
567
565
|
:value => value + consume_bad_url)
|
|
568
566
|
|
|
569
567
|
when '\\'
|
|
570
|
-
if valid_escape?
|
|
568
|
+
if valid_escape?(char + @s.peek)
|
|
571
569
|
value << consume_escaped
|
|
572
570
|
else
|
|
573
571
|
# Parse error.
|
data/lib/crass/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: crass
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Grove
|
|
@@ -52,6 +52,7 @@ files:
|
|
|
52
52
|
- LICENSE
|
|
53
53
|
- README.md
|
|
54
54
|
- Rakefile
|
|
55
|
+
- SECURITY.md
|
|
55
56
|
- crass.gemspec
|
|
56
57
|
- lib/crass.rb
|
|
57
58
|
- lib/crass/parser.rb
|
|
@@ -64,10 +65,10 @@ licenses:
|
|
|
64
65
|
- MIT
|
|
65
66
|
metadata:
|
|
66
67
|
bug_tracker_uri: https://github.com/rgrove/crass/issues
|
|
67
|
-
changelog_uri: https://github.com/rgrove/crass/blob/v1.0.
|
|
68
|
-
documentation_uri: https://www.rubydoc.info/gems/crass/1.0.
|
|
68
|
+
changelog_uri: https://github.com/rgrove/crass/blob/v1.0.8/HISTORY.md
|
|
69
|
+
documentation_uri: https://www.rubydoc.info/gems/crass/1.0.8
|
|
69
70
|
rubygems_mfa_required: 'true'
|
|
70
|
-
source_code_uri: https://github.com/rgrove/crass/tree/v1.0.
|
|
71
|
+
source_code_uri: https://github.com/rgrove/crass/tree/v1.0.8
|
|
71
72
|
rdoc_options: []
|
|
72
73
|
require_paths:
|
|
73
74
|
- lib
|
|
@@ -82,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
82
83
|
- !ruby/object:Gem::Version
|
|
83
84
|
version: '0'
|
|
84
85
|
requirements: []
|
|
85
|
-
rubygems_version: 4.0.
|
|
86
|
+
rubygems_version: 4.0.20
|
|
86
87
|
specification_version: 4
|
|
87
88
|
summary: CSS parser based on the CSS Syntax Level 3 spec.
|
|
88
89
|
test_files: []
|