Repository navigation
Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Reviewer's GuideData structuresAdd the optional internal-display URL field and its MQTT topic so the setting is represented in configuration state.
Uses of the APISubscribe the secondary display to the configured URL topic so it can select the override instead of the primary display URL.
Deduplicate pending display navigations and cancel stale destinations when a newer destination is selected.
ImplementationValidate configured display URLs as empty or HTTP(S) URLs before accepting them through the set topic.
UIRender display log messages as text rather than HTML to avoid interpreting logged content as markup.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
kaindl
marked this pull request as ready for review
November 7, 2026 16:26
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="web/display/setupMqttServices.js" line_range="23" />
<code_context>
"openWB/system/current_branch": false,
"openWB/system/current_commit": false,
"openWB/general/extern_display_mode": false,
+ "openWB/optional/int_display/display_url": false,
"openWB/internal_chargepoint/global_data": false,
"openWB/internal_chargepoint/0/data/parent_cp": false,
</code_context>
<issue_to_address>
**Display-setting payload triggers XSS**
When a publisher with display-configuration access sends a string containing executable HTML markup as the URL value, `handleMessage` passes the MQTT payload to `addLog`, which inserts it with `innerHTML`; markup in the payload therefore executes in the display wrapper’s origin and can access same-origin data such as the MQTT cookie.
Render log messages as text (for example, with `textContent`) rather than inserting MQTT payloads through `innerHTML`.
Also at `packages/helpermodules/setdata.py:960`.
</issue_to_address>
### Comment 2
<location path="web/display/processAllMqttMsg.js" line_range="52" />
<code_context>
- addLog(`all done, loading theme from primary`);
+ const configuredDisplayUrl = data["openWB/optional/int_display/display_url"];
+ if (configuredDisplayUrl && configuredDisplayUrl.trim()) {
+ destination = configuredDisplayUrl.trim();
+ addLog(`all done, loading manually configured display URL`);
+ } else {
</code_context>
<issue_to_address>
**Configured URL runs same-origin script**
When a display-configuration publisher sets `display_url` to a `javascript:` URL, `location.href` evaluates a `javascript:` URL in the display wrapper’s origin, letting the publisher run script there and read same-origin data such as the MQTT cookie.
Parse the configured value and allow only `http:` or `https:` URLs before navigating.
</issue_to_address>
### Comment 3
<location path="web/display/setupMqttServices.js" line_range="23" />
<code_context>
"openWB/system/current_branch": false,
"openWB/system/current_commit": false,
"openWB/general/extern_display_mode": false,
+ "openWB/optional/int_display/display_url": false,
"openWB/internal_chargepoint/global_data": false,
"openWB/internal_chargepoint/0/data/parent_cp": false,
</code_context>
<issue_to_address>
**Anonymous clients can read URL tokens**
When the configured display URL contains a bearer token or other secret, an unauthenticated MQTT client in the default anonymous group can subscribe to the retained URL and retrieve any bearer token or credentials embedded in it, exposing access to the protected resource.
Avoid broadcasting secret-bearing URLs to the anonymous role; use an authenticated resource or a mechanism that does not expose the secret through MQTT.
</issue_to_address>
### Comment 4
<location path="web/display/processAllMqttMsg.js" line_range="52" />
<code_context>
- addLog(`all done, loading theme from primary`);
+ const configuredDisplayUrl = data["openWB/optional/int_display/display_url"];
+ if (configuredDisplayUrl && configuredDisplayUrl.trim()) {
+ destination = configuredDisplayUrl.trim();
+ addLog(`all done, loading manually configured display URL`);
+ } else {
</code_context>
<issue_to_address>
**Display opens stale destination**
When the configured URL changes while a navigation timeout is pending, an earlier timeout navigates to its captured destination before the later timeout applies the new setting, so the display opens the stale URL.
Cancel and replace any pending navigation timeout when the destination changes, or have the timeout use the latest destination.
</issue_to_address>Co-authored-by: Copilot <[email protected]>
Render display logs as text and reject display URLs that do not use HTTP or HTTPS.\n\nCo-authored-by: Copilot <[email protected]>
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.
Im secondary Modus erwartet die openWB eine URL vom primary, die auf dem internen Display angezeigt wird (wenn verbaut). Nicht alle anderen Controller außer der openWB selbst senden eine solche URL und über modbus ist es gar nicht möglich. Deshalb gibt es hiermit ein Möglichkeit, diese URL direkt in den Einstellungen im Webinterface zu hinterlegen.
Alternative Implementierung zu #3205, da ich es über eine Einstellung deutlich schlanker und logischer finde, als über ein Theme.
Würde ebenso #1975 und #3861 lösen.
Zusätzliche Checks, wie in #3205 gefordert, für lokale Adressen und Last sehe ich nicht in diesem Setting: Die URL kann so auch von einem anderen Primary gesendet werden, mit den gleichen Implikationen -> wenn solche Checks wirklich relevant sind, sollten sie global für alle angezeigten URLs umgesetzt werden, egal wie die URL gesetzt wird.
Eine entsprechende Warnung ist in der Weboberfläche als danger-alert eingebaut:
zugehöriger PR auf openwb-ui-settings: openWB/openwb-ui-settings#1164
Summary by Sourcery
Support a configurable and validated display URL for secondary-mode internal displays.
New Features:
Bug Fixes:
Enhancements:
Chores: