hanami-view 3.0.2 → 3.0.3

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: 3b270d38aebea10944584306a2d98739fee992ee7614d7d1044a0354d2ace9d2
4
- data.tar.gz: d4b9ce9f19b22f56d6d69c1b0b07473ba2f216c32b9acefba37bb8eea161c6c4
3
+ metadata.gz: 6e17bf2dc1636043ee52953cc6d8e15bc68d728aa24f4fd7a1bf210ab48c261f
4
+ data.tar.gz: ace23a06ebffa95b535d89c0f2a1dec222cc1b204d34efe8a3a40e5c94329270
5
5
  SHA512:
6
- metadata.gz: 210a3403a40ae0b5f0dc9280bb8730f1c01645e0de3a4558a9f8d9426e6c58e187950925999cd69bc5271e003ed59f444acaddeceb22f488d58ae6eaf796b9b6
7
- data.tar.gz: c7d8a0a6093ecdb535ffe862e2ff02e6ebbddd7a6ca072044a20a4064fb91c0c3f30f6fdfe66a94237195c1dec61097b3ec13f1f7a465d2c203bd817c470040b
6
+ metadata.gz: 436553597576e12218db803ffcb649f2e5189ac49363f2be69e8c0a36c4e34f5e808ae677ed37564784b5bf54d10382880265b2eb1faf9dc804f34c119946394
7
+ data.tar.gz: bcbdfaf11b26fc9c915a02988927ceddc76e3ae1908de79dd9d5a7166476bfeb01940711f98dfeab6803d4974b6d9d7ef15e40292631ce2784e8fe2710eb988c
data/CHANGELOG.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
7
6
 
8
7
  ## [Unreleased]
9
8
 
@@ -19,7 +18,15 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
19
18
 
20
19
  ### Security
21
20
 
22
- [Unreleased]: https://github.com/hanami/view/compare/v3.0.2...HEAD
21
+ [Unreleased]: https://github.com/hanami/view/compare/v3.0.3...HEAD
22
+
23
+ ## [3.0.3] - 2026-11-24
24
+
25
+ ### Security
26
+
27
+ - Percent-encode quotes, backticks, angle brackets and spaces in the result of `sanitize_url`. Previously a decoded `'` was returned as-is in an HTML-safe string, breaking out of single-quoted attributes. (@parndt in GHSA-4g74-pv6p-g8hw)
28
+
29
+ [3.0.3]: https://github.com/hanami/view/compare/v3.0.2...v3.0.3
23
30
 
24
31
  ## [3.0.2] - 2026-08-21
25
32
 
@@ -120,12 +120,19 @@ module Hanami
120
120
  def sanitize_url(input, permitted_schemes = PERMITTED_URL_SCHEMES)
121
121
  return input if input.html_safe?
122
122
 
123
- URI_PARSER.extract(
123
+ url = URI_PARSER.extract(
124
124
  URI.decode_www_form_component(input.to_s),
125
125
  permitted_schemes
126
- ).first.to_s.html_safe
126
+ ).first.to_s
127
+
128
+ # Percent-encode characters that can end an HTML attribute. None of them may appear
129
+ # unencoded in a valid URI, so well-formed URLs are unchanged.
130
+ url.gsub(UNSAFE_URL_CHARS) { |char| format("%%%02X", char.ord) }.html_safe
127
131
  end
128
132
 
133
+ UNSAFE_URL_CHARS = /['"`<> ]/
134
+ private_constant :UNSAFE_URL_CHARS
135
+
129
136
  # Use the RFC2396_PARSER if available. Modern Rubies should have RFC2396_PARSER available.
130
137
  # Otherwise, fall back to the DEFAULT_PARSER (which may still raise deprecation warnings).
131
138
  #
@@ -3,6 +3,6 @@
3
3
  module Hanami
4
4
  class View
5
5
  # @api public
6
- VERSION = "3.0.2"
6
+ VERSION = "3.0.3"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-view
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hanakai team