php-tenant/Models
Claude dede803632
security: fix O(n) timing attack in findByToken (#9)
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>
2026-03-24 13:06:01 +00:00
..
AccountDeletionRequest.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
AgentReferralBonus.php refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Boost.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
EntitlementLog.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
EntitlementWebhook.php refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
EntitlementWebhookDelivery.php refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Feature.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
Namespace_.php refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
NamespacePackage.php refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Package.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
UsageAlertHistory.php refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
UsageRecord.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
User.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
UserToken.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
UserTwoFactorAuth.php security: encrypt 2FA secrets and hash invitation tokens 2026-01-29 12:20:53 +00:00
WaitlistEntry.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
Workspace.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
WorkspaceInvitation.php security: fix O(n) timing attack in findByToken (#9) 2026-03-24 13:06:01 +00:00
WorkspaceMember.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
WorkspacePackage.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00
WorkspaceTeam.php fix(tenant): add strict_types and fix PSR-12 compliance across all PHP files 2026-03-17 09:11:54 +00:00