Skip to content

Commit

Permalink
forbid circular proxying
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Nov 5, 2024
1 parent 371ff67 commit e228831
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions qubesctap/client/qctap_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import itertools
import logging
import signal
import platform

from fido2.ctap1 import APDU, ApduError, RegistrationData, SignatureData
from fido2.ctap2 import AssertionResponse, AttestationResponse, Ctap2
Expand All @@ -39,6 +40,10 @@
from qubesctap.util import int_to_bytes


class ArgumentError(RuntimeError):
pass


class CTAPHIDQrexecDevice(hidemu.CTAPHIDDevice):
"""U2DHIDDevice proxied over qrexec"""
qrexec_client = const.QREXEC_CLIENT
Expand All @@ -48,8 +53,13 @@ def __init__(self, vmname, *, name=None, **kwargs):
if name is None:
name = f'Qubes OS CTAP proxy to {vmname}'
super().__init__(name=name, **kwargs)
if platform.node() == vmname:
raise ArgumentError(
f"Can't proxy CTAP messages circularly {vmname}->{vmname}. "
"Exiting.")
self.vmname = vmname


async def qrexec_transaction(self, request: RequestWrapper, rpcname: str):
"""Execute one transaction over qrexec"""
self.log.getChild('qrexec').debug(
Expand Down

0 comments on commit e228831

Please sign in to comment.