One man one vote ... no more.

One man one vote ... no more.

by Joseph Rézeau -
Number of replies: 25
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi all,

I am currently working towards adding a "Guest access" feature to the Questionnaire add-on. I have long resisted the idea, but it seems that this is a popular demand and there are real use cases for it, so... The Feedback activity does offer a Guest access feature (on a Moodle site's front page).

However, in the course of this development I have come across the problem of (unwanted) multiple submits. For logged in users, it's easy to find out whether they have already submitted and react accordingly. For guests, this is not so obvious. From my readings on the Web I conclude that there are (only?) 2 ways to detect if a visitor has already submitted a response:

a) detect and save their IP address;

b) use cookies.

None of these if totally foolproof, as a) some users' IP changes regularly (mine changes every 2 or 3 days) and b) cookies may be manually or automatically deleted by the user, or a user may use a different browser to submit multiple responses.

Detecting and saving the guest's IP address is something I can do easily. Cookies I'm finding not so easy. Anyway, my questions to my fellow developers are as follows.

  1. Should I go for the "minimal" option of using the IP address?
  2. Should I bother to use cookies?
  3. Should I not bother at all?
  4. Are there currently either in Moodle core or add-ons (or on the Web) some examples of detecting / preventing multiple submissions by guests?

TIA,

Joseph

Average of ratings: -
In reply to Joseph Rézeau

Re: One man one vote ... no more.

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Joseph,

from my experience it's really impossible to ensure that. No matter, there are some techniques that can be used to mitigate the voting-spam, none of them definitive:

1) Use "very-persistent cookies" when a vote has been performed. Nowadays, it's possible to have information not only stored in standard cookies but in a lot of places like HTML5 session/local/global/database storage, history, etags... surely that requires some JS script in charge of setting/retrieving the information in all those places. So, no matter somebody deletes his "standard" cookie (the ones everybody is aware of), the JS still will find it in other places. I'm sure I've seen some JS library achieving that in a transparent way.

2) Require/detect JS is enabled.

3) Require/detect some cookies/information in the session to proceed to vote. Only if the process is correct (the user has got a moodle session cookie, has followed a serie of steps...before arriving to the "voting" page) it's given certain cookie (let's call it "key cookie").

4) Ask for some "anonymous information" like birthdate, name initials..., it's not sure "per se" but helps sometimes (explained later).

5) Require/suggest some sort of widely-available authentication. Nowadays everybody has a google/twitter/facebook account somewhere. You can ask users to authenticate (OAuth) there before anonymously voting.

And sure that there are more ways... but in any case... I think that the important point is that you NEVER should be preventing multiple votes. Instead you should be accepting all them and, later, have some "filtering" in charge of searching and destroy possible voting-spams.

So, with every "vote", you store as much information as possible (time, IP, key cookie, js enabled, existing cookie, birthdate, initials, oauth....) and later look for spams.

Note that's my personal POV, of course you can decide to explicitly stop allowing dupes in the situations you are 100% sure it's a true dupe of fake vote. But that only will warn spammers, so they will change of browser, use antonymous one, or make their voting bots cleverer. As said, it's impossible to prevent all them.

I think the tricky part is to decide how deep you want to go combining all those techniques and how/when they are applied.

Just my 2 cents, based in some public surveys I was in charge of some years ago. Ciao smile

