-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OP#51321]fix: Virus infected File is not removed by background job when integration app is enabled #527
Conversation
9da5eae
to
144e419
Compare
$currentUser = $this->userSession->getUser(); | ||
// we do not listen event where user is not logged or there is no user session (e.g. public link ) | ||
if (OC_User::isIncognitoMode()) { | ||
// or if it's some background job in which case user will be null | ||
if (OC_User::isIncognitoMode() || $currentUser === null) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked if the user is null and if the user is null then it's a "background job " . I couldn't find a way to determine if we can know an event is triggered by a background job. @julien-nc would you have any suggestion on if I can determine that a task is done by background job?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't really know if you're in a background job or in an occ command. I think your check makes sense, it covers both bg job and occ command cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good to me.
@wielinde can you ask the people who reported the issue in the first place to test this fix?
Hey @Rello, could you please verify that this PR solves the problem? Thank you! |
144e419
to
246e329
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
will test today... |
@SwikritiT just tested and confirmed working 👍🏻 |
Thank you @Rello! Much apreciated. Now, that this is fixed, please allow me this little comment: Nextcloud could really benefit from a concept that some objects, such as files, folders, groups, users, group folders are owned by an application and can get protected from getting deleted or modified by somebody else. Then, we would not need to hook into every deletion every file, folder, group and user in order to prevent them from being deleted by some uninformed admin. And still a app could use those objects for creating cool work flow optimization such as our project folder concept. |
…ation app is enabled Signed-off-by: Swikriti Tripathi <swikriti808@gmail.com>
246e329
to
e07cc27
Compare
JS Code CoverageCoverage after merging bug/51321-file-is-not-removed-by-background-job-when-integration-app-is-enabled into release/2.4 will be
Coverage Report
|
Hallo @wielinde |
Description
We have a hook to protect the deletion of the folders inside the
OpenProject
groupfolder and to do so we intercept each deletion request to check if the node is inside ofOpenProject
groupfolder. We expect the user to have a user session but in case of background jobs doing some cleanup jobs there's no user session. In the case where the files antivirus is trying to scan the files and remove any virus infected file our app didn't allow the deletion of such files.In this PR we check if the user is
null
and the user is returnednull
we assume that it's a background job and return without performing further operationRelated Issues: