forest_admin_agent 1.42.0 → 1.43.0
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/lib/forest_admin_agent/builder/agent_factory.rb +14 -0
- data/lib/forest_admin_agent/routes/capabilities/collections.rb +6 -1
- data/lib/forest_admin_agent/routes/charts/charts.rb +7 -2
- data/lib/forest_admin_agent/services/permissions.rb +10 -1
- data/lib/forest_admin_agent/utils/schema/schema_emitter.rb +1 -1
- data/lib/forest_admin_agent/version.rb +1 -1
- 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: 2646404b27c4b7c45446b93b09ea1b9f488e26b66760599122950fae26982027
|
|
4
|
+
data.tar.gz: a61f1f277ddaf461a4629727fb0958f0bd6290eb1e83cd62658d23ceb65de08c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b357902be6f9a8cfdd0ce5b74695911dd6d31cb7613c3e4bc93658a17691a6c8c7d02744271b15ecebf576e72bdb04c25836eef5ef45d9c234da4df97316d5c
|
|
7
|
+
data.tar.gz: d129a77b8b1b9fd9e2b96c1bcdb87b45f295062b3cdcab28be6b3975629ad5c3597fcdf4626bae67c2563d8975469129e01512460245900700131e2f05c6fbc0
|
|
@@ -27,6 +27,7 @@ module ForestAdminAgent
|
|
|
27
27
|
build_container
|
|
28
28
|
build_cache
|
|
29
29
|
build_logger
|
|
30
|
+
warn_relation_read_permissions_skipped
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
def add_datasource(datasource, options = {})
|
|
@@ -341,6 +342,19 @@ module ForestAdminAgent
|
|
|
341
342
|
Facades::Container.cache(:skip_schema_update) == true
|
|
342
343
|
end
|
|
343
344
|
|
|
345
|
+
# An auditor reading the boot log should see the weakened posture without reading the config.
|
|
346
|
+
# Read from the options `setup` was handed: `Facades::Container` resolves against
|
|
347
|
+
# `AgentFactory.instance`, which a host subclassing this factory has not populated.
|
|
348
|
+
def warn_relation_read_permissions_skipped
|
|
349
|
+
return unless @options.to_h[:skip_relation_read_permissions] == true
|
|
350
|
+
|
|
351
|
+
@logger.log(
|
|
352
|
+
'Warn',
|
|
353
|
+
'[ForestAdmin] skip_relation_read_permissions is true: columns of collections the caller ' \
|
|
354
|
+
'has no read permission on are served when a relation path reaches them'
|
|
355
|
+
)
|
|
356
|
+
end
|
|
357
|
+
|
|
344
358
|
def log_schema_skip
|
|
345
359
|
@logger.log('Warn', '[ForestAdmin] Schema update skipped (skip_schema_update flag is true)')
|
|
346
360
|
environment = Facades::Container.cache(:is_production) ? 'production' : 'development'
|
|
@@ -68,7 +68,8 @@ module ForestAdminAgent
|
|
|
68
68
|
canUseProjectionViaHeader: true,
|
|
69
69
|
canUseProjectionViaHeaderOnList: true,
|
|
70
70
|
canUseMultipleFieldsProjectionOnRelation: true,
|
|
71
|
-
canUseAuditTrail: audit_trail_enabled
|
|
71
|
+
canUseAuditTrail: audit_trail_enabled?,
|
|
72
|
+
checksRelationReadPermissions: !skip_relation_read_permissions?
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
75
|
status: 200
|
|
@@ -83,6 +84,10 @@ module ForestAdminAgent
|
|
|
83
84
|
def audit_trail_enabled?
|
|
84
85
|
!::ForestAdminAgent::AuditTrail.store.nil?
|
|
85
86
|
end
|
|
87
|
+
|
|
88
|
+
def skip_relation_read_permissions?
|
|
89
|
+
ForestAdminAgent::Facades::Container.config_from_cache[:skip_relation_read_permissions] == true
|
|
90
|
+
end
|
|
86
91
|
end
|
|
87
92
|
end
|
|
88
93
|
end
|
|
@@ -55,6 +55,10 @@ module ForestAdminAgent
|
|
|
55
55
|
field.nil? || field.to_s.empty? ? nil : field
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
def skip_relation_read_permissions?
|
|
59
|
+
ForestAdminAgent::Facades::Container.config_from_cache[:skip_relation_read_permissions] == true
|
|
60
|
+
end
|
|
61
|
+
|
|
58
62
|
def validate_and_get_type(type)
|
|
59
63
|
chart_types = %w[Value Objective Pie Line Leaderboard]
|
|
60
64
|
unless chart_types.include?(type)
|
|
@@ -202,8 +206,9 @@ module ForestAdminAgent
|
|
|
202
206
|
)
|
|
203
207
|
|
|
204
208
|
# A count exposes the cardinality of the relation, which `/relationships/<name>/count`
|
|
205
|
-
# puts behind `browse`. No path names it, so nothing above sees it.
|
|
206
|
-
|
|
209
|
+
# puts behind `browse`. No path names it, so nothing above sees it. It arrived with the
|
|
210
|
+
# related-read checks, so it goes away with them.
|
|
211
|
+
if aggregation.field.nil? && !skip_relation_read_permissions?
|
|
207
212
|
context.permissions.can?(:browse, context.datasource.get_collection(field.foreign_collection))
|
|
208
213
|
end
|
|
209
214
|
|
|
@@ -66,7 +66,10 @@ module ForestAdminAgent
|
|
|
66
66
|
|
|
67
67
|
# An absent permission system is not a denial: `can?` allows everything there, and answering
|
|
68
68
|
# anything else would redact every relation on a deployment that granted nothing to check.
|
|
69
|
-
|
|
69
|
+
# `skip_relation_read_permissions` is the operator asking for that same answer on purpose.
|
|
70
|
+
if skip_relation_read_permissions? || !permission_system?
|
|
71
|
+
return allowed.merge(to_check.to_h { |name| [name, true] })
|
|
72
|
+
end
|
|
70
73
|
|
|
71
74
|
@read_permissions ||= {}
|
|
72
75
|
missing = to_check - @read_permissions.keys
|
|
@@ -273,6 +276,10 @@ module ForestAdminAgent
|
|
|
273
276
|
names.any? && names.all? { |name| allowed[name] }
|
|
274
277
|
end
|
|
275
278
|
|
|
279
|
+
def skip_relation_read_permissions?
|
|
280
|
+
Facades::Container.config_from_cache[:skip_relation_read_permissions] == true
|
|
281
|
+
end
|
|
282
|
+
|
|
276
283
|
def leaf_label(names)
|
|
277
284
|
names.empty? ? 'an unresolved polymorphic relation' : "the '#{names.join("' or '")}' collection"
|
|
278
285
|
end
|
|
@@ -356,6 +363,8 @@ module ForestAdminAgent
|
|
|
356
363
|
return unless search_extended
|
|
357
364
|
return unless describes_own_search?(collection)
|
|
358
365
|
return unless permission_system?
|
|
366
|
+
# Refused ahead of `read_permissions`, so the skip has to be read here as well.
|
|
367
|
+
return if skip_relation_read_permissions?
|
|
359
368
|
|
|
360
369
|
raise ForbiddenError,
|
|
361
370
|
"You cannot run an extended search on the '#{collection.name}' collection: the fields " \
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_agent
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.43.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthieu
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-09-
|
|
12
|
+
date: 2026-09-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|