In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
def register(request): | |
if request.method == 'POST': | |
request_post = request.POST | |
registration_form = RegistrationFormUniqueEmail(request_post) | |
hashstring=hashlib.sha1(str(request.POST.get('csrf_token'))) ## This is going to be unique ! A unique has | |
if request.session.get('sesionform')!=hashstring: | |
if registration_form.is_valid(): | |
username = registration_form.cleaned_data['username'] | |
email = registration_form.cleaned_data['email'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
class ReadOnlyModelAdmin(admin.ModelAdmin): | |
""" | |
ModelAdmin class that prevents modifications through the admin. | |
The changelist and the detail view work, but a 403 is returned | |
if one actually tries to edit an object. |