PS: Ah, I forgot it. email-verification is another good technique that can be used. You ask every voter for an email (of course stating it won't be ever be stored, privacy and so on) and, after voting, an email with a link containing a secret is sent (and the secret is some hash of the email entered, stored in the DB and obfuscated in a reversible way in the mail !). The user gets the mail, clicks the verification link and the server  reverses the obfuscated secret marking the vote as verified. Again, not 100% bullet-proof, but another way to fight against spammers (because the same email address will lead to the same secrets stored in DB, easy to look for them later).

Average of ratings: Useful (5)
In reply to Eloy Lafuente (stronk7)

Re: One man one vote ... no more.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Thanks for the detailed answer, Eloy.

I think what I will do is a reasonable amount of prevention (checking IP address, maybe) plus I will suggest to the Questionnaire users (teachers, admins, etc) some degree of manual a posteriori checking. Rather than trying by all means to block multiple submissions... and never being quite sure that it works.

Another possibility would be to put the anonymous questionnaire inside a special course opened to guests but with a key. I will ask potential users on the Questionnaire forum what they think.

Thanks again,

Joseph

In reply to Joseph Rézeau

Re: One man one vote ... no more.

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi, just 2 quick notes:

1) Note I did not talk about IPs as a measure in my previous mail, on purpose. Both because people can get new ones and also, and perhaps more important, because a whole institution can be using the same public IP for thousands of computers (can you imagine how many can stay behind the NSA, all them voting compulsively, for example?)

2) About the "very persistent cookies", I just searched for those terms and found a bunch of candidates. Feel free, they seem to offer really many storage alternatives. Surely using them + email verification could lead to very good results.

Ciao smile

In reply to Joseph Rézeau

Re: One man one vote ... no more.

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Just another reason not to use IP addresses:

In a shared computing environment several users will have the same ip address over the course of a day. Think of a university computer lab. This could also be a problem with persistent cookies I suppose.

Its quite tricky isn't it ...?

You really need to have some questions in the questionnaire that provide handles to later filter on. e.g shoesize + month of birth. But that would never get past the suits ...

In reply to Eloy Lafuente (stronk7)

Re: One man one vote ... no more.

by Matt Bury -
Picture of Plugin developers

I like Eloy's suggestions.

From using Analytics software (e.g. http://www.openwebanalytics.com/ and http://piwik.org/), I've seen that you can create extensive profiles of users without cookies or logins - I'm pretty sure that Google, Facebook, etc. use similar techniques. I once read that Google collected or attempted to collect over 50 different characteristics from server calls to identify users; browser version, OS version, installed plugins, screen size, touch screen, etc. I also know that Google still uses local shared objects (LSOs - AKA "Flash cookies") to store persistent identifiers in users' caches. AFAIK, it's pretty difficult to NOT be effectively identified by Google... ...unless voters use something like TOR Browser: https://www.torproject.org/ but then how many people would do that?

Another thing to look at might be voting patterns: Do votes come in particular concentrations/intensities and if so are those votes biased in any one direction? Also, there are some other interesting statistical analyses for detecting randomised and manipulated data (often used to detect election fraud). Perhaps that'd be worth looking into?

I think if you can find a way to link votes with profiles, it could go along way towards detecting multiple/duplicate submissions.

Average of ratings: Useful (1)
In reply to Joseph Rézeau

Re: One man one vote ... no more.

by Flotter Totte -
Picture of Plugin developers

Hi Joseph,

one way could be to just track the IP addresses so that the teacher/researcher later can check whether multiple submits from the same IP address happened. Then it would be up to the teacher/researcher how to deal with such thing.

Greetings,

Flotter

 

In reply to Flotter Totte

Re: One man one vote ... no more.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Flotter,

The problem with tracking IP addresses is that, depending on your Internet provider, your IP address can change quite frequently.sad

Joseph

In reply to Joseph Rézeau

Re: One man one vote ... no more.

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Would the use of cookies bring current EU legislation into account?

In reply to Richard Oelmann

Re: One man one vote ... no more.

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

With the EU legislation, cookies are a pain in the **** and should be avoided.  What about generating a token and eMailing it to them as a unique URL?  Then they use this link to complete the test.  Again I know its not full proof or completely anonymous.  But then if you are conducting an anonymous survey electronically then this has to be taken into account with the margin of error.

Even being stopped in the street and manually asked is not completely anonymous and if you have teams of people there is nothing to stop a respondent answering the questionnaire at one end of the street and again at the other end.  No system is full proof unless we go all Big Brother and get identity chips surgically implanted.

In reply to Gareth J Barnard

Re: One man one vote ... no more.

by Matt Bury -
Picture of Plugin developers

Hi Gareth,

The EU cookie laws only require informed consent. It's usually as simple as a notice on a landing page with a link to further information. The user agrees, the notice goes away. The requirement is to tell users, upfront, why you are storing cookies, what information your storing, and what you are using it for. It's pretty much an extension of the various freedom of information laws that we have for personal records anyway, but very much weaker. At the moment cookie law compliance functions are available in most CMS' as extensions. I'm not sure if Moodle has one - I use and recommend Piwik which has consent and opt-out built in.

In reply to Matt Bury

Re: One man one vote ... no more.

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Matt,

Moodle only has a small cookie that is used for identification with no personal data in it.  It is therefore except from notification by the cookie law.  I did undertake extensive research when I used cookies with Collapsed Topics, however after a while with Tim's help with the user preference code I was able to have server side storage of state instead.  Some older versions of the format still have it.

But the main point is the extra effort required in investigating and weighing up the restrictions that apply.  And then trying to determine if the data you store in the cookie requires an informed consent message.  All of this non-technical extra effort just adds more time and adds nothing to the functionality of the code.

Cheers,

Gareth

In reply to Joseph Rézeau

Re: One man one vote ... no more.

by Danny Wahl -

and don't neglect on-prem Moodle servers with a DHCP solution for clients.

I'd far rather see someone able to vote-spam than see someone blocked from voting because their current IP has already voted.

In reply to Joseph Rézeau

Re: One man one vote ... no more.

by Rex Lorenzo -

I wouldn't go with IP restriction, because we have some folks behind a VPN and would produce more false negatives.

We actually modified the questionnaire to allow public questionnaires to be submitted by just changing the 'mod/questionnaire:submit' capability from "write" to "read", so that guests can submit.

We went with the route of not bothering with duplicate submissions. We aren't too worried about multiple or spam submissions. Just hasn't been a concern and the types of questionnaires we are using aren't high stakes or anything, like voting.

What you could do is just set a user session value, so that someone would have to clear their cache to retake the questionnaire. The aim shouldn't be to make it bulletproof, just to at least put a little hurdle, so it someone reloads their browser it wouldn't submit again or tell them to take the questionnaire again.

In reply to Rex Lorenzo

Re: One man one vote ... no more.

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Hi

I hope you understand that by allowing guests to submit any feedback you are opening a potential security hole in your site. If there is ever a problem discovered in the code that tries to strip XSS attacks your site will be immediately vulnerable, so please make sure that you upgrade your site regularly.

Also maybe you should not encouraged others to change the write property of capabilities without explaining the security implications. Thanks.

Petr
Average of ratings: Useful (1)
In reply to Petr Skoda

Re: One man one vote ... no more.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Petr and thanks for pointing to this related security problem (of which I am well aware).

1.- Currently, as far as I understand it, guests, aka non-authenticated users on a moodle site are always denied the write capability. This is ruled in accesslib.php by: // make sure the guest account and not-logged-in users never get any risky caps no matter what the actual settings are.

2.- What is misleading for users (teacher role) is that in their course or activity it is (apparently) possible to allow guests write/submit/etc capabilities, but such capailities will be over-ruled. It would be more logical to NOT display capabilities which will not be effective.

3.- The Feedback activity has a site setting "feedback_allowfullanonymous" which can only be set by an admin. This setting allows non-authenticated users to submit feedbacks. For this to work, I expect that activity over-rides the write access capability for guests somewhere. That is what I was thinking of doing for Questionnaire. Maybe that Feedback setting should have a warning re security risks?

Considering a) the problems dealing with multiple submissions and b) the security risks, I conclude that it might not be such a good idea to add a "guests submission" feature to Questionnaire after all.thoughtful

Joseph

In reply to Rex Lorenzo

Re: One man one vote ... no more.

by Jeremy Schwartz -

Hi Rex,

I am trying to modify the access.php file to allow Guests to view and submit a questionnaire.  I am running Moodle v2.5.  I changed the 'mod/questionnaire:submit' capability from "write" to "read".  But the guest access is still unable to view it.

Can you please post your access.php file to this forum as an attached file?

Thanks alot,

 

 

In reply to Jeremy Schwartz

Re: One man one vote ... no more.

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Don't edit this in the code. Go to admin -> Users -> Permissions -> Define roles.

In reply to Tim Hunt

Re: One man one vote ... no more.

by Jeremy Schwartz -

Hi Tim,

I tried modifying the permissions for a Guest user to "allow" on the Questionnaire view, submit settings, site-wide and within this particular questionnaire.  I even duplicated the student role, and made it the default role for visitors and guests this new role, but I still can not get a non-logged in user to be able to open the questionnaire.  Modifying the php file is the only solution I have seen posted that anyone claims can overcome the need to login to be able view/complete a questionnaire.  Any ideas?

Thank you so much. I have created a Moodle instance that is soley designed for non-logged in users to be able to access/submit front page questionnaires.

I am using the Essential Theme on Moodle v2.5

Jeremy

In reply to Jeremy Schwartz

Re: One man one vote ... no more.

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Jeremy S - would the feedback module not serve your purposes? It allows guest access to the front page.

In reply to Mary Cooch

Re: One man one vote ... no more.

by Jeremy Schwartz -

Hi Mary,

Thank you for your reply.  I have not used the Feedback module yet, but yes that is an option I will check out in the future.  But, following Rex's suggestion to modify the access.php file to read from write, I have been able to make the questionnaire work on the frontpage without a need for login or accounts today.  It seems that the same security risk exists for un-logged-in users if they are writing to the database as guests using the Feedback or Questionnaire module.   So, if it is permitted in the Feedback module, I would like to see it permitted in the Questionnaire module, too, if possible.

Thanks again for your reply,

Jeremy S.

In reply to Jeremy Schwartz

Re: One man one vote ... no more.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@Jeremy,

Here is what I wrote in this discussion on Dec 16:

Considering a) the problems dealing with multiple submissions and b) the security risks, I conclude that it might not be such a good idea to add a "guests submission" feature to Questionnaire after all.

You can hack the Questionnaire module yourself to do what you want, "at your own risk", as the saying goes.

Joseph

 

In reply to Joseph Rézeau

Re: One man one vote ... no more.

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Jeremy S - the feedback module is standard  in your Moodle installation (but it is disabled by default so you won't see it unless you enable it in Site administration) Then to set feedback for guests see Feedback FAQ 

In reply to Joseph Rézeau

Re: One man one vote ... no more.

by Franc Pombal -

Hi

I would agree with Eloy (lang=es -> arriba esas sidrinas big grin) and also confirmed his words... even in other development environments, it is difficult to avoid duplicate votes from unidentified users ...

Perhaps the option 'eMail confirmation' is the safest, but of course, since these identifying the user, which, with a similar process and an eMail well written, you could open an account in moodle and have the user identified for lifetime...

But I have come into this conversation to make you think about adding that option to the plugin... I personally do not like the idea... and if people need it so much... just redesign a new questionnaire plugin to guest users...

Anyway, I think the questionnaire as you currently have is fine and certainly can be improved... but personally I do not think this is a good improvement...

Thanks and Lucky

Average of ratings: Useful (2)
In reply to Franc Pombal

Re: One man one vote ... no more.

by Jenny Gray -

I'd be quite worried about seeing this feature go into questionnaire as well - I doubt we could train all the potential users on how to effectively manage the responses as discussed above.

 

Joseph, if you do go ahead with this, please make sure that administrators can switch it off so that it is not available to people who create questionnaire instances!

Average of ratings: Useful (3)
In reply to Franc Pombal

Re: One man one vote ... no more.

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Another "me too" against such a feature (unless it could be completely disabled by site administrator); there is no technical way that is completely effective in preventing multiple submissions from the same user.

Average of ratings: Useful (1)