Implement authentication flows that protect sensitive information and follow secure credential management practices:

  1. Prevent domain enumeration attacks by returning consistent responses regardless of whether the input (like domain name) is valid:
// INSECURE: Different responses reveal valid domains
if (domainExists) {
  return redirect('/saml_login');
} else {
  return notFound();
}

// SECURE: Consistent responses prevent enumeration
// Always redirect to SAML endpoint, handle invalid domains later
return redirect('/saml_login'); 
// Handle invalid domains in the login page itself
  1. Use short-lived credentials instead of long-term static access keys when possible:
  2. Verify tenant identity in multi-tenant environments to ensure users and applications belong to the same tenant:
  3. Use correct environment variables when implementing authentication:

These practices help mitigate common authentication vulnerabilities while maintaining proper security boundaries between tenants and users.