uroni / urbackup-server-python-web-api-wrapper

Python wrapper to access and control an UrBackup server
https://www.urbackup.org
Apache License 2.0
37 stars 22 forks source link

the urbackup_api_test.py script has corrupted the configuration of global parameters #19

Open MaxiReglisse opened 8 months ago

MaxiReglisse commented 8 months ago

Dear developers, I wish you a happy new year 2024! and at the same time I'd like to share with you the problem I recently encountered.

After running the urbackup_api_test.py script, the global parameters of my Urbackup instance ended up with numerous json arrays instead of the expected valid data.

I described the problem on the Urbackup user forum. The valid data had been replaced by json tables, like this:

Default directories to back up: /etc; /root; /home instead of: Default directories to back up: {'value': '/etc;/home;/root'}

What's unusual is that the problem was propagated to all Internet clients (and not to clients on the local network). For example, one client's group authentication key became internet_authkey.group={'value': 'Fg5YCmMtyV'} instead of internet_authkey.group='Fg5YCmMtyV'.

Here’s a pastebin link where you’ll find a trace of the API test script execution a few days ago. :roll_eyes:

Is it possible that it was really the script that caused the damage? if so, it needs to be corrected urgently... For my part, I've completely reinstalled the Urbackup Server instance.

subsidiary question: would restoring the settings table in the backup_server_settings.db database have made it possible to go back?

Thanks in advance for your feedback.

Ernest.

jmanuel1 commented 7 months ago

I think I'm encountering this problem, too. I'm trying to use this package to reliably reproduce the global settings. I tried resetting the settings by removing the {'value': <data>} wrapper before calling set_global_setting, but that didn't fix things. Since that method fetches the settings (which have those dictionaries with "value" keys) and modifies that dict, then sends it back to the server, maybe I shouldn't have expected it to solve my solutions.

I speculate that if I save all the settings through the API at once, without the extra dictionaries, at least some of my settings will be repaired.

jmanuel1 commented 3 months ago

@uroni I exported the settings table from my settings database as CSV and see rows like this:

archive,"{'value': '{\'value\': \'{\\\'value\\\': ""{\\\'value\\\': \\\'\\\'}""}\'}'}",0,"",2,1706681190

Some of the rows have a HUGE number of backslashes, like this: image

I removed all of the backslashes from the file, and the content of this row is:

update_freq_incr,"{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': '{'value': ""{'value': '18000'}""}'}'}'}'}'}'}'}'}'}'}'}'}'}'}'}'}'}'}'}",0,,2,1706681190

It seems that there's some confusion about what is and is not JSON. And that the values of the settings aren't validated properly...