jekyll-client-search 0.3.0 → 0.3.1

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: ed1c7a635cc419d9fb130411ced8e64a473c016e8188e36ddd98ea6922a098f7
4
- data.tar.gz: f320844ded59274df991b1aa3d56fb22560e818105c5a0e682ea6e6a0c67df88
3
+ metadata.gz: 1d3574c3adc2e2e00dd76ef5b5011358fcb9abfe3ed0cfbd372dffee00f913fc
4
+ data.tar.gz: 76f691ec62695d6e99677bc952fe85ae07c477df563f83b29f063a58f5b0d8c0
5
5
  SHA512:
6
- metadata.gz: a12fb0052f9a727baf957735cd23fc9759f46fe7b54977acd16ed63edb14b0d63e2594d3c2bee936c9317541f8810a654acf7a5369746c9d11c39699457cf351
7
- data.tar.gz: 46986b4c1a0107821f6932d8538c1aff0fcc386ddb9e9f787a4890da5f8af3ccd30a8c0b6b9257d928d3b52aa6fe625806136812cfbf781763a0f3a391cf9aa6
6
+ metadata.gz: 23b5534d2c60626e5ee068687f2c4313f6e7494f1e382b89928f37b3eaf50fad3f979808e696c6a2bf3d17a5a00764674667b9f8f4041b4fc6f73a71953fcee7
7
+ data.tar.gz: 9403f90fd84ee7798fa07281001faf534028247e2f99aea46a9a305b8c3ac57191ae0059cb49ca8eb377b1ba7633b5960f3c481bc24e0cc6de872d30132b3521
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.3.1 — 2026-09-09
6
+
7
+ ### Fixed
8
+ - Fix CodeQL `rb/bad-tag-filter` (high) in `DocumentBuilder#clean` — closing tag regex `</script\s*>` only matched whitespace before `>`, missing browser-accepted tags like `</script\t\n bar>`; changed to `</script[^>]*>` and `</style[^>]*>` to match any non-`>` content
9
+ - Fix CodeQL `rb/polynomial-redos` (high) in `RelatedTag` — `\s*` patterns between optional groups in SYNTAX regex caused O(n²) backtracking on input with many spaces; replaced single regex with token-split parser that validates each token individually
10
+
11
+ ### Changed
12
+ - Update `simplecov` 1.1.1 → 1.2.0
13
+ - Update `google-protobuf` 4.36.0 → 4.36.1 (transitive)
14
+ - Update `sass-embedded` 1.103.1 → 1.104.0 (transitive)
15
+ - Update `eslint` 10.9.1 → 10.10.0 (dev)
16
+ - Update `globals` 17.11.0 → 17.12.0 (dev)
17
+
5
18
  ## 0.3.0 — 2026-09-02
6
19
 
7
20
  ### Added
@@ -67,8 +67,8 @@ module Jekyll
67
67
 
68
68
  def clean(value)
69
69
  cleaned = value.to_s
70
- .gsub(%r{<script\b[^>]*>.*?</script\s*>}mi, " ")
71
- .gsub(%r{<style\b[^>]*>.*?</style\s*>}mi, " ")
70
+ .gsub(%r{<script\b[^>]*>.*?</script[^>]*>}mi, " ")
71
+ .gsub(%r{<style\b[^>]*>.*?</style[^>]*>}mi, " ")
72
72
  .gsub(/\{%.*?%\}/m, " ")
73
73
  .gsub(/\{\{.*?\}\}/m, " ")
74
74
  .gsub(/!\[[^\]]*\]\([^)]*\)/, " ")
@@ -14,23 +14,39 @@ module Jekyll
14
14
  # When +related.enabled+ is false the tag renders nothing, so it is safe
15
15
  # to leave in a layout even when the feature is off.
16
16
  class RelatedTag < Liquid::Tag
17
- SYNTAX = /\A(sort:(\w+))?\s*(max:(\d+))?\s*(no_scripts)?\z/
17
+ TOKEN_SYNTAX = /\A(sort:\w+|max:\d+|no_scripts)\z/
18
18
 
19
19
  def initialize(tag_name, markup, tokens)
20
20
  super
21
21
  @markup = markup.to_s.strip
22
- unless (match = @markup.match(SYNTAX))
23
- raise Liquid::SyntaxError,
24
- "related_articles: invalid syntax. Use {% related_articles %}, " \
25
- "{% related_articles sort:date %}, {% related_articles max:3 %}, " \
26
- "or {% related_articles no_scripts %}"
27
- end
22
+ parse_tokens(@markup)
23
+ end
24
+
25
+ def parse_tokens(markup)
26
+ @sort = nil
27
+ @max_items = nil
28
+ @include_scripts = true
29
+ return if markup.empty?
30
+
31
+ markup.split(/\s+/).each { |token| apply_token(token) }
32
+ end
33
+
34
+ def apply_token(token)
35
+ raise Liquid::SyntaxError, syntax_error_msg unless token.match(TOKEN_SYNTAX)
28
36
 
29
- @sort = match[2] if match[2]
30
- @max_items = match[4].to_i if match[4]
31
- raise Liquid::SyntaxError, "related_articles: max must be greater than zero" if @max_items && @max_items < 1
37
+ case token
38
+ when /\Asort:(\w+)\z/ then @sort = Regexp.last_match(1)
39
+ when /\Amax:(\d+)\z/
40
+ @max_items = Regexp.last_match(1).to_i
41
+ raise Liquid::SyntaxError, "related_articles: max must be greater than zero" if @max_items < 1
42
+ when "no_scripts" then @include_scripts = false
43
+ end
44
+ end
32
45
 
33
- @include_scripts = match[5].nil?
46
+ def syntax_error_msg
47
+ "related_articles: invalid syntax. Use {% related_articles %}, " \
48
+ "{% related_articles sort:date %}, {% related_articles max:3 %}, " \
49
+ "or {% related_articles no_scripts %}"
34
50
  end
35
51
 
36
52
  def render(context)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module ClientSearch
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-client-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svend Gundestrup