optimize validateCSRF