Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Can the ID be hacked i.e modified so that I change 1 to 2, and assuming a record with 2 exists, it gets overwritten. (I suppose it shouldn't be difficult with firebug or other plugins).</p> </blockquote> <p>You are correct. Editing such things can be as easy as inspecting and editing the element in Chrome's console. Remember; anything that is done client-side is insecure and can be modified by the user. Always have server-side checks, <strong>always</strong>.</p> <blockquote> <p>How do I prevent this?</p> </blockquote> <p>One possible fix is to link records to users, i.e., create a bridging table between users and records called "recordAccess" (or whatever your naming convention leads you to call it). This bridging table will have a user ID column and a record ID column. The server will check the user ID and the record ID against this table and will only allow changes if there is a matching row in the database. How you add rows to this table depends on how your app works, but shouldn't be difficult to work out.</p> <p>To prevent users from editing the wrong record, you could add an additional column into this bridging table called "current" (or, again, whatever you prefer) which is a simple boolean value. When the user goes to edit a record that he/she is allowed to edit, this value will be set to "true" and all other rows associated with that user will be set to "false". Then, when the user submits the edit, if the value in that row is set to "true", the row successfully updates and the value changes back to "false". Otherwise, all values are set to "false" and the update is rejected.</p> <p>Hopefully this gives you some ideas.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload