Closed (fixed)
Project:
Embed widgets
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
26 Jul 2008 at 10:17 UTC
Updated:
30 Sep 2008 at 03:41 UTC
Hello
It would great to see some impromvements in the security. Hackers or Skript Kiddies tries a lot. If the ID just increments to the next higher value, a jailbreak or just trying out the next ID could some actions of hackers.
Somthing like a attached random key in the widget code or the ID as random key, could make it much harder.
bennos
Comments
Comment #1
jtsnow commentedGood suggestion. I have been playing with this a bit. The new 'live preview' features generates the widget completely from a URL and doesn't access the database. The widget information in the URL is encoded using base64_encode. As I implement more features, one-way encryption may be used.
Comment #2
bennos commentedBase64_encode function is a good first step.
Comment #3
jtsnow commentedI am no longer building widgets from the URL. Everything is checked against the database. I am using md5() to encrypt some of the widget information. If the encrypted widget information matches the widget in the database, it is loaded. It should be very difficult to decrypt the md5 hash since the hashed string is a serialized array and contains several special characters.
Widget URL's now look like this: http://deviable.com/widgets/embed-widgets/embed/iframe/1-8060c935a728bae...
This should be adequate.
Comment #4
jtsnow commentedOk, I have continued to improve on encoding the widget ID in the URL. Here is what I have currently come up with:
The encryption uses the PHP crypt() function to hash the widget ID along with the base path. The hash is salted with the first two or first eight characters of the cookie domain, depending on the server's encryption. The widget ID is then inserted into the 7th character in the hash. The length of the widget ID is pre-pended so that the ID can be found in the hash. An encoded version of the entire cookie domain is appended. Using $base_path makes certain that a unique encrypted ID is generated when more than one Drupal installations are running from the same domain, but different path. Appending the encoded $cookie_domain guarantees that domains that begin with the same two (or eight) characters won't generate the same ID since most Drupal installations run from the base path '/'.
Comment #5
bennos commentedwow, I am impressed. great job in your GOS 08.
that makes it much harder for hackers.
Comment #6
jtsnow commentedComment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.