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

Unable to submit research #14

Open
Foxpire opened this issue May 1, 2019 · 6 comments
Open

Unable to submit research #14

Foxpire opened this issue May 1, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@Foxpire
Copy link

Foxpire commented May 1, 2019

Hello. Some researches cannot be submitted. I have narrowed this problem to be problem with mobile browsers, since desktop(pc) works always, some researches can be submit when using mobile browsers desktop mode.

I am using Android 8 and Chrome. Same error seems to happen many other devices and browsers. I have already give advice to use chrome since it seems to have best support. I keep asking from our community about device OS's and browser's to gather more info.

Error occurs only when prize parameter is " [n] prize". Just sometimes this happens, so it could be event related research. Happens only when you need to manually tell quantity of items to get as a prize. My guess is that it could be related to event handling.

@bilde2910 bilde2910 added the bug Something isn't working label May 1, 2019
@bilde2910
Copy link
Owner

Hi, and thanks for reporting this issue. I have tested this extensively on v1.1.3 and have been unable to reproduce this with Chrome and Firefox on Android 9, which is the only compatible device I currently have available. The officially supported browsers for FreeField on Android are Chrome and Firefox. I also doubt that this is related to event research as the way it is treated internally is exactly the same as other research tasks.

This looks to be a pretty hard to resolve issue, and I will need quite a bit of information in order to troubleshoot it. Could you please tell me the following things about cases when this occurs?

  • Most importantly, what happens when research submission fails - do you get an error message when you try to submit research, does it submit but not show up on the map afterwards, or does nothing happen at all when you tap the Report button?
  • Are there any instances at all where reporting this type of research from a mobile browser does work (not using desktop mode) when the same task fails on another device?
  • If reporting fails for one device, does it always fail for that device as long as they do not use desktop mode?
  • Is there anything in common between a lot of the affected devices, as far you can tell? Things like device manufacturer, language, mobile network provider used etc.
  • For one of the devices, can you test if reporting works on WiFi vs. mobile data?

Also, since you mentioned you host your own server:

  • Are there any PHP notices/warnings/errors/fatal errors in your server's error logs that appear around the time users try to submit research?
  • Is the server running PHP 7, or the older, outdated PHP 5?
  • Are you using another HTTP and SQL daemon combination than Apache + MySQL?
  • Are you using a web application firewall (WAF), load balancer or reverse proxy (CloudFlare-type) in front of your server, or have you configured your server to block some connections based on the User-Agent or IP address of connecting clients?
  • Do you use HTTPS?

I might have to ask for some additional information later, but for now, whatever you can provide of what I asked above will be very helpful in trying to figure out exactly what is going on here.

And lastly, sorry for asking this, it might seem like a stupid question but I need to know this for verifying the issue - when reporting research that offers an "[n] prize" reward, can you confirm that the additional box labeled "Quantity" underneath the selected reward is correctly filled with a value and not left blank when clicking Report?

Thanks for the report and information so far.

@Foxpire
Copy link
Author

Foxpire commented May 2, 2019 via email

@bilde2910
Copy link
Owner

It doesn't seem like the video attachment got through with your email. Could you try submitting it on this issue from the GitHub website instead? It also sounds like something on your server is blocking connections based on the browsers' user agents and/or HTTP request method. I don't know what kind of fail2ban or mod_security configurations you're running, but if this is the only filtering you're using in addition to a basic firewall, I'm somewhat inclined to believe the issue is there, but I can't tell for certain.

Could you try the following in order and see if this has any effect?

  • Do you use mod_security in Apache? If so, can you please ensure that the HTTP request methods PATCH, PUT and DELETE are permitted on the same level as GET and POST? Some configurations (see this question for example) may block or rate-limit these types of requests by default. FreeField uses these methods because research submissions are done against a REST API built into FreeField. If one of your fail2ban jails uses a filter regex against GET or POST, ensure that PATCH, PUT and DELETE are also included in that regex.
  • In the FreeField admin settings pages, go to the Security page and set "User-agent validation" to Disabled. Save, then on the phone, sign out of FreeField (if you're signed in), then sign back in again and try to report research. If you're not signed in, you can try clearing browser cookies after changing the setting.
  • Also in the FreeField settings, go to Permissions and ensure that the "Report field research" permission is set to the same, or a lower value than "Default user group" at the top of the same page.
  • Lastly, go to Site settings in FreeField and double-check that "Installation URI" starts with "https".
  • Whitelist the IP address that your phone is connecting from in fail2ban and see if this has any effect. Check that the IP address is not banned by fail2ban.
  • Temporarily disable fail2ban and mod_security (if using it) and see if submission works when these modules are turned off. If they do, then it would indicate that the error is somewhere in the configuration of these modules.

When making changes to FreeField configuration, make sure you do a simple refresh of the page on the phone before you try reporting research again.

Your environment otherwise looks good; Apache with PHP 7 and MySQL provided by MariaDB is well supported and is what I also run for a few FreeField installations without issue. Firewalls should not be an issue.

If any of this, or none of it works, let me know and I'll see what I can do as the next step.

@Foxpire
Copy link
Author

Foxpire commented May 5, 2019 via email

@bilde2910
Copy link
Owner

Hi,

If disabling user-agent validation resolves the issue, I'd recommend keeping it disabled as the resolution to this issue, as the security issue it protects against is an edge case.

I'll see if I can find the root cause of the issue. Is it possible for you to do a research report from your phone, and then send me the relevant lines from the report from your Apache access log, showing the user agent? You can remove the URL, IP addresses, etc. from the log. I only need the user agents for this purpose. This will help me do local testing to see if there are any notable differences. I would be very grateful if you could provide this :-)

Otherwise, I will add a note in the FAQ and make note of this resolution should it ever come up again. It's a really strange issue and I'm not able to reproduce it locally.

@Foxpire
Copy link
Author

Foxpire commented May 8, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants