Repository navigation
fix(ocpp): from-zero audit — Critical + High spec conformance and safety fixes #1961
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
Changes from all commits
7c23315
c24d04c
f600626
e82cc9a
fa2bea3
6d5ebbb
a72cb50
7dfc5de
a4559d0
e8b79c1
ca6b018
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -590,14 +590,16 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { | |
| ) | ||
| }) | ||
| } else { | ||
| // Unref: fire-and-forget deferred firmware update must not | ||
| // block node.js exit. | ||
| setTimeout(() => { | ||
| this.updateFirmwareSimulation(chargingStation).catch((error: unknown) => { | ||
| logger.error( | ||
| `${chargingStation.logPrefix()} ${moduleName}.constructor: UpdateFirmware simulation error:`, | ||
| error | ||
| ) | ||
| }) | ||
| }, retrieveDate.getTime() - now) | ||
| }, retrieveDate.getTime() - now).unref() | ||
| } | ||
| } | ||
| ) | ||
|
|
@@ -1301,10 +1303,14 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { | |
| connectorId <= chargingStation.getNumberOfConnectors(); | ||
| connectorId++ | ||
| ) { | ||
| const connectorStatus = chargingStation.getConnectorStatus(connectorId) | ||
| const isReservedForOther = | ||
| connectorStatus?.status === OCPP16ChargePointStatus.Reserved && | ||
| !OCPP16ServiceUtils.hasReservation(chargingStation, connectorId, commandPayload.idTag) | ||
| if ( | ||
| chargingStation.isConnectorAvailable(connectorId) && | ||
| chargingStation.getConnectorStatus(connectorId)?.transactionStarted === false && | ||
| !OCPP16ServiceUtils.hasReservation(chargingStation, connectorId, commandPayload.idTag) | ||
| connectorStatus?.transactionStarted === false && | ||
| !isReservedForOther | ||
|
Comment on lines
+1306
to
+1313
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logic Error: The However, if the Please provide feedback on the review comment by checking the appropriate box:
|
||
| ) { | ||
| commandPayload.connectorId = connectorId | ||
| break | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -949,6 +949,13 @@ export class OCPP16ServiceUtils { | |
| connectorId: number, | ||
| reason?: StopTransactionReason | ||
| ): Promise<StopTransactionResponse> { | ||
| const connectorStatus = chargingStation.getConnectorStatus(connectorId) | ||
| if (connectorStatus?.status !== OCPP16ChargePointStatus.Finishing) { | ||
| await sendAndSetConnectorStatus(chargingStation, { | ||
| connectorId, | ||
| status: OCPP16ChargePointStatus.Finishing, | ||
| } as OCPP16StatusNotificationRequest) | ||
| } | ||
|
Comment on lines
+952
to
+958
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logic Error: While this works today (because Please provide feedback on the review comment by checking the appropriate box:
|
||
| const rawTransactionId = chargingStation.getConnectorStatus(connectorId)?.transactionId | ||
| const transactionId = rawTransactionId != null ? convertToInt(rawTransactionId) : undefined | ||
| if ( | ||
|
|
||
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.
Logic Error: The
isReservedForOtherguard is only checked afterisConnectorAvailable, butisConnectorAvailablealready returnsfalsefor aReservedconnector (since its availability is notOperative). This means the entireifblock can never be entered for aReservedconnector regardless of theisReservedForOthervalue, making the H6 fix a no-op for the connector auto-select path.To verify:
isConnectorAvailablechecksconnectorStatus.availability === AvailabilityType.Operative(line 824-828 ofChargingStation.ts), and aReservedconnector has its availability set as part of theReserveNowflow. IfReservedconnectors haveavailability !== Operative, thenisConnectorAvailablealready excludes them and theisReservedForOtherguard is unreachable.Should verify whether a
Reservedconnector retainsOperativeavailability in this codebase. If not, theisReservedForOthercheck is dead code and the fix should instead be applied after theisConnectorAvailablecheck is replaced/widened.Please provide feedback on the review comment by checking the appropriate box: