Skip to content

Commit 0ee03e9

Browse files
committed
REST API: 403 on non-searchable properties
issue2551051: Return a 403 on non-existing or non-searchable transitive properties when queried via REST-API (same behavior for sorting and searching).
1 parent 302c867 commit 0ee03e9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ Fixed:
9595
template. (Christof Meerwald)
9696
- issue2551019 - handle character set conversions for CSV export
9797
action in Python 3. (Christof Meerwald)
98+
- issue2551051: Return a 403 on non-existing or non-searchable
99+
transitive properties when queried via REST-API (same behavior for
100+
sorting and searching).
98101

99102
2019-10-23 2.0.0 alpha 0
100103

roundup/rest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,10 @@ def get_collection(self, class_name, input):
696696
uid, class_name, pn
697697
):
698698
sort.append((ss, pn))
699+
else :
700+
raise (Unauthorised (
701+
'User does not have search permission on "%s.%s"'
702+
% (class_name, pn)))
699703
elif key.startswith("@"):
700704
# ignore any unsupported/previously handled control key
701705
# like @apiver
@@ -721,7 +725,9 @@ def get_collection(self, class_name, input):
721725
if not self.db.security.hasSearchPermission(
722726
uid, class_name, key
723727
):
724-
continue
728+
raise (Unauthorised (
729+
'User does not have search permission on "%s.%s"'
730+
% (class_name, key)))
725731

726732
linkcls = class_obj
727733
for p in key.split('.'):

0 commit comments

Comments
 (0)