glib-web 5.1.1 → 5.1.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 54f283b08cba85e7935323705254ff4c53831314f87a71661f11761d4be37544
|
|
4
|
+
data.tar.gz: df856aaa88383c8e54384d8d0a6ed81536f5457efc0b523d1cf5dba0ef558a9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4011507ec92ac5666c5af93ef6b7cca59444fdae226b20a805a2582e1710138b9839ed0f430ca585b7fb3f2120d1d541a0120c61655347defa7b90344d631eb
|
|
7
|
+
data.tar.gz: 548c0fcd1edb93c05f846acf93114b818127ccb5e3e5c8f1c65dad2c195ba8e9b66ca12d2aef37344c622d321ad9b799d1794bcc9314f7f524db7840194f6ecf
|
|
@@ -101,7 +101,16 @@ module Glib::Auth
|
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
resource_instance = instance_variable_get("@#{resource_name}")
|
|
104
|
+
resource_instance = instance_variable_get("@#{resource_name}")
|
|
105
|
+
if resource_instance.nil?
|
|
106
|
+
# An explicitly supplied `resource:` is authoritative even when nil (e.g. a scoped
|
|
107
|
+
# `find_by` that resolved nothing). Falling back to the policy-name symbol would hand
|
|
108
|
+
# the policy a truthy placeholder in place of the missing record, so record-bound gates
|
|
109
|
+
# (`record.present?`, `return false unless record`) would pass for exactly the request
|
|
110
|
+
# they exist to refuse -- fail-open. Pass the nil through so they fail closed. The
|
|
111
|
+
# symbol fallback remains for callers that don't supply `resource:` at all.
|
|
112
|
+
resource_instance = options.key?(:resource) ? options[:resource] : policy_name
|
|
113
|
+
end
|
|
105
114
|
|
|
106
115
|
query = "#{action_name}?"
|
|
107
116
|
policy_instance = policy(resource_instance, policy_name, options.fetch(:context, nil))
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Glib::Params
|
|
2
|
+
module Allowlist
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
# Resolve a stringly-typed request param (or any boundary string) to one
|
|
6
|
+
# symbol drawn from a closed allow-list (+allowed_symbols+), returning
|
|
7
|
+
# +default+ when the value is missing, blank, or not recognised.
|
|
8
|
+
#
|
|
9
|
+
# This is the symbol-DoS-safe replacement for `params[:x].to_sym`. A bare
|
|
10
|
+
# `.to_sym` on a raw value mints a symbol for every distinct string a client
|
|
11
|
+
# sends, including values you intend to reject on the next line, the classic
|
|
12
|
+
# symbol-DoS vector. This only ever returns a symbol already present in
|
|
13
|
+
# +allowed_symbols+ (or +default+), so attacker input can never create a new
|
|
14
|
+
# symbol regardless of what is sent.
|
|
15
|
+
#
|
|
16
|
+
# nil / "" fall through to +default+ implicitly (no symbol's string form is
|
|
17
|
+
# blank). Use it for any closed-vocabulary boundary input: interval
|
|
18
|
+
# selectors, status filters, UTM tags, feature-flag names.
|
|
19
|
+
#
|
|
20
|
+
# +allowed_symbols+ may also contain strings (e.g. a Rails enum's `.keys`)
|
|
21
|
+
# — the matched entry is symbolized on the way out, so the return value is
|
|
22
|
+
# ALWAYS a symbol (or +default+). That `to_sym` runs only on the
|
|
23
|
+
# developer-controlled list entry, never on +value+, so the DoS-safety
|
|
24
|
+
# above is unaffected.
|
|
25
|
+
def glib_allowlist_symbol_param(value, allowed_symbols, default:)
|
|
26
|
+
allowed_symbols.find { |symbol| symbol.to_s == value.to_s }&.to_sym || default
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: glib-web
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.1.
|
|
4
|
+
version: 5.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ''
|
|
@@ -170,6 +170,7 @@ files:
|
|
|
170
170
|
- app/controllers/concerns/glib/json/traversal.rb
|
|
171
171
|
- app/controllers/concerns/glib/json/ui.rb
|
|
172
172
|
- app/controllers/concerns/glib/json/validation.rb
|
|
173
|
+
- app/controllers/concerns/glib/params/allowlist.rb
|
|
173
174
|
- app/controllers/glib/blob_url_generators_controller.rb
|
|
174
175
|
- app/controllers/glib/errors_controller.rb
|
|
175
176
|
- app/controllers/glib/glib_direct_uploads_controller.rb
|