If you have any sort of administrative interface on your web site, you can easily imagine an intruder gaining access and mucking about. How do you know the extent of the damage? Adding an audit log to your app is one quick solution. An audit log should record a few things:
- controller entry points with parameter values
- permanent information about the user, like user_id
- transient information about the user, like IP and user_agent
Using the Rails framework, this is as simple as adding a before_action
to your admin controllers. Here’s a basic version that I’m using in production.