jpie 4.1.8 → 4.1.9
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: 315aaaaed71bdf4807a63a407205327316ad7739e269c1179a27e0d801b51483
|
|
4
|
+
data.tar.gz: 829e98cab64b8b6794a3fa389f62d1a179746685f2af3803efd40e215e15024e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa206b22a633084e2b8585bcc1f7154e6753bb9f46cd2439b703df8451eb51e2de7db1fc70120fa65f1c7293054d751f6ea5694f7e247ded43f1b6cc33250629
|
|
7
|
+
data.tar.gz: 025d1cef8a720347a0f453f5ec2c73c785c276996b92574f1785bed0316b22d77c9077b5aaa24dad78ceb08b0bdda4465ffb242eb9f0c99e6cb5053e62863e8b
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ at release time.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.1.9] - 2026-11-20
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **Refuse a write body that names a hidden target.** In 4.1.8 a write body that
|
|
15
|
+
named a target hidden by `authorization_scope` set the key to nil. An update
|
|
16
|
+
then cleared the stored relationship and answered 200. The write now stops
|
|
17
|
+
with 400, as a relationship route does for a hidden target or a missing
|
|
18
|
+
target. Regression spec: `authorization_scope_body_write_target_spec.rb`.
|
|
19
|
+
|
|
10
20
|
## [4.1.8] - 2026-11-20
|
|
11
21
|
|
|
12
22
|
### Fixed
|
|
@@ -64,7 +64,7 @@ module JSONAPI
|
|
|
64
64
|
target = model_class || self.model_class
|
|
65
65
|
payload = data.nil? ? raw_jsonapi_data : symbolize_data(data)
|
|
66
66
|
attrs = JSONAPI::Deserializer.new(payload, model_class: target, action:, definition:).to_model_attributes
|
|
67
|
-
JSONAPI::ResourceIdentifier.
|
|
67
|
+
JSONAPI::ResourceIdentifier.reject_hidden_targets(attrs, target, self)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
def resource_url(resource)
|
|
@@ -35,16 +35,18 @@ module JSONAPI
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# A write body assigns the raw foreign key and leaves the lookup to the model. A target the
|
|
38
|
-
# caller's scope hides must
|
|
39
|
-
#
|
|
40
|
-
def
|
|
38
|
+
# caller's scope hides must fail like a target that does not exist, as it does on a
|
|
39
|
+
# relationship route. The write stops, so it never clears the stored relationship.
|
|
40
|
+
def reject_hidden_targets(attrs, model_class, controller)
|
|
41
41
|
return attrs unless controller && JSONAPI.configuration.authorization_scope
|
|
42
42
|
|
|
43
43
|
model_class.reflect_on_all_associations(:belongs_to).each do |association|
|
|
44
44
|
next if association.polymorphic?
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
id = attrs[association.foreign_key.to_s]
|
|
47
|
+
next if id.nil? || visible_target?(association, id, controller)
|
|
48
|
+
|
|
49
|
+
raise ArgumentError, "Related resource not found: #{association.name} with id #{id}"
|
|
48
50
|
end
|
|
49
51
|
attrs
|
|
50
52
|
end
|
data/lib/json_api/version.rb
CHANGED