hanami-view 3.0.1 → 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: cfd4f5b396df91cbef8969c45d2619115365a83856411998e92f9bf9ba35d027
4
- data.tar.gz: fd73d60f403a32f11a4261caf786dc33ba7f53c891edbf50dfcfe44f2445fb5c
3
+ metadata.gz: 6e17bf2dc1636043ee52953cc6d8e15bc68d728aa24f4fd7a1bf210ab48c261f
4
+ data.tar.gz: ace23a06ebffa95b535d89c0f2a1dec222cc1b204d34efe8a3a40e5c94329270
5
5
  SHA512:
6
- metadata.gz: c7958b7d98292e6595c0abde96ce7ba136d2ac75d2036d415668ded39a6a44435349b5fa6ea0bf87486e3a7c55ff54bce5be971a62bc7b70e5d2cad18dad4ff9
7
- data.tar.gz: 4baa7d74944594e1af1357ed042b1cae7cc1577200e026f9da575142ac199824dece54a67158bf1a3e1f1a698ac72774e01433d20052d306fa8d3a0a670d08e4
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,23 @@ 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.1...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
30
+
31
+ ## [3.0.2] - 2026-08-21
32
+
33
+ ### Fixed
34
+
35
+ - Ensure `Hanami::View::ERB::Engine` is still used for `.html.erb` templates with Tilt 2.9. (@timriley in #284)
36
+
37
+ [3.0.2]: https://github.com/hanami/view/compare/v3.0.1...v3.0.2
23
38
 
24
39
  ## [3.0.1] - 2026-08-14
25
40
 
@@ -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
  #
@@ -19,7 +19,15 @@ module Hanami
19
19
  # behavior.
20
20
  #
21
21
  # Unregistering first ensures our engines are always used, regardless of load order.
22
- mapping.unregister "erb", "rhtml", "haml", "slim"
22
+ #
23
+ # Tilt also matches the longest registered extension first (see `Tilt::Mapping#split`), and
24
+ # it registers "html.erb" as an extension of its own. So a template named "index.html.erb"
25
+ # would match "html.erb" and never reach the engine we register for "erb" below.
26
+ #
27
+ # We unregister "html.erb" without registering a replacement. This leaves Tilt to fall back
28
+ # to "erb", which means our own engine is used, and any `renderer_engine_mapping` given for
29
+ # `erb:` continues to work.
30
+ mapping.unregister "erb", "rhtml", "html.erb", "haml", "slim"
23
31
 
24
32
  # Register our own ERB template.
25
33
  mapping.register_lazy "Hanami::View::ERB::Template", "hanami/view/erb/template", "erb", "rhtml"
@@ -3,6 +3,6 @@
3
3
  module Hanami
4
4
  class View
5
5
  # @api public
6
- VERSION = "3.0.1"
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.1
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hanakai team