Skip to content
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

Modsecurity prevents update of contacts #1061

Open
mehgrmlhmpf opened this issue Jan 18, 2020 · 3 comments
Open

Modsecurity prevents update of contacts #1061

mehgrmlhmpf opened this issue Jan 18, 2020 · 3 comments

Comments

@mehgrmlhmpf
Copy link

The default configuration of NCP with modsecurity seems to have an issue when handling vcard files.

Setup: current docker instance of NCP with modsecurity enabled, latest updates

Steps to reproduce:

  1. create new contact
  2. save contact (successful)
  3. change contact data
  4. request error 500 on saving the contact
  5. data is lost after site refresh

Steps 3-5 are successfull with disabled modsecurity.

Solution:

  • create exception for addressbooksync

The corresponding logfile/line:
[Sat Jan 18 17:39:21.463016 2020] [:error] [pid 23201:tid 1817326624] [client xxxxxx] [client xxxxxxx] ModSecurity: XML parser error: XML: Failed parsing document. [hostname "xxxxxxxx"] [uri "/remote.php/dav/addressbooks/users/xxxxxx/xxxxxx/xxxxxx-2DA4-4988-8FC6-xxxxxxxxxx.vcf"] [unique_id "XiNCyZLwCYQ4v2CWduyWOQAAShg"]

@nachoparker
Copy link
Member

Hi,

Thanks for reporting. It would be great to tweak modsec config to fix this, please let us know if you find out the fix.

@amischler
Copy link

Hi,

I'm facing the same issue.

As a workaround I added the following line to /etc/modsecurity/modsecurity.conf to skip other rules for the addressbooks requests :

SecRule REQUEST_FILENAME "@contains /remote.php/dav/addressbooks/" "id:1,ctl:ruleEngine=Off"

I'm not submitting a PR, since there might be a better approach. Skipping all rules might introduce security issues.

Moreover, I'm wondering whether the issue should be fixed in the Contacts app directly. Actually, the Content-Type of the request made by the Contact app is "application/xml" but the body of the request is a VCard, that's why an XML parsing exception is raised by the modsec request body processor. Maybe the Content-Type of the request should be something like "application/vcard".

Any other ideas about this ?

@joshtrichards
Copy link
Member

Related: nextcloud/contacts#196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bugs
Development

No branches or pull requests

5 participants