details:   https://code.tryton.org/tryton/commit/6e643ef8cf15
branch:    8.2
user:      Cédric Krier <[email protected]>
date:      Tue Nov 24 10:45:09 2026 +0100
description:
        Enforce access rights when exporting resource data

        Closes #15264
        (grafted from 2bc10bed0aecfcb947ce03f869428b555f4a4cf1)
diffstat:

 trytond/CHANGELOG                      |  1 +
 trytond/trytond/ir/resource.py         |  5 +++++
 trytond/trytond/tests/test_resource.py |  2 ++
 3 files changed, 8 insertions(+), 0 deletions(-)

diffs (35 lines):

diff -r d871354cb630 -r 6e643ef8cf15 trytond/CHANGELOG
--- a/trytond/CHANGELOG Tue Nov 24 12:47:34 2026 +0100
+++ b/trytond/CHANGELOG Tue Nov 24 10:45:09 2026 +0100
@@ -1,3 +1,4 @@
+* Enforce access rights when exporting resource data (issue15264)
 * Forbid to read the user's reset password (issue15258)
 * Limit the decompressed size of request (issue15257)
 * Define the forbidden fields that cannot be set as preferences (issue15256)
diff -r d871354cb630 -r 6e643ef8cf15 trytond/trytond/ir/resource.py
--- a/trytond/trytond/ir/resource.py    Tue Nov 24 12:47:34 2026 +0100
+++ b/trytond/trytond/ir/resource.py    Tue Nov 24 10:45:09 2026 +0100
@@ -162,6 +162,11 @@
         cls.check_access([r.id for r in records], mode='create')
         return records
 
+    @classmethod
+    def export_data(cls, records, fields_names, header=False):
+        cls.check_access([r.id for r in records], mode='read')
+        return super().export_data(records, fields_names, header=header)
+
     def get_last_user(self, name):
         return (self.write_uid.rec_name if self.write_uid
             else self.create_uid.rec_name)
diff -r d871354cb630 -r 6e643ef8cf15 trytond/trytond/tests/test_resource.py
--- a/trytond/trytond/tests/test_resource.py    Tue Nov 24 12:47:34 2026 +0100
+++ b/trytond/trytond/tests/test_resource.py    Tue Nov 24 10:45:09 2026 +0100
@@ -225,6 +225,8 @@
                 Note.read([note.id], ['message'])
             with self.assertRaises(AccessError):
                 Note.delete([note])
+            with self.assertRaises(AccessError):
+                Note.export_data([note], ['message'])
 
     @with_transaction(context={'_check_access': True})
     def test_resource_search_with_access(self):

Reply via email to