Skip to content

fix(caldav): harden null handling of iMip scheduling method - #36935

Merged
st3iny merged 1 commit into
masterfrom
fix/noid/imip-plugin-null-hardening
Mar 2, 2023
Merged

fix(caldav): harden null handling of iMip scheduling method#36935
st3iny merged 1 commit into
masterfrom
fix/noid/imip-plugin-null-hardening

Conversation

@st3iny

@st3inyst3iny commented Mar 1, 2023

Copy link
Copy Markdown
Member

Summary

The schedule() method of the iMip plugin poorly handles various null values. I hardened it a bit to prevent further breakage in the future.

This PR can be tested using the following patch:

diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
index ca79205c09f..8c4507b0870 100644
--- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php+++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php@@ -209,6 +209,9 @@ class IMipPlugin extends SabreIMipPlugin {
$senderName = $senderName->getValue() ?? null;
}
+ $senderName = null;+ $this->userId = null;+
// Try to get the sender name from the current user id if available.
if ($this->userId !== null && ($senderName === null || empty(trim($senderName)))) {
$senderName = $this->userManager->getDisplayName($this->userId);

TODO

Checklist

@st3inyst3iny added bug 3. to review Waiting for reviews feature: caldav Related to CalDAV internals labels Mar 1, 2023
@st3inyst3iny added this to the Nextcloud 26 milestone Mar 1, 2023
@st3inyst3iny self-assigned this Mar 1, 2023
@st3iny
st3inyforce-pushed the fix/noid/imip-plugin-null-hardening branch 2 times, most recently from 26a906b to 5a47ed6CompareMarch 1, 2023 12:42
@nickvergessen

Copy link
Copy Markdown
Member
./autotest.sh sqlite apps/dav/tests/unit/CalDAV/Schedule/
Using PHP executable /usr/bin/php
Using database oc_autotest
Setup environment for sqlite testing on local storage ...
0 Pfade vom Index aktualisiert
Installing ....
Nextcloud was successfully installed
Testing with sqlite ...
No coverage
/home/nickv/Tools/vendor/bin/phpunit --configuration phpunit-autotest.xml --log-junit autotest-results-sqlite.xml ../apps/dav/tests/unit/CalDAV/Schedule/ PHPUnit 9.6.0 by Sebastian Bergmann and contributors.
Runtime: PHP 8.0.28
Configuration: phpunit-autotest.xml
.............................. 30 / 30 (100%)
Time: 00:00.085, Memory: 34.00 MB
OK (30 tests, 128 assertions)

Could we extend the tests?

@st3iny

Copy link
Copy Markdown
MemberAuthor

/rebase

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
@nextcloud-command
nextcloud-commandforce-pushed the fix/noid/imip-plugin-null-hardening branch from 5a47ed6 to a35b960CompareMarch 2, 2023 09:42
@st3iny
st3iny enabled auto-merge March 2, 2023 10:22
@st3iny
st3iny merged commit 7a020b1 into masterMar 2, 2023
@st3iny
st3iny deleted the fix/noid/imip-plugin-null-hardening branch March 2, 2023 11:28
@kesselb

Copy link
Copy Markdown
Contributor

/backport to stable25

@backportbot-nextcloud

Copy link
Copy Markdown

The backport to stable25 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable25
git pull origin stable25
# Create the new backport branch
git checkout -b fix/foo-stable25
# Cherry pick the change from the commit sha1 of the change against the default branch# This might cause conflicts. Resolve them.
git cherry-pick abc123
# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable25

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@kesselb

Copy link
Copy Markdown
Contributor

Backport for stable25: #39591

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbugfeature: caldavRelated to CalDAV internals

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants

@st3iny@nickvergessen@kesselb@ChristophWurst