bullet 8.0.4 → 8.0.5
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/CHANGELOG.md +6 -1
- data/lib/bullet/rack.rb +12 -8
- data/lib/bullet/version.rb +1 -1
- data/lib/bullet.rb +7 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 257c8bc067513839f2adb33e6630d62c3b92d6cd7cbdc3656b01349cfc385e20
|
4
|
+
data.tar.gz: 131c0be29b73f72d828eaf3825ab37bd2dda9e8880228f3f2b467589fb9dd080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe1cfd7baac8c98b3937e7c32a9b54e73446275371501e47f151bd8ec51c95089bb959280419204d33f4a7fffbb0c46bf6d403c03cefe188ab8c02e8de7c5bf4
|
7
|
+
data.tar.gz: 8290a945d4ee31300b46ddc622845dc63b1ae33172331e20a4a2ef6b6b7f597766afb4e1c3632225b5de6a6c09c8e7b13fb6b42e69f7fe8148cb76af28ab5f59
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
## Next Release
|
2
2
|
|
3
|
-
## 8.0.
|
3
|
+
## 8.0.5 (04/21/2025)
|
4
|
+
|
5
|
+
* Properly insert ContentSecurityPolicy middleware
|
6
|
+
* Properly parse query string
|
7
|
+
|
8
|
+
## 8.0.4 (04/18/2025)
|
4
9
|
|
5
10
|
* Insert bullet middleware before `ContentSecurityPolicy`
|
6
11
|
* Support url query `skip_html_injection=true`
|
data/lib/bullet/rack.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'rack/request'
|
4
4
|
require 'json'
|
5
|
+
require 'cgi'
|
5
6
|
|
6
7
|
module Bullet
|
7
8
|
class Rack
|
@@ -85,17 +86,20 @@ module Bullet
|
|
85
86
|
query_string = request.env['QUERY_STRING']
|
86
87
|
return false if query_string.nil? || query_string.empty?
|
87
88
|
|
88
|
-
|
89
|
-
parser = Rack::QueryParser.new
|
90
|
-
params = parser.parse_nested_query(query_string)
|
91
|
-
else
|
92
|
-
# compatible with rack 1.x,
|
93
|
-
# remove it after dropping rails 4.2 suppport
|
94
|
-
params = Rack::Utils.parse_nested_query(query_string)
|
95
|
-
end
|
89
|
+
params = simple_parse_query_string(query_string)
|
96
90
|
params['skip_html_injection'] == 'true'
|
97
91
|
end
|
98
92
|
|
93
|
+
# Simple query string parser
|
94
|
+
def simple_parse_query_string(query_string)
|
95
|
+
params = {}
|
96
|
+
query_string.split('&').each do |pair|
|
97
|
+
key, value = pair.split('=', 2).map { |s| CGI.unescape(s) }
|
98
|
+
params[key] = value if key && !key.empty?
|
99
|
+
end
|
100
|
+
params
|
101
|
+
end
|
102
|
+
|
99
103
|
def file?(headers)
|
100
104
|
headers['Content-Transfer-Encoding'] == 'binary' || headers['Content-Disposition']
|
101
105
|
end
|
data/lib/bullet/version.rb
CHANGED
data/lib/bullet.rb
CHANGED
@@ -23,11 +23,14 @@ module Bullet
|
|
23
23
|
|
24
24
|
if defined?(Rails::Railtie)
|
25
25
|
class BulletRailtie < Rails::Railtie
|
26
|
-
initializer 'bullet.
|
27
|
-
if
|
28
|
-
|
29
|
-
|
26
|
+
initializer 'bullet.add_middleware' do |app|
|
27
|
+
# I don't find a way to detect if the middleware is already in the stack,
|
28
|
+
# so I'm using the api_only flag.
|
29
|
+
# If it is true, ActionDispatch::ContentSecurityPolicy::Middleware is not in the stack.
|
30
|
+
if app.config.api_only || !defined?(ActionDispatch::ContentSecurityPolicy::Middleware)
|
30
31
|
app.middleware.use Bullet::Rack
|
32
|
+
else
|
33
|
+
app.middleware.insert_before ActionDispatch::ContentSecurityPolicy::Middleware, Bullet::Rack
|
31
34
|
end
|
32
35
|
end
|
33
36
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-21 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|