Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
changelog: slightly more help about enabling CSRF protection when upg…
Browse files Browse the repository at this point in the history
…rading
  • Loading branch information
sourcejedi committed Oct 2, 2012
1 parent f427666 commit a85b42b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docs/_guides/basic_info/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ Regression fixes for:

Upgrade Notes:

Version 0.6 prevents CSRF attacks using a standard CodeIgniter option. This should protect against clicking a malicious link (e.g. in an email or forum post), which attempts to perform actions on Bonfire. E.g. deleting modules or changing user access rights.
Version 0.6 prevented CSRF attacks using a standard CodeIgniter option. This should protect against clicking a malicious link (e.g. in an email or forum post), which attempts to perform actions on Bonfire. E.g. deleting modules or changing user access rights.

This means all AJAX POST requests need to include the CSRF token. In many cases the simplest option will be what we used for issue #596. Upgrade to Bonfire 0.6.1 and then change two lines:
When upgrading to Bonfire 0.6.1, you should make sure to update config.php in the application/config folder. This is necessary in order to enable and configure CSRF protection.

As a result, any AJAX POST request you have will need to include the CSRF token. If you don't already know how to do this, Bonfire 0.6.1 includes a simple solution. You just need two extra lines.

In the controller for the page which launches the AJAX request:

In the controller, you need:
Assets::add_js('codeigniter-csrf.js')

In the AJAX request, you add an extra data field:
In the AJAX request, an extra data field:

// assuming your data is not passed as a string
$.ajax({ ... data:
$.ajax({ ..., type: "POST", data:
{ ... 'ci_csrf_token' : ci_csrf_token() } } );
// or
$.post(url,
Expand Down

3 comments on commit a85b42b

@lonnieezell
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved the guides into the Wiki, though I haven't made any announcement about that. :) Or changed any links yet. Would you mind copying the changelog over to the wiki so we can keep it up to date there?

@sourcejedi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can hardly object to that request, since I filed "#582 Changelog is rather well-hidden, maybe no-one reads it" :). Sure, no problem.

@lonnieezell
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol. I forgot about that one. I just have the feeling that using the wiki will make it more likely that we'll modify the help files and that others might help out here, too.

Thanks! Not just for this but for all of the work you've been giving to Bonfire lately. Just wanted to you know it's very much appreciated! Especially since a startup I'm involved with has kept me pretty busy lately.

Please sign in to comment.