Skip to main content

A novel way of handling malicious requests within a Django application.

Installation

Install from PyPi (stable):

pip install django-rickroll

or Github (dev):

pip install -e git://github.com/codeinthehole/django-rickroll.git#egg=django-rickroll

Add 'rickroll' to your INSTALLED_APPS and the following to your MIDDLEWARE_CLASSES:

'rickroll.middleware.HackingAttemptMiddleware'

Usage

Wherever you detect a hacking attempt, raise a HackingAttempt exception and the middleware will rickroll the offending user.

For example, in your views.py:

from rickroll.exceptions import HackingAttempt

def some_view(request):
    # ...
    if hacking_detected:
        raise HackingAttempt()

then the user in question will get redirected to http://www.youtube.com/watch?v=dQw4w9WgXcQ. The destination can be overridden using the setting RICKROLL_URL.

Discussion

If your site ever gets penetration tested, the testing company will likely manipulate every request to your site where there are parameters being passed (query parameters, POST params, cookies etc). When you encounter a parameter which should be an integer but has value ../../../../../../etc/passwd, it’s not always clear what the “right” response should be. I thought it would be funny to rickroll.

Metadata

Release files for django-rickroll 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-rickroll 0.1.1
File Size Uploaded
django-rickroll-0.1.1.tar.gz 2.7 kB Details

Release files / django-rickroll-0.1.1.tar.gz

Download URL django-rickroll-0.1.1.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0ecc505f8b800ec47a69cbfed7f77e331902067bf598566fcbbf9028371af89f
BLAKE2b-256 checksum
How to use checksums
508e9615c956ee509f0d69bdd1b996783aa1b52eb55b2ad166aaaec711188f29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page