ananthakumaran / paisa

Paisa – Personal Finance Manager. https://paisa.fyi demo: https://demo.paisa.fyi
https://paisa.fyi
GNU Affero General Public License v3.0
2.34k stars 117 forks source link

Main config is stored in 'Documents' on Windows, a protected folder when Ransomware protection is enabled. #115

Open vishalnandagopal opened 8 months ago

vishalnandagopal commented 8 months ago

Describe your Environment OS: Windows 11 Paisa Version: 0.5.7 App Variant: Desktop

Describe the bug The paisa app allows users to store their journal and db in custom paths. However, it still stores the initial config (paisa.yaml) in C:\Users\username\Documents\paisa , which it cannot write to if the user has enabled ransomware protection in Windows Defender.

I know that most users are not affected by it, but since ransomware protection is a security feature built into Windows, Paisa should ideally be a app that does not need any special write access to protected folders.

Paisa should try to store configuration files (like paisa.yaml) in the C:\Users\username\AppData\Local or at least ProgramFiles on Windows, since this is where apps are expected to store data.

To Reproduce Steps to reproduce the behavior:

  1. Enable ransomware protection (a built in feature in Windows Defender)
  2. Try to make changes to config
  3. Paisa cannot save the changes

Expected behavior Paisa should not be storing config files in folders which Windows considers as protected by default. It is also not possible to remove the Documents folder from ransomware protection, so disabling it or letting Paisa through is the only option.

Screenshots image

vishalnandagopal commented 8 months ago

Current workaround is to set PAISA_CONFIG env variable, but ideally paisa should default to storing it in an expected and familiar folder, where most apps store their data.

ananthakumaran commented 8 months ago

Thanks for reporting, I didn't know about this issue. I keep the config file in the documents folder because it stores things like import templates etc, losing it would be very bad. Documents folder would also be more visible and easy to backup.

Let me see if I can do something about the issue.

vishalnandagopal commented 8 months ago

I think paisa_config is not something the user backups a lot, the ledger is way more important.

ananthakumaran commented 6 months ago

@maacl There is a workaround available for this, you can set the PAISA_CONFIG environment variable and paisa will look there, you can check the configuration docs. I still believe the problem is because Paisa is not a signed application, Microsoft is classifying it as an unfriendly application. I consider the ledger journals as documents and the document folder is the ideal fit. But that said, let me think through it and see if a fallback can be added if document folder is not accessible.

vishalnandagopal commented 6 months ago

I still believe the problem is because Paisa is not a signed application, Microsoft is classifying it as an unfriendly application

@ananthakumaran , the problem will not be solved even if Paisa is a signed app. Windows does not allow anyone to create/edit files in protected folders, unless the user themselves whitelists the app and gives them access to all protected folders. In fact, you have to even whitelist explorer.exe, the Windows Explorer to create files/folders in protected folders.

Documents folder is not something that the user can remove from protection. It is added by default and cannot be removed.

I have seen other signed apps like 7z, peazip, VSCode, etc have issues with Documents folder, so it is not something a signing certificate will solve.

I consider the ledger journals as documents and the document folder is the ideal fit.

Hey, I agree. The documents folder would be the ideal default fit for the ledger, since it is supposed to be exposed to the user. However, the problem is with paisa.yaml here. It should store internal config files in the Windows AppData folder.

It can be opened by a button in the app itself, such as "Open config". This way, you can open the config and change the path for the ledger and the other stuff. However, the location of the config file remains unchanged.

Other apps that follow this:

  1. VSCode settings.json, it's config file is stored in app data

  2. SumatraPDF image Clicking advanced options opens the config file in your text editor.