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

Auth Token handling seems to be not case-insensitive #566

Open
mhei opened this issue Feb 28, 2024 · 8 comments
Open

Auth Token handling seems to be not case-insensitive #566

mhei opened this issue Feb 28, 2024 · 8 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mhei
Copy link
Contributor

mhei commented Feb 28, 2024

Environment:

  • EVerest 2024.2.0 running on a single port charger
  • OCPP backend SteVe
  • DummyTokenProvider configured which provides the token "DEADBEEF" (upper-case)

Test Sequence:

  1. charger is online, connected via OCPP
  2. in SteVe, the token is configured using lower-case letters
  3. a normal charging session can be started successfully
  4. terminate the charging session normally
  5. install a reservation via SteVe for the socket, using the "DEADBEEF" token
  6. try to start the session

Expected Behavior:

  • reservation is recognized and the token is allowed to start the session
  • reason: auth tokens in OCPP should be handled case-insenstive

Observed Behavior:

  • reservation is recognized but the token is rejected

Trace (stripped down to relevant parts IMHO):

Feb 28 13:30:29 ccc300 manager[2007]: 2024-02-28 13:30:29.356093 [INFO] auth:Auth        :: Received new token: {
Feb 28 13:30:29 ccc300 manager[2007]:     "authorization_type": "RFID",
Feb 28 13:30:29 ccc300 manager[2007]:     "id_token": "DEADBEEF"
Feb 28 13:30:29 ccc300 manager[2007]: }

Feb 28 13:30:29 ccc300 manager[2007]: 2024-02-28 13:30:29.515186 [INFO] auth:Auth        :: Connector is reserved but token is not valid for this reservation
Feb 28 13:30:29 ccc300 manager[2007]: 2024-02-28 13:30:29.605651 [INFO] auth:Auth        :: Result for token: DEADBEEF: REJECTED

Additional note:

  • We observed a similar behavior when using LocalAuthList feature of OCPP (i.e. a lower-case token is stored in the list, but then the token provider shows a upper-case one) - so it might be worth to double-check those places of the token handling, too.
  • When changing the token in SteVe between step 5 and 6 to lower-case, then the reservation is recognized and the token is accepted, the charging starts.
@Pietfried Pietfried self-assigned this Feb 29, 2024
@Pietfried Pietfried added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Feb 29, 2024
@Pietfried Pietfried removed their assignment Feb 29, 2024
@golovasteek
Copy link
Contributor

Should we treat all the tokens in Everest in a Case-Insensitive way? Or the objects that emit tokes should normalize them to upper?

@mhei
Copy link
Contributor Author

mhei commented Mar 6, 2024

From our experience, the tokens coming from a backend via OCPP should be handled as-is interally, e.g. stored unchanged and provided back to the backend in the same way as originally received from the backend.
So yes in my eyes, the EVerest internal handling should be case-insensitive.
I'm unsure whether a normalization by token publishers is really necessary, and I wonder whether this would actually hurt...

@golovasteek
Copy link
Contributor

Doesn't OCPP explicitly says that token is case-insensitive? I.e. from the protocol perspective the tokens in lower and upper case should be considered the same?

What if the next protocol Everest will support works with case-sensitive tokens?

@lategoodbye
Copy link

Doesn't OCPP explicitly says that token is case-insensitive? I.e. from the protocol perspective the tokens in lower and upper case should be considered the same?

What if the next protocol Everest will support works with case-sensitive tokens?

Yes, that's why we cannot normalize it on the token provider side. The token validators must be fixed.

@golovasteek
Copy link
Contributor

The described issue as far as I can see is not in the validator, it is in the Auth module, that compares tokens from OCPP and the from the token provider.

@lategoodbye
Copy link

For now i don't have a real insight into the EVerest code. So i consider most of them as black boxes.

@rohansaibuddhi
Copy link

Hey, this is unrelated, but which charging protocol is being used in EVerest? Is it OCPP or ISO15118? I am looking at the schema for ISO15118 v2 and v20 and do not see any similarities with the messages being trasmitted by everest(messages obtained from MQTT explorer while running everest on Linux machine)
Any help would be appreciated!

@lategoodbye
Copy link

@rohansaibuddhi Please don't hijack this bug report and look at the official documentation

In case your questions have not been answered, please use the Zulip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants