Skip to content

sys/fido2: update tests#20876

Merged
mguetschow merged 6 commits intoRIOT-OS:masterfrom
Ollrogge:fido2_update_tests
Mar 25, 2025
Merged

sys/fido2: update tests#20876
mguetschow merged 6 commits intoRIOT-OS:masterfrom
Ollrogge:fido2_update_tests

Conversation

@Ollrogge
Copy link
Copy Markdown
Member

Contribution description

Update the fido2 test package to the latest version. Also fix a small bug in the GetAssertion & GetNextAssertion behavior which became apparent because a new test failed.

I ran all tests using the nrf5284dk and reached 100% with the ctap fix.

Testing procedure

  • /sys/sys/fido2_ctap

@github-actions github-actions bot added Area: tests Area: tests and testing framework Area: pkg Area: External package ports Area: sys Area: System labels Sep 28, 2024
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Sep 30, 2024
@benpicco benpicco requested a review from mguetschow September 30, 2024 15:41
@riot-ci
Copy link
Copy Markdown

riot-ci commented Sep 30, 2024

Murdock results

✔️ PASSED

771d8b2 sys/fido2: adjust board whitelist for tests

Success Failures Total Runtime
10287 0 10287 10m:27s

Artifacts

@Ollrogge
Copy link
Copy Markdown
Member Author

@mguetschow or @leandrolanzieri can you take a look ?

@mguetschow
Copy link
Copy Markdown
Contributor

Just wanted to take the opportunity at the Hack'n'ACK to have a look, but I cannot get the test to run on my machine on current master for nrf52840dk. python3 tests/sys/fido2_ctap/reset.py says Unable to find authenticator after flashing. Any tips what to try next?

@Ollrogge
Copy link
Copy Markdown
Member Author

Just wanted to take the opportunity at the Hack'n'ACK to have a look, but I cannot get the test to run on my machine on current master for nrf52840dk. python3 tests/sys/fido2_ctap/reset.py says Unable to find authenticator after flashing. Any tips what to try next?

Did you connect a cable to the second USB port ? This is needed.

@mguetschow
Copy link
Copy Markdown
Contributor

Ah no, that was it. Seemed to work on master now, will have a look at the PR again in the next time. Maybe something worth documenting in the test's README?

@Ollrogge
Copy link
Copy Markdown
Member Author

Ah no, that was it. Seemed to work on master now, will have a look at the PR again in the next time. Maybe something worth documenting in the test's README?

Yeah good idea. I can add this information to the README

@Teufelchen1
Copy link
Copy Markdown
Contributor

Is this blocked by waiting for the change in the README?

@mguetschow
Copy link
Copy Markdown
Contributor

No, by someone (maybe me) not looking at it again as promised 🙈 Will add it to my todo list for the Hack'n'ACK on Tuesday.

@mguetschow
Copy link
Copy Markdown
Contributor

@Ollrogge just had another look. It works on master now, but there seems to be a merge conflict with this PR (some changes to tests/sys/fido2_ctap/Makefile missing in the commits). While make -C tests/sys/fido2_ctap BOARD=nrf52840dk flash test works for me on master, running make -C tests/sys/fido2_ctap BOARD=nrf52840dk fido2-test on this branch fails for me with

/bin/sh: 1: python: not found
...
venv/bin/pytest --ignore=tests/standard/fido2v1 --ignore=tests/standard/fido2/extensions --ignore=tests/standard/u2f --ignore tests/standard/fido2/user_presence -k "not test_ctap1_interop and not test_rk_maximum_list_capacity_per_rp_nodisplay and not test_keep_alive" tests/standard/ -s
/bin/sh: 1: venv/bin/pytest: not found

@mguetschow
Copy link
Copy Markdown
Contributor

Would you mind rebasing on master to also see the complete diff in Github?

@github-actions github-actions bot added the Area: doc Area: Documentation label Jan 29, 2025
@Ollrogge Ollrogge force-pushed the fido2_update_tests branch 2 times, most recently from bcd8c11 to 2664410 Compare January 29, 2025 18:45
@Ollrogge
Copy link
Copy Markdown
Member Author

@Ollrogge just had another look. It works on master now, but there seems to be a merge conflict with this PR (some changes to tests/sys/fido2_ctap/Makefile missing in the commits). While make -C tests/sys/fido2_ctap BOARD=nrf52840dk flash test works for me on master, running make -C tests/sys/fido2_ctap BOARD=nrf52840dk fido2-test on this branch fails for me with

/bin/sh: 1: python: not found
...
venv/bin/pytest --ignore=tests/standard/fido2v1 --ignore=tests/standard/fido2/extensions --ignore=tests/standard/u2f --ignore tests/standard/fido2/user_presence -k "not test_ctap1_interop and not test_rk_maximum_list_capacity_per_rp_nodisplay and not test_keep_alive" tests/standard/ -s
/bin/sh: 1: venv/bin/pytest: not found

I think this was because you didn't first build the application itself. This is required because it also builds the fido2-tests pkg and sets up the virtual python environment

@Ollrogge
Copy link
Copy Markdown
Member Author

Would you mind rebasing on master to also see the complete diff in Github?

Done + improved the README

@Ollrogge
Copy link
Copy Markdown
Member Author

@mguetschow can you take another look when you have time ? :)

Copy link
Copy Markdown
Contributor

@mguetschow mguetschow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make fido2-test now worked for me, but make fido2-test-up (after adapting the Makefile to include CFLAGS += -DCONFIG_FIDO2_CTAP_DISABLE_UP=0 and reflashing) always gives:

make -C tests/sys/fido2_ctap_hid BOARD=nrf52840dk fido2-test-up 
make: Entering directory '/home/mikolai/TUD/Code/RIOT/tests/sys/fido2_ctap_hid'
env -i PATH=/home/mikolai/.deno/bin:/home/mikolai/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/mikolai/.local/bin:/home/mikolai/.local/bin:/home/mikolai/.vscode-oss/extensions/ms-python.debugpy-2025.0.0-linux-x64/bundled/scripts/noConfigScripts:/home/mikolai/.local/bin make -C /home/mikolai/.riot/pkg/fido2_tests up-tests
make: Entering directory '/home/mikolai/.riot/pkg/fido2_tests'
/bin/sh: 1: python: not found
/bin/sh: 1: python: not found
venv/bin/pytest tests/standard/fido2/user_presence -s
================================================================================================================================================================================ test session starts ================================================================================================================================================================================
platform linux -- Python 3.11.2, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/mikolai/.riot/pkg/fido2_tests
plugins: ordering-0.6, timeout-2.3.1, rerunfailures-15.0
collected 6 items                                                                                                                                                                                                                                                                                                                                                                   

tests/standard/fido2/user_presence/test_user_presence.py --- HID ---
[CtapHidDevice(/dev/hidraw5)]
Resetting Authenticator...
EEEsEDO NOT ACTIVATE UP
.

====================================================================================================================================================================================== ERRORS =======================================================================================================================================================================================
________________________________________________________________________________________________________________________________________________________ ERROR at setup of TestUserPresence.test_user_presence_instructions _________________________________________________________________________________________________________________________________________________________

device = <tests.conftest.TestDevice object at 0x7f230c092f50>, MCRes = AttestationObject(fmt: 'packed', auth_data: AuthenticatorData(rp_id_hash: h'bfabc37432958b063360d3ad6461c9c4735ae7f8ed...\xcd\xf7{\x02!\x00\xe7\xff\x8e\x0420\x85\xd3a\x13\xda\xa2!\x1c\xd5z\xd1\x1a\xbfU\x0b\x1a\xb9&\xcev\x92W\xad\xd7\xf7s'})

    @pytest.fixture(scope="class")
    def GARes(device, MCRes):
        req = FidoRequest(
            allow_list=[
                {"id": MCRes.auth_data.credential_data.credential_id, "type": "public-key"}
            ]
        )
>       res = device.sendGA(*req.toGA())

tests/conftest.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:464: in sendGA
    return self.ctap2.get_assertion(*args, **kwargs)
venv/lib/python3.11/site-packages/fido2/ctap2.py:734: in get_assertion
    return self.send_cbor(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <fido2.ctap2.CTAP2 object at 0x7f230adec450>, cmd = <CMD.GET_ASSERTION: 2>, data = {1: 'example.org', 2: b'123456789abcdef0123456789abcdef0', 3: [{'id': b"k>,\xa1z\xdbsz\xc5\xa4\x00\x86\xccB\xf1\x8d\xe...t\xd4@)\x01\x08\xf5+\xde\x1f\xcf,Z\x12\x1e\xcb_\xc7\xdbUp\xba|4\x1cF\xf9\x0fTO7\xc9\x85}\x9a)", 'type': 'public-key'}]}, event = None
parse = <class 'fido2.ctap2.AssertionResponse'>, on_keepalive = <tests.vendor.solo.utils.DeviceSelectCredential object at 0x7f230adb5350>

    def send_cbor(
        self, cmd, data=None, event=None, parse=cbor.decode, on_keepalive=None
    ):
        """Sends a CBOR message to the device, and waits for a response.
    
        :param cmd: The command byte of the request.
        :param data: The payload to send (to be CBOR encoded).
        :param event: Optional threading.Event used to cancel the request.
        :param parse: Function used to parse the binary response data, defaults
            to parsing the CBOR.
        :param on_keepalive: Optional function called when keep-alive is sent by
            the authenticator.
        :return: The result of calling the parse function on the response data
            (defaults to the CBOR decoded value).
        """
        request = struct.pack(">B", cmd)
        if data is not None:
            request += cbor.encode(data)
        response = self.device.call(CTAPHID.CBOR, request, event, on_keepalive)
        status = six.indexbytes(response, 0)
        if status != 0x00:
>           raise CtapError(status)
E           fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED

venv/lib/python3.11/site-packages/fido2/ctap2.py:645: CtapError
_______________________________________________________________________________________________________________________________________________________________ ERROR at setup of TestUserPresence.test_user_presence _______________________________________________________________________________________________________________________________________________________________

device = <tests.conftest.TestDevice object at 0x7f230c092f50>, MCRes = AttestationObject(fmt: 'packed', auth_data: AuthenticatorData(rp_id_hash: h'bfabc37432958b063360d3ad6461c9c4735ae7f8ed...\xcd\xf7{\x02!\x00\xe7\xff\x8e\x0420\x85\xd3a\x13\xda\xa2!\x1c\xd5z\xd1\x1a\xbfU\x0b\x1a\xb9&\xcev\x92W\xad\xd7\xf7s'})

    @pytest.fixture(scope="class")
    def GARes(device, MCRes):
        req = FidoRequest(
            allow_list=[
                {"id": MCRes.auth_data.credential_data.credential_id, "type": "public-key"}
            ]
        )
>       res = device.sendGA(*req.toGA())

tests/conftest.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:464: in sendGA
    return self.ctap2.get_assertion(*args, **kwargs)
venv/lib/python3.11/site-packages/fido2/ctap2.py:734: in get_assertion
    return self.send_cbor(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <fido2.ctap2.CTAP2 object at 0x7f230adec450>, cmd = <CMD.GET_ASSERTION: 2>, data = {1: 'example.org', 2: b'123456789abcdef0123456789abcdef0', 3: [{'id': b"k>,\xa1z\xdbsz\xc5\xa4\x00\x86\xccB\xf1\x8d\xe...t\xd4@)\x01\x08\xf5+\xde\x1f\xcf,Z\x12\x1e\xcb_\xc7\xdbUp\xba|4\x1cF\xf9\x0fTO7\xc9\x85}\x9a)", 'type': 'public-key'}]}, event = None
parse = <class 'fido2.ctap2.AssertionResponse'>, on_keepalive = <tests.vendor.solo.utils.DeviceSelectCredential object at 0x7f230adb5350>

    def send_cbor(
        self, cmd, data=None, event=None, parse=cbor.decode, on_keepalive=None
    ):
        """Sends a CBOR message to the device, and waits for a response.
    
        :param cmd: The command byte of the request.
        :param data: The payload to send (to be CBOR encoded).
        :param event: Optional threading.Event used to cancel the request.
        :param parse: Function used to parse the binary response data, defaults
            to parsing the CBOR.
        :param on_keepalive: Optional function called when keep-alive is sent by
            the authenticator.
        :return: The result of calling the parse function on the response data
            (defaults to the CBOR decoded value).
        """
        request = struct.pack(">B", cmd)
        if data is not None:
            request += cbor.encode(data)
        response = self.device.call(CTAPHID.CBOR, request, event, on_keepalive)
        status = six.indexbytes(response, 0)
        if status != 0x00:
>           raise CtapError(status)
E           fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED

venv/lib/python3.11/site-packages/fido2/ctap2.py:645: CtapError
_____________________________________________________________________________________________________________________________________________________________ ERROR at setup of TestUserPresence.test_no_user_presence ______________________________________________________________________________________________________________________________________________________________

device = <tests.conftest.TestDevice object at 0x7f230c092f50>, MCRes = AttestationObject(fmt: 'packed', auth_data: AuthenticatorData(rp_id_hash: h'bfabc37432958b063360d3ad6461c9c4735ae7f8ed...\xcd\xf7{\x02!\x00\xe7\xff\x8e\x0420\x85\xd3a\x13\xda\xa2!\x1c\xd5z\xd1\x1a\xbfU\x0b\x1a\xb9&\xcev\x92W\xad\xd7\xf7s'})

    @pytest.fixture(scope="class")
    def GARes(device, MCRes):
        req = FidoRequest(
            allow_list=[
                {"id": MCRes.auth_data.credential_data.credential_id, "type": "public-key"}
            ]
        )
>       res = device.sendGA(*req.toGA())

tests/conftest.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:464: in sendGA
    return self.ctap2.get_assertion(*args, **kwargs)
venv/lib/python3.11/site-packages/fido2/ctap2.py:734: in get_assertion
    return self.send_cbor(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <fido2.ctap2.CTAP2 object at 0x7f230adec450>, cmd = <CMD.GET_ASSERTION: 2>, data = {1: 'example.org', 2: b'123456789abcdef0123456789abcdef0', 3: [{'id': b"k>,\xa1z\xdbsz\xc5\xa4\x00\x86\xccB\xf1\x8d\xe...t\xd4@)\x01\x08\xf5+\xde\x1f\xcf,Z\x12\x1e\xcb_\xc7\xdbUp\xba|4\x1cF\xf9\x0fTO7\xc9\x85}\x9a)", 'type': 'public-key'}]}, event = None
parse = <class 'fido2.ctap2.AssertionResponse'>, on_keepalive = <tests.vendor.solo.utils.DeviceSelectCredential object at 0x7f230adb5350>

    def send_cbor(
        self, cmd, data=None, event=None, parse=cbor.decode, on_keepalive=None
    ):
        """Sends a CBOR message to the device, and waits for a response.
    
        :param cmd: The command byte of the request.
        :param data: The payload to send (to be CBOR encoded).
        :param event: Optional threading.Event used to cancel the request.
        :param parse: Function used to parse the binary response data, defaults
            to parsing the CBOR.
        :param on_keepalive: Optional function called when keep-alive is sent by
            the authenticator.
        :return: The result of calling the parse function on the response data
            (defaults to the CBOR decoded value).
        """
        request = struct.pack(">B", cmd)
        if data is not None:
            request += cbor.encode(data)
        response = self.device.call(CTAPHID.CBOR, request, event, on_keepalive)
        status = six.indexbytes(response, 0)
        if status != 0x00:
>           raise CtapError(status)
E           fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED

venv/lib/python3.11/site-packages/fido2/ctap2.py:645: CtapError
________________________________________________________________________________________________________________________________________________ ERROR at setup of TestUserPresence.test_user_presence_option_false_on_get_assertion ________________________________________________________________________________________________________________________________________________

device = <tests.conftest.TestDevice object at 0x7f230c092f50>, MCRes = AttestationObject(fmt: 'packed', auth_data: AuthenticatorData(rp_id_hash: h'bfabc37432958b063360d3ad6461c9c4735ae7f8ed...\xcd\xf7{\x02!\x00\xe7\xff\x8e\x0420\x85\xd3a\x13\xda\xa2!\x1c\xd5z\xd1\x1a\xbfU\x0b\x1a\xb9&\xcev\x92W\xad\xd7\xf7s'})

    @pytest.fixture(scope="class")
    def GARes(device, MCRes):
        req = FidoRequest(
            allow_list=[
                {"id": MCRes.auth_data.credential_data.credential_id, "type": "public-key"}
            ]
        )
>       res = device.sendGA(*req.toGA())

tests/conftest.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:464: in sendGA
    return self.ctap2.get_assertion(*args, **kwargs)
venv/lib/python3.11/site-packages/fido2/ctap2.py:734: in get_assertion
    return self.send_cbor(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <fido2.ctap2.CTAP2 object at 0x7f230adec450>, cmd = <CMD.GET_ASSERTION: 2>, data = {1: 'example.org', 2: b'123456789abcdef0123456789abcdef0', 3: [{'id': b"k>,\xa1z\xdbsz\xc5\xa4\x00\x86\xccB\xf1\x8d\xe...t\xd4@)\x01\x08\xf5+\xde\x1f\xcf,Z\x12\x1e\xcb_\xc7\xdbUp\xba|4\x1cF\xf9\x0fTO7\xc9\x85}\x9a)", 'type': 'public-key'}]}, event = None
parse = <class 'fido2.ctap2.AssertionResponse'>, on_keepalive = <tests.vendor.solo.utils.DeviceSelectCredential object at 0x7f230adb5350>

    def send_cbor(
        self, cmd, data=None, event=None, parse=cbor.decode, on_keepalive=None
    ):
        """Sends a CBOR message to the device, and waits for a response.
    
        :param cmd: The command byte of the request.
        :param data: The payload to send (to be CBOR encoded).
        :param event: Optional threading.Event used to cancel the request.
        :param parse: Function used to parse the binary response data, defaults
            to parsing the CBOR.
        :param on_keepalive: Optional function called when keep-alive is sent by
            the authenticator.
        :return: The result of calling the parse function on the response data
            (defaults to the CBOR decoded value).
        """
        request = struct.pack(">B", cmd)
        if data is not None:
            request += cbor.encode(data)
        response = self.device.call(CTAPHID.CBOR, request, event, on_keepalive)
        status = six.indexbytes(response, 0)
        if status != 0x00:
>           raise CtapError(status)
E           fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED

venv/lib/python3.11/site-packages/fido2/ctap2.py:645: CtapError
================================================================================================================================================================================= warnings summary ==================================================================================================================================================================================
<frozen importlib._bootstrap>:241
  <frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute

<frozen importlib._bootstrap>:241
  <frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================================================================================================== short test summary info ==============================================================================================================================================================================
ERROR tests/standard/fido2/user_presence/test_user_presence.py::TestUserPresence::test_user_presence_instructions - fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED
ERROR tests/standard/fido2/user_presence/test_user_presence.py::TestUserPresence::test_user_presence - fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED
ERROR tests/standard/fido2/user_presence/test_user_presence.py::TestUserPresence::test_no_user_presence - fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED
ERROR tests/standard/fido2/user_presence/test_user_presence.py::TestUserPresence::test_user_presence_option_false_on_get_assertion - fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED
================================================================================================================================================================ 1 passed, 1 skipped, 2 warnings, 4 errors in 2.25s =================================================================================================================================================================
sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
make: *** [Makefile:22: up-tests] Error 1
make: Leaving directory '/home/mikolai/.riot/pkg/fido2_tests'
make: *** [Makefile:39: fido2-test-up] Error 2
make: Leaving directory '/home/mikolai/TUD/Code/RIOT/tests/sys/fido2_ctap_hid'

I've tried cleaning the build artifacts, including manually removing venv, but that didn't change anything. Any idea what could be the cause?

@Ollrogge
Copy link
Copy Markdown
Member Author

Ollrogge commented Feb 17, 2025

make fido2-test now worked for me, but make fido2-test-up (after adapting the Makefile to include CFLAGS += -DCONFIG_FIDO2_CTAP_DISABLE_UP=0 and reflashing) always gives:

make -C tests/sys/fido2_ctap_hid BOARD=nrf52840dk fido2-test-up 
make: Entering directory '/home/mikolai/TUD/Code/RIOT/tests/sys/fido2_ctap_hid'
env -i PATH=/home/mikolai/.deno/bin:/home/mikolai/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/mikolai/.local/bin:/home/mikolai/.local/bin:/home/mikolai/.vscode-oss/extensions/ms-python.debugpy-2025.0.0-linux-x64/bundled/scripts/noConfigScripts:/home/mikolai/.local/bin make -C /home/mikolai/.riot/pkg/fido2_tests up-tests
make: Entering directory '/home/mikolai/.riot/pkg/fido2_tests'
/bin/sh: 1: python: not found
/bin/sh: 1: python: not found
venv/bin/pytest tests/standard/fido2/user_presence -s
================================================================================================================================================================================ test session starts ================================================================================================================================================================================
platform linux -- Python 3.11.2, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/mikolai/.riot/pkg/fido2_tests
plugins: ordering-0.6, timeout-2.3.1, rerunfailures-15.0
collected 6 items                                                                                                                                                                                                                                                                                                                                                                   

tests/standard/fido2/user_presence/test_user_presence.py --- HID ---
[CtapHidDevice(/dev/hidraw5)]
Resetting Authenticator...
EEEsEDO NOT ACTIVATE UP
.

====================================================================================================================================================================================== ERRORS =======================================================================================================================================================================================
________________________________________________________________________________________________________________________________________________________ ERROR at setup of TestUserPresence.test_user_presence_instructions _________________________________________________________________________________________________________________________________________________________

device = <tests.conftest.TestDevice object at 0x7f230c092f50>, MCRes = AttestationObject(fmt: 'packed', auth_data: AuthenticatorData(rp_id_hash: h'bfabc37432958b063360d3ad6461c9c4735ae7f8ed...\xcd\xf7{\x02!\x00\xe7\xff\x8e\x0420\x85\xd3a\x13\xda\xa2!\x1c\xd5z\xd1\x1a\xbfU\x0b\x1a\xb9&\xcev\x92W\xad\xd7\xf7s'})

    @pytest.fixture(scope="class")
    def GARes(device, MCRes):
        req = FidoRequest(
            allow_list=[
                {"id": MCRes.auth_data.credential_data.credential_id, "type": "public-key"}
            ]
        )
>       res = device.sendGA(*req.toGA())

tests/conftest.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:464: in sendGA
    return self.ctap2.get_assertion(*args, **kwargs)
venv/lib/python3.11/site-packages/fido2/ctap2.py:734: in get_assertion
    return self.send_cbor(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <fido2.ctap2.CTAP2 object at 0x7f230adec450>, cmd = <CMD.GET_ASSERTION: 2>, data = {1: 'example.org', 2: b'123456789abcdef0123456789abcdef0', 3: [{'id': b"k>,\xa1z\xdbsz\xc5\xa4\x00\x86\xccB\xf1\x8d\xe...t\xd4@)\x01\x08\xf5+\xde\x1f\xcf,Z\x12\x1e\xcb_\xc7\xdbUp\xba|4\x1cF\xf9\x0fTO7\xc9\x85}\x9a)", 'type': 'public-key'}]}, event = None
parse = <class 'fido2.ctap2.AssertionResponse'>, on_keepalive = <tests.vendor.solo.utils.DeviceSelectCredential object at 0x7f230adb5350>

    def send_cbor(
        self, cmd, data=None, event=None, parse=cbor.decode, on_keepalive=None
    ):
        """Sends a CBOR message to the device, and waits for a response.
    
        :param cmd: The command byte of the request.
        :param data: The payload to send (to be CBOR encoded).
        :param event: Optional threading.Event used to cancel the request.
        :param parse: Function used to parse the binary response data, defaults
            to parsing the CBOR.
        :param on_keepalive: Optional function called when keep-alive is sent by
            the authenticator.
        :return: The result of calling the parse function on the response data
            (defaults to the CBOR decoded value).
        """
        request = struct.pack(">B", cmd)
        if data is not None:
            request += cbor.encode(data)
        response = self.device.call(CTAPHID.CBOR, request, event, on_keepalive)
        status = six.indexbytes(response, 0)
        if status != 0x00:
>           raise CtapError(status)
E           fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED

venv/lib/python3.11/site-packages/fido2/ctap2.py:645: CtapError
_______________________________________________________________________________________________________________________________________________________________ ERROR at setup of TestUserPresence.test_user_presence _______________________________________________________________________________________________________________________________________________________________

device = <tests.conftest.TestDevice object at 0x7f230c092f50>, MCRes = AttestationObject(fmt: 'packed', auth_data: AuthenticatorData(rp_id_hash: h'bfabc37432958b063360d3ad6461c9c4735ae7f8ed...\xcd\xf7{\x02!\x00\xe7\xff\x8e\x0420\x85\xd3a\x13\xda\xa2!\x1c\xd5z\xd1\x1a\xbfU\x0b\x1a\xb9&\xcev\x92W\xad\xd7\xf7s'})

    @pytest.fixture(scope="class")
    def GARes(device, MCRes):
        req = FidoRequest(
            allow_list=[
                {"id": MCRes.auth_data.credential_data.credential_id, "type": "public-key"}
            ]
        )
>       res = device.sendGA(*req.toGA())

tests/conftest.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:464: in sendGA
    return self.ctap2.get_assertion(*args, **kwargs)
venv/lib/python3.11/site-packages/fido2/ctap2.py:734: in get_assertion
    return self.send_cbor(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <fido2.ctap2.CTAP2 object at 0x7f230adec450>, cmd = <CMD.GET_ASSERTION: 2>, data = {1: 'example.org', 2: b'123456789abcdef0123456789abcdef0', 3: [{'id': b"k>,\xa1z\xdbsz\xc5\xa4\x00\x86\xccB\xf1\x8d\xe...t\xd4@)\x01\x08\xf5+\xde\x1f\xcf,Z\x12\x1e\xcb_\xc7\xdbUp\xba|4\x1cF\xf9\x0fTO7\xc9\x85}\x9a)", 'type': 'public-key'}]}, event = None
parse = <class 'fido2.ctap2.AssertionResponse'>, on_keepalive = <tests.vendor.solo.utils.DeviceSelectCredential object at 0x7f230adb5350>

    def send_cbor(
        self, cmd, data=None, event=None, parse=cbor.decode, on_keepalive=None
    ):
        """Sends a CBOR message to the device, and waits for a response.
    
        :param cmd: The command byte of the request.
        :param data: The payload to send (to be CBOR encoded).
        :param event: Optional threading.Event used to cancel the request.
        :param parse: Function used to parse the binary response data, defaults
            to parsing the CBOR.
        :param on_keepalive: Optional function called when keep-alive is sent by
            the authenticator.
        :return: The result of calling the parse function on the response data
            (defaults to the CBOR decoded value).
        """
        request = struct.pack(">B", cmd)
        if data is not None:
            request += cbor.encode(data)
        response = self.device.call(CTAPHID.CBOR, request, event, on_keepalive)
        status = six.indexbytes(response, 0)
        if status != 0x00:
>           raise CtapError(status)
E           fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED

venv/lib/python3.11/site-packages/fido2/ctap2.py:645: CtapError
_____________________________________________________________________________________________________________________________________________________________ ERROR at setup of TestUserPresence.test_no_user_presence ______________________________________________________________________________________________________________________________________________________________

device = <tests.conftest.TestDevice object at 0x7f230c092f50>, MCRes = AttestationObject(fmt: 'packed', auth_data: AuthenticatorData(rp_id_hash: h'bfabc37432958b063360d3ad6461c9c4735ae7f8ed...\xcd\xf7{\x02!\x00\xe7\xff\x8e\x0420\x85\xd3a\x13\xda\xa2!\x1c\xd5z\xd1\x1a\xbfU\x0b\x1a\xb9&\xcev\x92W\xad\xd7\xf7s'})

    @pytest.fixture(scope="class")
    def GARes(device, MCRes):
        req = FidoRequest(
            allow_list=[
                {"id": MCRes.auth_data.credential_data.credential_id, "type": "public-key"}
            ]
        )
>       res = device.sendGA(*req.toGA())

tests/conftest.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:464: in sendGA
    return self.ctap2.get_assertion(*args, **kwargs)
venv/lib/python3.11/site-packages/fido2/ctap2.py:734: in get_assertion
    return self.send_cbor(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <fido2.ctap2.CTAP2 object at 0x7f230adec450>, cmd = <CMD.GET_ASSERTION: 2>, data = {1: 'example.org', 2: b'123456789abcdef0123456789abcdef0', 3: [{'id': b"k>,\xa1z\xdbsz\xc5\xa4\x00\x86\xccB\xf1\x8d\xe...t\xd4@)\x01\x08\xf5+\xde\x1f\xcf,Z\x12\x1e\xcb_\xc7\xdbUp\xba|4\x1cF\xf9\x0fTO7\xc9\x85}\x9a)", 'type': 'public-key'}]}, event = None
parse = <class 'fido2.ctap2.AssertionResponse'>, on_keepalive = <tests.vendor.solo.utils.DeviceSelectCredential object at 0x7f230adb5350>

    def send_cbor(
        self, cmd, data=None, event=None, parse=cbor.decode, on_keepalive=None
    ):
        """Sends a CBOR message to the device, and waits for a response.
    
        :param cmd: The command byte of the request.
        :param data: The payload to send (to be CBOR encoded).
        :param event: Optional threading.Event used to cancel the request.
        :param parse: Function used to parse the binary response data, defaults
            to parsing the CBOR.
        :param on_keepalive: Optional function called when keep-alive is sent by
            the authenticator.
        :return: The result of calling the parse function on the response data
            (defaults to the CBOR decoded value).
        """
        request = struct.pack(">B", cmd)
        if data is not None:
            request += cbor.encode(data)
        response = self.device.call(CTAPHID.CBOR, request, event, on_keepalive)
        status = six.indexbytes(response, 0)
        if status != 0x00:
>           raise CtapError(status)
E           fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED

venv/lib/python3.11/site-packages/fido2/ctap2.py:645: CtapError
________________________________________________________________________________________________________________________________________________ ERROR at setup of TestUserPresence.test_user_presence_option_false_on_get_assertion ________________________________________________________________________________________________________________________________________________

device = <tests.conftest.TestDevice object at 0x7f230c092f50>, MCRes = AttestationObject(fmt: 'packed', auth_data: AuthenticatorData(rp_id_hash: h'bfabc37432958b063360d3ad6461c9c4735ae7f8ed...\xcd\xf7{\x02!\x00\xe7\xff\x8e\x0420\x85\xd3a\x13\xda\xa2!\x1c\xd5z\xd1\x1a\xbfU\x0b\x1a\xb9&\xcev\x92W\xad\xd7\xf7s'})

    @pytest.fixture(scope="class")
    def GARes(device, MCRes):
        req = FidoRequest(
            allow_list=[
                {"id": MCRes.auth_data.credential_data.credential_id, "type": "public-key"}
            ]
        )
>       res = device.sendGA(*req.toGA())

tests/conftest.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:464: in sendGA
    return self.ctap2.get_assertion(*args, **kwargs)
venv/lib/python3.11/site-packages/fido2/ctap2.py:734: in get_assertion
    return self.send_cbor(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <fido2.ctap2.CTAP2 object at 0x7f230adec450>, cmd = <CMD.GET_ASSERTION: 2>, data = {1: 'example.org', 2: b'123456789abcdef0123456789abcdef0', 3: [{'id': b"k>,\xa1z\xdbsz\xc5\xa4\x00\x86\xccB\xf1\x8d\xe...t\xd4@)\x01\x08\xf5+\xde\x1f\xcf,Z\x12\x1e\xcb_\xc7\xdbUp\xba|4\x1cF\xf9\x0fTO7\xc9\x85}\x9a)", 'type': 'public-key'}]}, event = None
parse = <class 'fido2.ctap2.AssertionResponse'>, on_keepalive = <tests.vendor.solo.utils.DeviceSelectCredential object at 0x7f230adb5350>

    def send_cbor(
        self, cmd, data=None, event=None, parse=cbor.decode, on_keepalive=None
    ):
        """Sends a CBOR message to the device, and waits for a response.
    
        :param cmd: The command byte of the request.
        :param data: The payload to send (to be CBOR encoded).
        :param event: Optional threading.Event used to cancel the request.
        :param parse: Function used to parse the binary response data, defaults
            to parsing the CBOR.
        :param on_keepalive: Optional function called when keep-alive is sent by
            the authenticator.
        :return: The result of calling the parse function on the response data
            (defaults to the CBOR decoded value).
        """
        request = struct.pack(">B", cmd)
        if data is not None:
            request += cbor.encode(data)
        response = self.device.call(CTAPHID.CBOR, request, event, on_keepalive)
        status = six.indexbytes(response, 0)
        if status != 0x00:
>           raise CtapError(status)
E           fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED

venv/lib/python3.11/site-packages/fido2/ctap2.py:645: CtapError
================================================================================================================================================================================= warnings summary ==================================================================================================================================================================================
<frozen importlib._bootstrap>:241
  <frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute

<frozen importlib._bootstrap>:241
  <frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================================================================================================== short test summary info ==============================================================================================================================================================================
ERROR tests/standard/fido2/user_presence/test_user_presence.py::TestUserPresence::test_user_presence_instructions - fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED
ERROR tests/standard/fido2/user_presence/test_user_presence.py::TestUserPresence::test_user_presence - fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED
ERROR tests/standard/fido2/user_presence/test_user_presence.py::TestUserPresence::test_no_user_presence - fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED
ERROR tests/standard/fido2/user_presence/test_user_presence.py::TestUserPresence::test_user_presence_option_false_on_get_assertion - fido2.ctap.CtapError: CTAP error: 0x27 - OPERATION_DENIED
================================================================================================================================================================ 1 passed, 1 skipped, 2 warnings, 4 errors in 2.25s =================================================================================================================================================================
sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
make: *** [Makefile:22: up-tests] Error 1
make: Leaving directory '/home/mikolai/.riot/pkg/fido2_tests'
make: *** [Makefile:39: fido2-test-up] Error 2
make: Leaving directory '/home/mikolai/TUD/Code/RIOT/tests/sys/fido2_ctap_hid'

I've tried cleaning the build artifacts, including manually removing venv, but that didn't change anything. Any idea what could be the cause?

Fixed. This was a bug that caused the authenticator to not wait when user presence tests are enabled, but LED animations disabled. I would recommend enabling the LED animations as well, since it makes it easier to see when to press the button.

@Ollrogge Ollrogge force-pushed the fido2_update_tests branch 2 times, most recently from 56d84ed to a120801 Compare February 17, 2025 21:40
Copy link
Copy Markdown
Contributor

@mguetschow mguetschow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two more nits, will test it again tomorrow during Hack'n'ACK.

@mguetschow
Copy link
Copy Markdown
Contributor

Just had another try with the newest commit, and test-fido2 still works, but I still get (after enabling both UP and LED):

make -C tests/sys/fido2_ctap_hid BOARD=nrf52840dk fido2-test-up
make: Entering directory '/home/mikolai/TUD/Code/RIOT/tests/sys/fido2_ctap_hid'
env -i PATH=/home/mikolai/.deno/bin:/home/mikolai/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/mikolai/.local/bin:/home/mikolai/.local/bin:/home/mikolai/.vscode-oss/extensions/ms-python.debugpy-2025.0.0-linux-x64/bundled/scripts/noConfigScripts:/home/mikolai/.local/bin make -C /home/mikolai/.riot/pkg/fido2_tests up-tests
make: Entering directory '/home/mikolai/.riot/pkg/fido2_tests'
/bin/sh: 1: python: not found
/bin/sh: 1: python: not found
venv/bin/pytest tests/standard/fido2/user_presence -s
========================================================================= test session starts =========================================================================
platform linux -- Python 3.11.2, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/mikolai/.riot/pkg/fido2_tests
plugins: ordering-0.6, timeout-2.3.1, rerunfailures-15.0
collected 6 items                                                                                                                                                     

tests/standard/fido2/user_presence/test_user_presence.py --- HID ---
[CtapHidDevice(/dev/hidraw2)]
Resetting Authenticator...


Starting User Presence (UP) tests.

Follow instructions.  You will have to give UP or not give UP to pass the tests.
.ACTIVATE UP ONCE
.DO NOT ACTIVATE UP
FsDO NOT ACTIVATE UP
.DO NOT ACTIVATE UP
.

============================================================================== FAILURES ===============================================================================
_______________________________________________________________ TestUserPresence.test_no_user_presence ________________________________________________________________

self = <test_user_presence.TestUserPresence object at 0x7fbd7d4e8e90>, device = <tests.conftest.TestDevice object at 0x7fbd7d4eb550>
MCRes = AttestationObject(fmt: 'packed', auth_data: AuthenticatorData(rp_id_hash: h'bfabc37432958b063360d3ad6461c9c4735ae7f8ed...\t\x1a\xa0\xc1X\x02!\x00\xf8\x8e\xa7K\xf45\xbctL\xae\x95y\x85C\x90kIgk\x1a\x9e\x1b9\x19\x88\x1eh\x97\xa1\x17\xd4\xa7'})
GARes = AssertionResponse(credential: {'id': b"\x03YK\xc1\xb2\xd4\xd7\x8e\x06V\xa63\xd5\x1f\x8c0(\xde\xbb\xa0\xf2X\xc8\xc3Sg\x...401b623c187160a079399ac476295ac863bcd7312b852a7350220553122995ff63995a3852730d1ee1f151eb8a1150688956c713546593c8c7f34')

    def test_no_user_presence(self, device, MCRes, GARes):
        print("DO NOT ACTIVATE UP")
>       with pytest.raises(CtapError) as e:
E       Failed: DID NOT RAISE <class 'fido2.ctap.CtapError'>

tests/standard/fido2/user_presence/test_user_presence.py:32: Failed
========================================================================== warnings summary ===========================================================================
<frozen importlib._bootstrap>:241
  <frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute

<frozen importlib._bootstrap>:241
  <frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================= short test summary info =======================================================================
FAILED tests/standard/fido2/user_presence/test_user_presence.py::TestUserPresence::test_no_user_presence - Failed: DID NOT RAISE <class 'fido2.ctap.CtapError'>
========================================================= 1 failed, 4 passed, 1 skipped, 2 warnings in 17.02s =========================================================
sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
make: *** [Makefile:22: up-tests] Error 1
make: Leaving directory '/home/mikolai/.riot/pkg/fido2_tests'
make: *** [Makefile:41: fido2-test-up] Error 2
make: Leaving directory '/home/mikolai/TUD/Code/RIOT/tests/sys/fido2_ctap_hid'

Can you double-check it works on your end?

@Ollrogge
Copy link
Copy Markdown
Member Author

Ollrogge commented Mar 2, 2025

Just tested it again:

make fido2-test-up
env -i PATH=/home/h0ps/.wasmtime/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib:/usr/local/games:/home/h0ps/go/bin:/home/h0ps/ExternalSoftware/Obsidian:/home/h0ps/.local/bin:/home/h0ps/.local/share/gem/ruby/3.0.0/bin:/bin:/home/h0ps/.rvm/bin:/home/h0ps/.cargo/bin:/home/h0ps/x-tools/aarch64-rpi3-linux-gnu/bin make -C /home/h0ps/Programming/RIOT/build/pkg/fido2_tests up-tests
make: Entering directory '/home/h0ps/Programming/RIOT/build/pkg/fido2_tests'
venv/bin/pytest tests/standard/fido2/user_presence -s
====================================== test session starts ======================================
platform linux -- Python 3.13.2, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/h0ps/Programming/RIOT/build/pkg/fido2_tests
plugins: rerunfailures-15.0, timeout-2.3.1, ordering-0.6
collected 6 items                                                                               

tests/standard/fido2/user_presence/test_user_presence.py --- HID ---
[CtapHidDevice(/dev/hidraw7)]
Resetting Authenticator...


Starting User Presence (UP) tests.

Follow instructions.  You will have to give UP or not give UP to pass the tests.
.ACTIVATE UP ONCE
.DO NOT ACTIVATE UP
.sDO NOT ACTIVATE UP
.DO NOT ACTIVATE UP
.

======================================= warnings summary ========================================
<frozen importlib._bootstrap>:488
  <frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute

<frozen importlib._bootstrap>:488
  <frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== 5 passed, 1 skipped, 2 warnings in 26.82s ===========================
<sys>:0: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
make: Leaving directory '/home/h0ps/Programming/RIOT/build/pkg/fido2_tests'

The UP tests seems to work for me on the nrf52840dongle (my nrf52840dk is broken and I am currently waiting for a new one). In total I had to click the button three times: twice before the tests started and once during the tests when I was prompted to do so.

The authenticator did not wait for user presence when user
presence tests were enabled, but LED animations were disabled.
@Ollrogge Ollrogge force-pushed the fido2_update_tests branch from e4b5bf5 to 3e3ad83 Compare March 11, 2025 20:11
@Ollrogge
Copy link
Copy Markdown
Member Author

Just tested it again:

make fido2-test-up
env -i PATH=/home/h0ps/.wasmtime/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib:/usr/local/games:/home/h0ps/go/bin:/home/h0ps/ExternalSoftware/Obsidian:/home/h0ps/.local/bin:/home/h0ps/.local/share/gem/ruby/3.0.0/bin:/bin:/home/h0ps/.rvm/bin:/home/h0ps/.cargo/bin:/home/h0ps/x-tools/aarch64-rpi3-linux-gnu/bin make -C /home/h0ps/Programming/RIOT/build/pkg/fido2_tests up-tests
make: Entering directory '/home/h0ps/Programming/RIOT/build/pkg/fido2_tests'
venv/bin/pytest tests/standard/fido2/user_presence -s
====================================== test session starts ======================================
platform linux -- Python 3.13.2, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/h0ps/Programming/RIOT/build/pkg/fido2_tests
plugins: rerunfailures-15.0, timeout-2.3.1, ordering-0.6
collected 6 items                                                                               

tests/standard/fido2/user_presence/test_user_presence.py --- HID ---
[CtapHidDevice(/dev/hidraw7)]
Resetting Authenticator...


Starting User Presence (UP) tests.

Follow instructions.  You will have to give UP or not give UP to pass the tests.
.ACTIVATE UP ONCE
.DO NOT ACTIVATE UP
.sDO NOT ACTIVATE UP
.DO NOT ACTIVATE UP
.

======================================= warnings summary ========================================
<frozen importlib._bootstrap>:488
  <frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute

<frozen importlib._bootstrap>:488
  <frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== 5 passed, 1 skipped, 2 warnings in 26.82s ===========================
<sys>:0: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
make: Leaving directory '/home/h0ps/Programming/RIOT/build/pkg/fido2_tests'

The UP tests seems to work for me on the nrf52840dongle (my nrf52840dk is broken and I am currently waiting for a new one). In total I had to click the button three times: twice before the tests started and once during the tests when I was prompted to do so.

@mguetschow just retested both tests and got all passed for both on a new nrf52840dk. Procedure for the nrf52840dk was the same as describe for the dongle.

Copy link
Copy Markdown
Contributor

@mguetschow mguetschow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've re-tested on nrf52840dk and can confirm all tests run through (although it's a bit annoying to wait long enough for the board to reboot). As a bonus, I've also tested it on feather-nrf52840-sense and can confirm it to be working there too 🎉, with this diff:

diff --git a/tests/sys/fido2_ctap_hid/Makefile b/tests/sys/fido2_ctap_hid/Makefile
index 4b3cc16110..0d1b524269 100644
--- a/tests/sys/fido2_ctap_hid/Makefile
+++ b/tests/sys/fido2_ctap_hid/Makefile
@@ -5,7 +5,8 @@ include ../Makefile.sys_common
 
 BOARD_WHITELIST = \
   nrf52840dk \
-  nrf52840dongle
+  nrf52840dongle \
+  feather-nrf52840-sense
 
 USEMODULE += fido2_ctap_transport_hid
 USEPKG += fido2_tests

I'd probably work with any nrf52840-based board I assume?

Just a minor nit below, afterwards this is ready to be merged from my point of view.

@Ollrogge
Copy link
Copy Markdown
Member Author

I've re-tested on nrf52840dk and can confirm all tests run through (although it's a bit annoying to wait long enough for the board to reboot). As a bonus, I've also tested it on feather-nrf52840-sense and can confirm it to be working there too 🎉, with this diff:

diff --git a/tests/sys/fido2_ctap_hid/Makefile b/tests/sys/fido2_ctap_hid/Makefile
index 4b3cc16110..0d1b524269 100644
--- a/tests/sys/fido2_ctap_hid/Makefile
+++ b/tests/sys/fido2_ctap_hid/Makefile
@@ -5,7 +5,8 @@ include ../Makefile.sys_common
 
 BOARD_WHITELIST = \
   nrf52840dk \
-  nrf52840dongle
+  nrf52840dongle \
+  feather-nrf52840-sense
 
 USEMODULE += fido2_ctap_transport_hid
 USEPKG += fido2_tests

I'd probably work with any nrf52840-based board I assume?

Just a minor nit below, afterwards this is ready to be merged from my point of view.

Thanks for testing this again :) It should theoretically work for any nrf52840-based board, yes.
I added the feather-nrf52840-sense to the whitelist for both tests 👍

Copy link
Copy Markdown
Contributor

@mguetschow mguetschow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, let's merge then!

@mguetschow mguetschow enabled auto-merge March 25, 2025 18:28
@mguetschow mguetschow added this pull request to the merge queue Mar 25, 2025
Merged via the queue into RIOT-OS:master with commit 04a1698 Mar 25, 2025
26 checks passed
@mguetschow mguetschow added this to the Release 2025.04 milestone Apr 8, 2025
@maribu maribu changed the title Fido2 update tests sys/fido2: update tests Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: doc Area: Documentation Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants