Thanks for much for this contribution. I don't feel particularly qualified to review it, but there's are particular bits where general django knowledge (or even just a second pair of eyes) will help, let the know.
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/66fb5b2b-5f18-4244-92fb-2427b5b63aa8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
So, a while ago, BREACH happened, and Django's CSRF implementation was vulnerable, as was Rails'. The paper that discussed it described a mitigation (and a Rails patch had already been made), so I implemented that same mitigation in a Django patch. Discussion on the Trac ticket has stalled, and I've been told this is the place to go.
The patch I've written implements this mitigation, with one difference: instead of using xor, it uses a Vigenère cipher (as suggested by FunkyBob), as xor was creating non-printable characters which caused problems. I think this should be OK as Vigenère is commonly used for one-time pads and does more or less the same thing to characters that xor does to bits.
(eg credit card data could still get leaked, so you'd still have to disable gzip).
What is wrong with xor+base64? Not that Vigenère cipher is complex, but we have a pretty hard stance against implementing "crypto" on our own.
What is wrong with xor+base64? Not that Vigenère cipher is complex, but we have a pretty hard stance against implementing "crypto" on our own.Nothing, really; that's probably what I would have used had FunkyBob not suggested the Vigenère cipher. That's a perfectly reasonable stance, and I can change the patch to do that if it's preferable.
This looks good, although it seems like there should be a config setting as I could imagine some use cases where the application expects the token not to change in this way. I'm not sure how common this and whether or not such a setting should be enabled by default, but I think it should be considered.
As mentioned the cipher choice was mine. It was, also as mentioned
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/etPan.53dfe906.327b23c6.1280a%40Thor.local.
Stupid phone
The reason for that cipher over xor was to avoid non printable characters.
Any other solution is fine. Xoring the lower 4 bits reduced the entropy too much in my view.