-
Notifications
You must be signed in to change notification settings - Fork 100
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
genchallange check has been added for Authorization #135
Conversation
c3499c3
to
6805d9c
Compare
# 'FAILED_ChallengeInvalid' if the challenge response contained in the | ||
# AuthorizationReq message in attribute GenChallenge is not valid versus | ||
# the provided GenChallenge in PaymentDetailsRes. | ||
if authorization_req.gen_challenge: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the field gen_challenge is addressable but can be None, then do we need this if clause?
cant we just have the one after?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, gen_challenge is optional, if we remove this statement, we can face an issue when ev doesnt send gen_challenge value. if ev doesnt send it, the value will be None, and automatically we return as FAILED_CHALLENGE_INVALID, that is not a valid case. Am i wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are not checking if the gen_challenge attribute exists in the authorization_req data structure. Instead, you are already assuming that the attribute exists but that its value can be None or not: this may be ok, depends how the pydantic model constructs the data. Is it the case that if the gen_challenge is None we will still be able to access the gen_challenge
attribute? if so, then we dont need that first if clause, because in the one after we do the check as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one use case being missed because of the if condition above - the case where GenChallenge is not send at all in AuthorizationReq in PnC.
I believe you added the check as the field is optional in EIM. It would continue to work in EIM if the check is removed anyway because of the reason @andre mentioned above - but might throw an error in case a random GenChallenge is accidentally sent in EIM AuthorizationReq. We could ignore the field check in EIM completely?
if self.comm_session.selected_auth_option is AuthEnum.PNC_V2:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shalinnijel2 should not we terminate the session with FAILED_CHALLENGE_INVALID in this case as well. I think, we might not need this check...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, true - letting that pass through would also be a violation of the spec - in which case simply removing the if condition as discussed above would suffice.
cdccd10
to
65fdde8
Compare
1f4bd6c
to
e36e761
Compare
if gen_challenge: | ||
authorization_req = AuthorizationReq(id=id, gen_challenge=gen_challenge) | ||
else: | ||
authorization_req = AuthorizationReq() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you are not generating here the challenge and just injecting, there is no point on having the if clause.
I would just pass along the injection, but is a minor thing
commit 2c30797 Author: Ibrahim KARATAS <[email protected]> Date: Mon Oct 31 17:19:10 2022 +0000 Fix/genchallange invalid (#154) * genchallance will only sent on first AuthorizationReq message * test_authorization_req_gen_challenge_invalid unit test modified commit 0d34ee5 Author: Ibrahim KARATAS <[email protected]> Date: Mon Oct 31 16:36:56 2022 +0000 genchallange check has been added for Authorization (#135) * The genchallange check has been added for Authorization commit 6192609 Author: Chad <[email protected]> Date: Mon Oct 31 14:43:25 2022 +0000 fix: cleanup template dockerfile (#109) commit 5185483 Author: Roman Stanchak <[email protected]> Date: Mon Oct 24 05:35:44 2022 -0400 fix: use utcnow() to check certificate validity (#151) commit 72e8cc9 Author: Chad <[email protected]> Date: Mon Oct 17 17:29:49 2022 +0100 feat: run code qual and tests in gha (#147) * feat: run code qual and tests in gha * fix: install deps in gha * fix: add isort make command commit 8718dd5 Author: santiagosalamandri <[email protected]> Date: Mon Oct 17 15:02:36 2022 +0100 Bump 0.13.0 (#149) * feat: Bump to 0.13.0 commit d596370 Author: Santiago Salamandri <[email protected]> Date: Mon Oct 17 13:59:40 2022 +0100 feat: Pass status event as a parameter to start servers. Reduce check status delay to 10 mS commit 8d260e2 Author: Santiago Salamandri <[email protected]> Date: Mon Oct 17 13:56:38 2022 +0100 feat: Remove event atribute and pass it as a parameter commit da2ee49 Author: Santiago Salamandri <[email protected]> Date: Mon Oct 17 13:55:04 2022 +0100 chore: rename EVSEServiceStatus to ServiceStatus commit 3898096 Author: Santiago Salamandri <[email protected]> Date: Mon Oct 17 12:11:47 2022 +0100 feat: Add starting status commit 657d451 Author: Santiago Salamandri <[email protected]> Date: Mon Oct 17 12:11:11 2022 +0100 feat: Add a task to check the servers status commit 222b741 Author: Santiago Salamandri <[email protected]> Date: Mon Oct 17 12:09:30 2022 +0100 feat: Add ready status events to servers commit f196eb6 Author: Santiago Salamandri <[email protected]> Date: Mon Oct 17 12:08:21 2022 +0100 feat: Implemented set_status method commit c076bb2 Author: Santiago Salamandri <[email protected]> Date: Mon Oct 17 12:07:38 2022 +0100 feat: add evse status enum and set_status abstract method commit b0e4f25 Author: Chad <[email protected]> Date: Wed Oct 12 13:54:56 2022 +0100 fix: remove sphinx dependency (#141) commit 15c3a5a Author: André <[email protected]> Date: Wed Oct 12 11:39:27 2022 +0100 get from the evse controller the ac evse status (#146) * get from the evse controller the ac evse status * removed unused iimport * added test for charging status
fix AB#2850
According to spec 15118-2 [V2G2-475], the GenChallenge in AuthorizationReq should be the same in PaymentDetailsRes. Otherwise, we need to return FAILED_ChallengeInvalid.
[V2G2-475] The message 'AuthorizationRes' shall contain the ResponseCode
'FAILED_ChallengeInvalid' if the challenge response contained in the
AuthorizationReq message in attribute GenChallenge is not valid versus
the provided GenChallenge in PaymentDetailsRes.