Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security queries are not implemented to spec #1720

Closed
jacobkeeler opened this issue Jul 15, 2021 · 1 comment
Closed

Security queries are not implemented to spec #1720

jacobkeeler opened this issue Jul 15, 2021 · 1 comment
Labels
bug A defect in the library protocol Relating to the protocol layer

Comments

@jacobkeeler
Copy link
Contributor

Bug Report

With the acceptance of SDL 0317, this library's implementation of security queries does not match the spec fully. Several issues exist with the current implementation such as:

  1. When a security query is received from Core, its header is entirely ignored and the library assumes that it is a Send Handshake Data request. This causes issues if Core were to send another type of query, such as a Send Internal Error notification.
        System.arraycopy(msg.getData(), 12, data, 0, iLen);

        byte[] dataToRead = new byte[4096];

        Integer iNumBytes = sdlSecurity.runHandshake(data, dataToRead);
  1. Hardcoded values are used when sending security queries for fields such as query ID. In addition, some values are not explicitly set at all, such as query type and sequential number. Any predefined values should be properly added as constants.
        protocolMessage.setFunctionID(0x01);

should be changed to something like

        securityQuery.setQueryID(QueryID.SEND_HANDSHAKE_DATA);
        securityQuery.setQueryType(QueryType.RESPONSE);
        securityQuery.setSequenceNumber(msg.getSequenceNumber());
  1. Security queries are constructed using an RPC header, which has a slightly different format than a security query header. Security query headers should be implemented separate from RPC headers.
        ProtocolMessage protocolMessage = new ProtocolMessage();
        ...
        sendMessage(protocolMessage);

should be changed to something like

        SecurityQuery securityQuery = new SecurityQuery();
        ...
        sendMessage(securityQuery);
OS & Version Information
  • Android Version: N/A
  • SDL Android Version: master
  • Testing Against: N/A
@theresalech
Copy link
Contributor

See Core issue smartdevicelink/sdl_core#3755; the mobile libraries will need to account for this by accepting both the NOTIFICATION and REQUEST types for SendHandshakeData and just treating them as REQUEST type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A defect in the library protocol Relating to the protocol layer
Projects
None yet
Development

No branches or pull requests

4 participants