Repository navigation
fix(ocpp): keep the AuthorizationKey out of GetConfiguration and logs (#203) - #206
Merged
Merged
Conversation
MicroOcppMongoose declares AuthorizationKey as a readable configuration key, so GetConfiguration returned its value to the backend, and debug builds printed that reply on the unauthenticated telnet console. OCPP 1.6 makes the key write-only. MicroOcpp is a pinned lib_dep, not vendored, and its accessibility flag works per configuration file (it would also hide BackendUrl/ChargeBoxId and block key rotation via ChangeConfiguration), so the fix is in the firmware: - Replace MicroOcpp's GetConfiguration handler with a subclass that drops the optional "value" of secret keys. The key is still listed and can still be changed by the backend. - Redact the key in every MicroOcpp console line: GetConfiguration replies, ChangeConfiguration requests in either field order, lines cut off inside the value by the 256-byte console buffer, and the MicroOcppMongoose "auth Token=" debug line. Decisions live in ocpp_logic.c with native tests (REQ-OCPP-130/131). The wrapper was also checked against the pinned MicroOcpp with its native Catch2 suite: without it the key leaks, with it it does not, for both an all-keys and an explicit-key request. Refs #203 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setting ocpp_auth_key returned the stored key in the response. The caller just sent it, but SECURITY C-2 says the key is never returned to an HTTP client; replies and proxies or browser tools can keep it. Answer ocpp_auth_key_set: true/false instead, as POST already does for the MQTT password. The Web UI does not read the field. ocpp_auth_key_is_set() in ocpp_logic.c now backs both GET and POST (REQ-OCPP-132). docs/security.md describes the POST reply and the GetConfiguration/console redaction from the previous commit. Refs #203 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #203. Stacked on #205 (which is stacked on #204); merge in order #204 → #205 → this, retargeting each to
master.Problem
MicroOcppMongoose declares
AuthorizationKeyreadable, soGetConfigurationreturned the value to the backend, and debug builds printed the reply ([MO] Send: ...) on the unauthenticated telnet console. OCPP 1.6 treats the key as write-only.Deviation from the issue's acceptance criteria
The issue asked for a declare-flag patch in the vendored library plus a CI guard. MicroOcpp/MicroOcppMongoose are pinned
lib_deps, not vendored, and MicroOcpp'saccessibleflag works per configuration file: it would also hideCst_BackendUrl/Cst_ChargeBoxIdand block key rotation viaChangeConfiguration. So this is a firmware-side fix instead.Fix
registerOperationreplaces by name) with a subclass that drops the optionalvalueof secret keys (ocpp_config_key_is_secret()). The key is still listed and can still be changed by the backend.ocpp_console_out()runs every MicroOcpp line throughocpp_redact_auth_key(): GetConfiguration replies, ChangeConfiguration requests in either field order, lines cut off inside the value by the 256-byte console buffer, and the MicroOcppMongooseauth Token=<id>:<key>debug line. The value becomes***; the line never grows.Verification
test_ocpp_secrets.c, 11 tests, REQ-OCPP-130/131/132)net_watchdog.c)pio run -e release: flash 87.7%, RAM 24.0%; debug 92.3% / 24.2%Also in this PR
POST /settingsno longer echoes a newly setocpp_auth_key; it answersocpp_auth_key_set: true/false, like the MQTT password (SECURITY C-2). The Web UI does not read the field.ocpp_auth_key_is_set()backs both GET and POST (REQ-OCPP-132).docs/security.mdupdated.🤖 Generated with Claude Code