Skip to content

Instantly share code, notes, and snippets.

@mattparlane
Created September 14, 2016 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattparlane/30526520638042581de8980282386270 to your computer and use it in GitHub Desktop.
Save mattparlane/30526520638042581de8980282386270 to your computer and use it in GitHub Desktop.
WordPress plugin to add random padding to pages as an added mitigation against the BREACH attack.
<?php
/*
Plugin Name: Add Random Padding
Description: Adds random padding to the end of pages as an added (but not complete) mitigation against BREACH et al.
*/
function add_random_padding() {
echo str_repeat(' ', mt_rand(0, 20));
}
add_action( 'wp_footer', 'add_random_padding', 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment