Skip to content

Instantly share code, notes, and snippets.

@markkimsal
Created March 28, 2024 13:11
Show Gist options
  • Save markkimsal/7b73233301c701c9d53c06d4174ef37d to your computer and use it in GitHub Desktop.
Save markkimsal/7b73233301c701c9d53c06d4174ef37d to your computer and use it in GitHub Desktop.
Laravel CSRF Breach mitigation (?)
<?php
function csrf_field()
{
return new HtmlString('<input type="hidden" name="_token" value="'.csrf_token().'" autocomplete="off" data-rand="'.substr(str_shuffle(md5(microtime())), 0, rand(0, 100)).'">');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment