Tags

The following entries are tagged with “rails plugin”:

A tamper-proof cookie jar for Rails

When the default session store for Rails was changed to use cookies last year it caused quite a furore: "It’s not secret! It’s not safe!" The truth is it was never meant to be: in most circumstances you shouldn’t really be storing data in cookies that need to be protected so strongly. But I don’t really want to re-open that can of worms! Instead I want to look at a different cookie-related situation that arose during some optimisation work I’ve been doing on an existing Rails application.

No cookie monstersThe scenario is straightforward enough: the application stores a numeric record ID in a persistent cookie that, while perfectly safe to be seen by users, shouldn’t be changed by them. The solution currently used in the application is equally straightforward: the data is encrypted (using the EzCryto gem and AES encryption) before being written to the cookie, and then decrypted when the data is read back in.

In situations where cookie contents really shouldn’t be seen by users then encryption is the way to go (unless of course you can find a way of not using a cookie at all), however for a simple numeric ID where tampering is the only thing we need to protect against then it seems like overkill. A better solution is to take inspiration from the Rails cookie session store and use a HMAC.

Read more of this entry

Recent entries

Archives

  1. September 2008
  2. August 2008
  3. July 2008
  4. June 2008
  5. May 2008
  6. April 2008
  7. March 2008
  8. February 2008
  9. January 2008
  10. December 2007
  11. November 2007

Tags

  1. actionview
  2. active messaging
  3. activesupport
  4. actverecord
  5. aes
  6. aggregation
  7. ajax
  8. akismet
  9. amazon
  10. amazon sqs
  11. ami
  12. apache
  13. api
  14. apr
  15. apr-util
  16. async
  17. attachment_fu
  18. attr_accessible
  19. autotest
  20. availability
  21. aws
  22. backgroundrb
  23. beanstalkd
  24. bindings
  25. bj
  26. branding
  27. bug
  28. cache
  29. centos
  30. cloud
  31. clusters
  32. community
  33. company name
  34. compiler
  35. composed_of
  36. consultancy
  37. controller
  38. convert
  39. cookies
  40. css
  41. database
  42. dates
  43. defensio
  44. deployment
  45. design
  46. development
  47. dhtml
  48. docrails
  49. documentation
  50. donations
  51. drdb
  52. ebs
  53. ec2
  54. elastic
  55. elastic block store
  56. encryption
  57. erb
  58. error
  59. events
  60. ezcrypto
  61. fckeditor
  62. feedburner
  63. feeds
  64. filter
  65. flickr
  66. flickr api
  67. flickr_fu
  68. fuse
  69. geekup
  70. geocode
  71. git
  72. github
  73. god
  74. growl
  75. hacker
  76. haml
  77. helper
  78. hmac
  79. holiday
  80. hosting
  81. hpricot
  82. html
  83. identity
  84. imagescience
  85. infiniteftp
  86. init.d
  87. italy
  88. javascript
  89. json
  90. leeds media
  91. linux
  92. logo
  93. mac
  94. markaby
  95. mass-assignment
  96. memcached
  97. mephisto
  98. messaging
  99. migrate
  100. migration
  101. model
  102. mod_rails
  103. mod_ruby
  104. mongrel
  105. mongrel_cluster
  106. monit
  107. monitoring
  108. mq
  109. mysql
  110. neon
  111. new site
  112. nginx
  113. observer
  114. open source
  115. opensolaris
  116. openssl
  117. optimisation
  118. passenger
  119. patch
  120. performance
  121. persistence
  122. persistent storage
  123. persistentfs
  124. php
  125. phusion
  126. plugin
  127. plugins
  128. prototype
  129. queues
  130. rails
  131. rails development
  132. rails patch
  133. rails plugin
  134. rails-doc
  135. refresh
  136. renderer
  137. rich text editor
  138. rmagick
  139. ruby
  140. ruby on rails
  141. rubyinline
  142. rvideo
  143. s3
  144. s3fs. elasticdrive
  145. schema
  146. security
  147. services
  148. snarl
  149. social
  150. solaris
  151. spam filter
  152. sparrow
  153. sql
  154. sql_logging
  155. starling
  156. starter kit
  157. storage
  158. subversion
  159. survey
  160. svn
  161. swig
  162. sysadmin
  163. tamper
  164. templates
  165. the webfellas
  166. time zone
  167. tinymce
  168. to-done
  169. transcoding
  170. tzinfo
  171. uk
  172. uk rails
  173. unsigned
  174. validation
  175. video
  176. view
  177. vmdk
  178. vmware
  179. webfellas
  180. webfellows
  181. wedding
  182. welcome
  183. widgeditor
  184. will_paginate
  185. win32
  186. windows
  187. wysiwyg
  188. xen
  189. xhtml
  190. xvm
  191. youtube
  192. zentest
  193. zfs

Flickr snaps