mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 02:46:04 +01:00 
			
		
		
		
	Prevent security failure due to bad APP_ID (#18678)
WebAuthn may cause a security exception if the provided APP_ID is not allowed for the current origin. Therefore we should reattempt authentication without the appid extension. Also we should allow [u2f] as-well as [U2F] sections. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		| @@ -24,6 +24,19 @@ export function initUserAuthWebAuthn() { | ||||
|         .then((credential) => { | ||||
|           verifyAssertion(credential); | ||||
|         }).catch((err) => { | ||||
|           // Try again... without the appid | ||||
|           if (makeAssertionOptions.publicKey.extensions && makeAssertionOptions.publicKey.extensions.appid) { | ||||
|             delete makeAssertionOptions.publicKey.extensions['appid']; | ||||
|             navigator.credentials.get({ | ||||
|               publicKey: makeAssertionOptions.publicKey | ||||
|             }) | ||||
|               .then((credential) => { | ||||
|                 verifyAssertion(credential); | ||||
|               }).catch((err) => { | ||||
|                 webAuthnError('general', err.message); | ||||
|               }); | ||||
|             return; | ||||
|           } | ||||
|           webAuthnError('general', err.message); | ||||
|         }); | ||||
|     }).fail(() => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user