mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
core/webauthn: Allow only one CTAPHID_WINK command at a time on any given channel ID to fix continuous display blinking with Android.
This commit is contained in:
parent
3a4e9bd25c
commit
a704bfe184
@ -215,6 +215,9 @@ _ALLOW_RESIDENT_CREDENTIALS = True
|
|||||||
# The attestation type to use in MakeCredential responses. If false, then self attestation will be used.
|
# The attestation type to use in MakeCredential responses. If false, then self attestation will be used.
|
||||||
_USE_BASIC_ATTESTATION = False
|
_USE_BASIC_ATTESTATION = False
|
||||||
|
|
||||||
|
# The CID of the last WINK command. Used to ensure that we do only one WINK at a time on any given CID.
|
||||||
|
_last_wink_cid = 0
|
||||||
|
|
||||||
|
|
||||||
class CborError(Exception):
|
class CborError(Exception):
|
||||||
def __init__(self, code: int):
|
def __init__(self, code: int):
|
||||||
@ -1027,8 +1030,7 @@ def dispatch_cmd(req: Cmd, dialog_mgr: DialogManager) -> Optional[Cmd]:
|
|||||||
elif req.cmd == _CMD_WINK:
|
elif req.cmd == _CMD_WINK:
|
||||||
if __debug__:
|
if __debug__:
|
||||||
log.debug(__name__, "_CMD_WINK")
|
log.debug(__name__, "_CMD_WINK")
|
||||||
ui.alert()
|
return cmd_wink(req)
|
||||||
return req
|
|
||||||
elif req.cmd == _CMD_CBOR and _ALLOW_FIDO2:
|
elif req.cmd == _CMD_CBOR and _ALLOW_FIDO2:
|
||||||
if not req.data:
|
if not req.data:
|
||||||
return cmd_error(req.cid, _ERR_INVALID_LEN)
|
return cmd_error(req.cid, _ERR_INVALID_LEN)
|
||||||
@ -1092,6 +1094,14 @@ def cmd_init(req: Cmd) -> Cmd:
|
|||||||
return Cmd(req.cid, req.cmd, buf)
|
return Cmd(req.cid, req.cmd, buf)
|
||||||
|
|
||||||
|
|
||||||
|
def cmd_wink(req: Cmd) -> Cmd:
|
||||||
|
global _last_wink_cid
|
||||||
|
if _last_wink_cid != req.cid:
|
||||||
|
_last_wink_cid = req.cid
|
||||||
|
ui.alert()
|
||||||
|
return req
|
||||||
|
|
||||||
|
|
||||||
def msg_register(req: Msg, dialog_mgr: DialogManager) -> Cmd:
|
def msg_register(req: Msg, dialog_mgr: DialogManager) -> Cmd:
|
||||||
if not storage.is_initialized():
|
if not storage.is_initialized():
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
Loading…
Reference in New Issue
Block a user