Add a SHA-256 token_hash lookup column to workspace_invitations so that findByToken and findPendingByToken can locate the candidate row with a single indexed SQL query instead of loading up to 1000 rows and running bcrypt against each one sequentially. The bcrypt hash in the token column is still verified after the O(1) lookup, preserving the existing security guarantee while eliminating both the timing side-channel and the performance bottleneck. Changes: - Migration to add nullable indexed token_hash column - Model booted() creating/updating events compute SHA-256 alongside bcrypt - findByToken/findPendingByToken rewritten to WHERE token_hash then Hash::check - HashInvitationTokens command updated to populate token_hash for existing rows Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| 0001_01_01_000000_create_tenant_tables.php | ||
| 2026_01_26_000000_create_workspace_invitations_table.php | ||
| 2026_01_26_120000_create_usage_alert_history_table.php | ||
| 2026_01_26_140000_create_entitlement_webhooks_tables.php | ||
| 2026_01_26_140000_create_workspace_teams_table.php | ||
| 2026_01_29_000000_add_performance_indexes.php | ||
| 2026_03_24_100000_add_token_hash_to_workspace_invitations.php | ||