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

Everest crashes when sending an OCPP201 InstallCertificate call from OCPP server with invalid data #644

Open
BasharShehab opened this issue Apr 20, 2024 · 0 comments
Assignees

Comments

@BasharShehab
Copy link

BasharShehab commented Apr 20, 2024

Describe the bug

When running latest build of Everest-core (commit fb24707) and an OCPP server using OCPP 2.0.1, Everest crashes when receiving an InstallCertificate call with an invalid certificate_type value. In this case, an empty string:

InstallCertificate(certificate_type='', certificate='-----BEGIN CERTIFICATE-----\nMIIBwzCCAWigAwIBAgICMDkwCgYIKoZIzj0EAwIwSDESMBAGA1UEAwwJVjJHUm9v\ndENBMRAwDgYDVQQKDAdFVmVyZXN0MQswCQYDVQQGEwJERTETMBEGCgmSJomT8ixk\nARkWA1YyRzAeFw0yMzEwMjcxMzEwNDdaFw0yNDEwMjYxMzEwNDdaMEgxEjAQBgNV\nBAMMCVYyR1Jvb3RDQTEQMA4GA1UECgwHRVZlcmVzdDELMAkGA1UEBhMCREUxEzAR\nBgoJkiaJk/IsZAEZFgNWMkcwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAR8yvxy\nBJNJh0WHbOLqgWp4JRNeuKPQid2Ha255X9w/Xc5bFDQG9AacXr3ED/MOdFqSQi/8\nzS1Ez82SbqH9U3xRo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB\nBjAdBgNVHQ4EFgQUDE1ff14OrOE2RsHt9Rg/L6WKrXwwCgYIKoZIzj0EAwIDSQAw\nRgIhAIwKjJ+kafFE0ETE6s9ffmoD6OWX+cnGVySu4bCkSTBLAiEAxJGgTDUdMQK/\ngP+u0NMyffVs8TH/BGgleeieAHDo2Fo=\n-----END CERTIFICATE-----\n', custom_data=None)

Everest logs:


2024-04-20 13:55:56.743403 [INFO] ocpp:OCPP201     :: Received message over TLS websocket polling for process: [2,"314c960a-0a98-401c-87db-45b45f0041d6","InstallCertificate",{"certificateType":"","certificate":"-----BEGIN CERTIFICATE-----\nMIIBwzCCAWigAwIBAgICMDkwCgYIKoZIzj0EAwIwSDESMBAGA1UEAwwJVjJHUm9v\ndENBMRAwDgYDVQQKDAdFVmVyZXN0MQswCQYDVQQGEwJERTETMBEGCgmSJomT8ixk\nARkWA1YyRzAeFw0yMzEwMjcxMzEwNDdaFw0yNDEwMjYxMzEwNDdaMEgxEjAQBgNV\nBAMMCVYyR1Jvb3RDQTEQMA4GA1UECgwHRVZlcmVzdDELMAkGA1UEBhMCREUxEzAR\nBgoJkiaJk/IsZAEZFgNWMkcwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAR8yvxy\nBJNJh0WHbOLqgWp4JRNeuKPQid2Ha255X9w/Xc5bFDQG9AacXr3ED/MOdFqSQi/8\nzS1Ez82SbqH9U3xRo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB\nBjAdBgNVHQ4EFgQUDE1ff14OrOE2RsHt9Rg/L6WKrXwwCgYIKoZIzj0EAwIDSQAw\nRgIhAIwKjJ+kafFE0ETE6s9ffmoD6OWX+cnGVySu4bCkSTBLAiEAxJGgTDUdMQK/\ngP+u0NMyffVs8TH/BGgleeieAHDo2Fo=\n-----END CERTIFICATE-----\n"}]
2024-04-20 13:55:56.743863 [INFO] ocpp:OCPP201     :: Successfully sent last message over TLS websocket!
terminate called after throwing an instance of 'std::out_of_range'
  what():  Provided string  could not be converted to enum of type InstallCertificateUseEnum
2024-04-20 13:55:56.955979 [CRIT] manager         int boot(const boost::program_options::variables_map&) :: Module ocpp (pid: 131088) exited with status: 134. Terminating all modules.
2024-04-20 13:55:56.957800 [INFO] manager          :: SIGTERM of child: api (pid: 131066) succeeded.
2024-04-20 13:55:56.957956 [INFO] manager          :: SIGTERM of child: auth (pid: 131067) succeeded.
2024-04-20 13:55:56.958003 [INFO] manager          :: SIGTERM of child: energy_manager (pid: 131068) succeeded.
2024-04-20 13:55:56.958025 [INFO] manager          :: SIGTERM of child: ev_manager_1 (pid: 131069) succeeded.
2024-04-20 13:55:56.958053 [INFO] manager          :: SIGTERM of child: ev_manager_2 (pid: 131070) succeeded.
2024-04-20 13:55:56.958224 [INFO] manager          :: SIGTERM of child: evse_manager_1 (pid: 131072) succeeded.
2024-04-20 13:55:56.958386 [INFO] manager          :: SIGTERM of child: evse_manager_2 (pid: 131073) succeeded.
2024-04-20 13:55:56.958424 [INFO] manager          :: SIGTERM of child: evse_security (pid: 131079) succeeded.
2024-04-20 13:55:56.958467 [INFO] manager          :: SIGTERM of child: grid_connection_point (pid: 131080) succeeded.
2024-04-20 13:55:56.958497 [INFO] manager          :: SIGTERM of child: iso15118_car (pid: 131086) succeeded.
2024-04-20 13:55:56.958537 [INFO] manager          :: SIGTERM of child: iso15118_charger (pid: 131087) succeeded.
2024-04-20 13:55:56.958559 [INFO] manager          :: SIGTERM of child: slac (pid: 131090) succeeded.
2024-04-20 13:55:56.958597 [INFO] manager          :: SIGTERM of child: system (pid: 131091) succeeded.
2024-04-20 13:55:56.958628 [INFO] manager          :: SIGTERM of child: token_provider_1 (pid: 131092) succeeded.
2024-04-20 13:55:56.958654 [INFO] manager          :: SIGTERM of child: yeti_driver_1 (pid: 131098) succeeded.
2024-04-20 13:55:56.958675 [INFO] manager          :: SIGTERM of child: yeti_driver_2 (pid: 131099) succeeded.
2024-04-20 13:55:56.958689 [CRIT] manager         int boot(const boost::program_options::variables_map&) :: Exiting manager.

EVerest Domain

OCPP2.0.1, Simulation

Affected EVerest Module

The bug seems to come from the module OCPP201

To Reproduce

  1. Run everest
  2. Run an OCPP 2.0.1 server with the standard implementation of call/call_result for InstallCertificate
  3. Send an InstallCertificate call with empty string for certificate_type
  4. Observe Everest logs

Anything else?

This is my first issue and I'm a newbie with everest, so I'm sorry if this isn't formatted correctly. Please let me know of any problem that needs fixing in this issue or in general, as well as any missing information that's needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants