medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
469 stars 217 forks source link

Different task owner and task user causing task to appear for other users #8193

Open 1yuv opened 1 year ago

1yuv commented 1 year ago

Describe the bug We've seen users reporting that tasks that were not generated for them are appearing. In other way, tasks generated for one CHT user were appearing for another CHT user. Upon checking, it was observed that, there is different user in _id key's user section and user key's value for those tasks document and different users.

These are the two issues logged in these instances with more detail.

Expected behavior Tasks should only be created and appeared for the CHT user for which they're owner.

Environment

dianabarsan commented 1 year ago

I've checked the edit history for one of the instances (NSSD) and found that:

We tried inspecting the audit trail to check the author of the original edit, but found nothing, possibly because of haproxy logs being truncated.

1yuv commented 1 year ago

Hi @dianabarsan , Is there an idea of what could be those something factors? Also, I was following up on this issue to check if the task got created for right contact after 7 days, it appears that task got created for wrong user. I've filed an issue #8203 for that.

dianabarsan commented 1 year ago

I just tried pushing a task documents from different users to another user:

I'll try some more things, but for now I think it's unlikely that the tasks made it to the user's devices via replication (incorrectly) and got edited locally and changed user.