Skip to content

Commit f982769

Browse files
committed
feat: Disable callable serialization in sabre/xml
This a foot-gun that we are not using, so patching it out to make sure this never gets called. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent f7e5a0f commit f982769

4 files changed

Lines changed: 24 additions & 3 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/lib/Serializer/functions.php b/lib/Serializer/functions.php
2+
index 23f22d4c8..f05fdc406 100644
3+
--- a/lib/Serializer/functions.php
4+
+++ b/lib/Serializer/functions.php
5+
@@ -160,9 +160,6 @@ function standardSerializer(Writer $writer, $value)
6+
} elseif (is_object($value) && isset($writer->classMap[get_class($value)])) {
7+
// It's an object which class appears in the classmap.
8+
$writer->classMap[get_class($value)]($writer, $value);
9+
- } elseif (is_callable($value)) {
10+
- // A callback
11+
- $value($writer);
12+
} elseif (is_array($value) && array_key_exists('name', $value)) {
13+
// if the array had a 'name' element, we assume that this array
14+
// describes a 'name' and optionally 'attributes' and 'value'.

composer.patches.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"sabre/vobject": {
1111
"fix use RDATE in time range check and use all instances": ".patches/sabre-vobject-rdate.patch",
1212
"fix send participation reply on fresh event": ".patches/sabre-vobject-iTipBroker-replies.patch"
13+
},
14+
"sabre/xml": {
15+
"Remove callable serialization": ".patches/sabre-xml-remove-callable-serialization.patch"
1316
}
1417
}
1518
}

sabre/xml/PATCHES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)
2+
Patches applied to this directory:
3+
4+
Remove callable serialization
5+
Source: .patches/sabre-xml-remove-callable-serialization.patch
6+
7+

sabre/xml/lib/Serializer/functions.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ function standardSerializer(Writer $writer, $value)
160160
} elseif (is_object($value) && isset($writer->classMap[get_class($value)])) {
161161
// It's an object which class appears in the classmap.
162162
$writer->classMap[get_class($value)]($writer, $value);
163-
} elseif (is_callable($value)) {
164-
// A callback
165-
$value($writer);
166163
} elseif (is_array($value) && array_key_exists('name', $value)) {
167164
// if the array had a 'name' element, we assume that this array
168165
// describes a 'name' and optionally 'attributes' and 'value'.

0 commit comments

Comments
 (0)