feat: Add granular client override policy system for WebAuthn options #805
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: Add granular client override policy system for WebAuthn options
Problem
Fixes #797
The
ProfileBasedCreationOptionsBuilderwas not consistently using profile configuration values, allowing client requests to override server-defined policies. Additionally, there was no way for developers to selectively allow certain client overrides while maintaining security.Issue Details
Solution
This PR implements a granular client override policy system that provides developers with fine-grained control over which WebAuthn options clients can override, while maintaining backward compatibility and security by default.
🎯 Key Features
1. ClientOverridePolicy System
ClientOverridePolicyclass manages opt-in override permissionsenabledflags andallowed_valuesconstraints2. Granular Field Control
Configure which fields clients can override:
3. Smart Override Logic
allowed_valueslist🔧 Implementation Details
Service Integration
ClientOverridePolicyregistered as Symfony serviceBackward Compatibility
Builder Integration
📋 Usage Examples
Example 1: Allow Limited User Verification Override
Example 2: Development Environment (More Permissive)
Example 3: Production Environment (Strict Control)
🧪 Testing Coverage
🔒 Security Benefits
🔄 Migration Path
For Existing Applications
For New Applications
allowed_valuesconstraints to limit client input📚 Configuration Reference
Available Fields
user_verification: ControlsuserVerificationrequirementauthenticator_attachment: Controls authenticator type preferenceresident_key: Controls resident key requirementattestation_conveyance: Controls attestation preferenceextensions: Controls WebAuthn extensionsPolicy Structure
This implementation provides the flexibility developers need while maintaining the security-first approach that makes WebAuthn reliable. The opt-in design ensures that existing applications continue to work unchanged, while new applications can selectively enable the client override capabilities they need.