Skip to content

fix(adhoc-sweep-fixes): 34 review findings across 27 files - #149

Draft
flamingo[bot] wants to merge 26 commits into
masterfrom
ai-fix/adhoc-sweep-fixes-c4ca4fb8-6542cba8
Draft

fix(adhoc-sweep-fixes): 34 review findings across 27 files#149
flamingo[bot] wants to merge 26 commits into
masterfrom
ai-fix/adhoc-sweep-fixes-c4ca4fb8-6542cba8

Conversation

@flamingo

@flamingo flamingo Bot commented Aug 24, 2026

Copy link
Copy Markdown

Closes 34 review findings across 27 files.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟢 95 high Reference to undefined 'NegociationType' (typo) will throw ReferenceError on SSL rejection path rdp/protocol/x224.js:259
2 🟡 80 medium Reference to undefined 'NegotiationFailureCode' in x224.js Server negotiation failure path rdp/protocol/x224.js:259
3 🟢 90 high macos_thermals references undeclared global 'child' variable via implicit global leak agents/modules_meshcore/sysinfo.js:197
4 🔴 40 low — review closely macos_memUtilization throws a plain string instead of an Error and never uses the promise it constructs agents/modules_meshcore/sysinfo.js:168
5 🟢 97 high Stray identifier 'f' after require() call causes a syntax error pkcs7-modified.js:30
6 🟢 95 high AES-EAX key usage list contains a malformed string instead of separate array entries public/novnc/core/ra2.js:12
7 🟢 92 high Copy-paste bug: chunked-body length check in obj.ws branch reads/mutates obj.amt state interceptor.js:197
8 🟢 90 high Length-body mode substring logic uses wrong comparison direction, likely sending entire remaining buffer instead of content-length worth of bytes interceptor.js:90
9 🟡 80 medium idle_getSecondsAllSessions treats session-check TSID guard inconsistently with idle_getSeconds' tautological condition agents/modules_meshcore/win-deskutils.js:208
10 🟡 80 medium Tautological TSID guard duplicated across background_get/set and mousetrails_get/set agents/modules_meshcore/win-deskutils.js:108
11 🟡 85 medium rdp/core/log.js exported logging functions are entirely stubbed out — no logging occurs anywhere in the rdp/ subsystem rdp/core/log.js:63
12 🟡 80 medium rdp/core/log.js log level check uses undefined module.exports.level reference before module.exports is fully assigned rdp/core/log.js:55
13 🔴 40 low — review closely Undeclared global variables length, serverSettings, clientSettings in rdp/protocol/t125/gcc.js rdp/protocol/t125/gcc.js:296
14 🔴 40 low — review closely Undeclared global length and clientSettings in readConferenceCreateRequest rdp/protocol/t125/gcc.js:330
15 🟡 70 medium meshagent_diagnostic downloads and installs an agent binary over HTTPS with rejectUnauthorized explicitly disabled agents/meshcore_diagnostic.js:81
16 🟢 95 high Log message typo 'downlod' will pollute server diagnostic logs agents/meshcore_diagnostic.js:84
17 🟢 96 high amtprovisioningserver.js: socket 'data' handler ignores return value of Buffer.concat, causing incoming Intel AMT hello payloads beyond the first TCP segment to be silently dropped amtprovisioningserver.js:40
18 🟢 97 high Typo console.err in SerialTunnel._write will throw TypeError instead of logging the intended error amt/amt-wsman-comm.js:80
19 🟢 97 high Stray hex fragment concatenated into gauge metric description comment in monitoring.js monitoring.js:36
20 🟢 95 high decodeTag in rdp/asn1/ber.js assigns to an undeclared global variable nextTagNumber rdp/asn1/ber.js:30
21 🟢 97 high Duplicate UpdateType object literal declared twice in rdp/protocol/pdu/data.js rdp/protocol/pdu/data.js:108
22 🟢 95 high rdp/security/rc4.js decrypt() references undefined global byteStream instead of this.byteStream rdp/security/rc4.js:61
23 🟢 95 high AmtSetupBinEncode has a logically-broken bounds check that can never be true public/scripts/amt-setupbin-0.1.0.js:178
24 🟢 97 high agent-redir-rtc-0.1.0.js references undefined variable f instead of fileReader in fallback branch public/scripts/agent-redir-rtc-0.1.0.js:42
25 🟢 95 high Operator precedence bug in cert.js error message: bitwise AND applied to string concatenation result rdp/protocol/cert.js:144
26 🟢 95 high amt-wsman.js ExecSubscribe declares opaque parameter and re-declares it as a local var, shadowing the argument agents/modules_meshcmd/amt-wsman.js:60
27 🟡 85 medium public/scripts/agent-redir-rtc-0.1.0-min.js contains the same f.readAsArrayBuffer undefined-variable bug baked into the minified bundle public/scripts/agent-redir-rtc-0.1.0-min.js:1
28 🔴 40 low — review closely mcrec.js readLastBlock reads wrong buffer for xtime (uses outer buf instead of buf2) mcrec.js:200
29 🟢 95 high ModernModal.show() builds an unused modalContent HTML string that is discarded and never rendered public/js/ui-components.js:34
30 🟢 95 high writeObjectIdentifier uses bitwise AND instead of OR, corrupting encoded OID byte rdp/protocol/t125/per.js:195
31 🟢 95 high wifi-scanner.js leaks tokens as an implicit global (missing var/let) agents/modules_meshcore/wifi-scanner.js:87
32 🟢 92 high recvServerControlCooperatePDU / recvServerControlGrantedPDU / recvServerFontMapPDU register a second 'once' listener even on the mismatch branch, causing duplicate handlers rdp/protocol/pdu/global.js:174
33 🟢 90 high win-volumes.js: bitlocker recovery password parser reads lines[x+1] with no bounds check before out-of-range access agents/modules_meshcore/win-volumes.js:91
34 🟡 65 medium Theme name from localStorage used to build stylesheet path with dangerous fallback to '..' public/scripts/themes/theme-switcher.js:6

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: 6542cba8-5031-4f6a-9825-da6bc2c6e58e

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

flamingo Bot added 26 commits August 24, 2026 05:14

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

34 finding(s) fixed in this draft — 33 explained inline on the diff; 4 low-confidence hunk(s) need close review before merging.

Fixes without an inline anchor in this diff

🟠 23. AmtSetupBinEncode has a logically-broken bounds check that can never be truepublic/scripts/amt-setupbin-0.1.0.js:178
In AmtSetupBinEncode, changed the bounds-check operator from && to || in the guard if (obj.fileType < 1 || obj.fileType > AmtSetupBinSetupGuids.length) return null;, exactly as suggested, so invalid fileType values (0, negative, or out-of-range) are now correctly rejected before being used to index AmtSetupBinSetupGuids.

🤖 Prompt for AI agents
In public/scripts/amt-setupbin-0.1.0.js around line 178, review and complete this code-review fix: AmtSetupBinEncode has a logically-broken bounds check that can never be true.
What the draft fix changed: In `AmtSetupBinEncode`, changed the bounds-check operator from `&&` to `||` in the guard `if (obj.fileType < 1 || obj.fileType > AmtSetupBinSetupGuids.length) return null;`, exactly as suggested, so invalid `fileType` values (0, negative, or out-of-range) are now correctly rejected before being used to index `AmtSetupBinSetupGuids`.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer

Comment thread rdp/protocol/x224.js
Comment on lines 321 to 327

if (!(this.selectedProtocol & Protocols.PROTOCOL_SSL)) {
var confirm = serverConnectionConfirm();
confirm.obj.protocolNeg.obj.type.value = NegociationType.TYPE_RDP_NEG_FAILURE;
confirm.obj.protocolNeg.obj.type.value = NegotiationType.TYPE_RDP_NEG_FAILURE;
confirm.obj.protocolNeg.obj.result.value = NegotiationFailureCode.SSL_REQUIRED_BY_SERVER;
this.transport.send(confirm);
this.close();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 Reference to undefined 'NegociationType' (typo) will throw ReferenceError on SSL rejection path

Fixed the typo NegociationType -> NegotiationType in Server.prototype.recvConnectionRequest (SSL rejection branch), referencing the correctly-spelled object already defined at the top of the file, resolving the ReferenceError on that path.

🤖 Prompt for AI agents
In rdp/protocol/x224.js around line 259, review and complete this code-review fix: Reference to undefined 'NegociationType' (typo) will throw ReferenceError on SSL rejection path.
What the draft fix changed: Fixed the typo `NegociationType` -> `NegotiationType` in `Server.prototype.recvConnectionRequest` (SSL rejection branch), referencing the correctly-spelled object already defined at the top of the file, resolving the ReferenceError on that path.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer

Comment thread rdp/protocol/x224.js
Comment on lines 321 to 327

if (!(this.selectedProtocol & Protocols.PROTOCOL_SSL)) {
var confirm = serverConnectionConfirm();
confirm.obj.protocolNeg.obj.type.value = NegociationType.TYPE_RDP_NEG_FAILURE;
confirm.obj.protocolNeg.obj.type.value = NegotiationType.TYPE_RDP_NEG_FAILURE;
confirm.obj.protocolNeg.obj.result.value = NegotiationFailureCode.SSL_REQUIRED_BY_SERVER;
this.transport.send(confirm);
this.close();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 Reference to undefined 'NegotiationFailureCode' in x224.js Server negotiation failure path

Added a new NegotiationFailureCode object definition (with standard MSDN-documented failure code values, e.g. SSL_REQUIRED_BY_SERVER: 0x00000001) near the other constant definitions (MessageType, NegotiationType), and left the reference to NegotiationFailureCode.SSL_REQUIRED_BY_SERVER in Server.prototype.recvConnectionRequest unchanged since it now resolves correctly. The exact numeric values for the other failure codes are inferred from the MSDN spec referenced in the file's own comments but were not independently verified against a canonical source in this repo, so a reviewer should confirm these constants match any existing protocol expectations.

🤖 Prompt for AI agents
In rdp/protocol/x224.js around line 259, review and complete this code-review fix: Reference to undefined 'NegotiationFailureCode' in x224.js Server negotiation failure path.
What the draft fix changed: Added a new `NegotiationFailureCode` object definition (with standard MSDN-documented failure code values, e.g. `SSL_REQUIRED_BY_SERVER: 0x00000001`) near the other constant definitions (`MessageType`, `NegotiationType`), and left the reference to `NegotiationFailureCode.SSL_REQUIRED_BY_SERVER` in `Server.prototype.recvConnectionRequest` unchanged since it now resolves correctly. The exact numeric values for the other failure codes are inferred from the MSDN spec referenced in the file's own comments but were not independently verified against a canonical source in this repo, so a reviewer should confirm these constants match any existing protocol expectations.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 80 medium — react 👍/👎 to teach the reviewer

Comment on lines 218 to 230
mem.MemTotal = (mem.MemFree + mem.MemUsed);
mem.percentFree = ((mem.MemFree / mem.MemTotal) * 100);//.toFixed(2);
mem.percentConsumed = (((mem.MemTotal - mem.MemFree) / mem.MemTotal) * 100);//.toFixed(2);
return (mem);
ret._res(mem);
}
else
{
throw ('Parse Error');
ret._rej('Parse Error');
}
return (ret);
}

function windows_thermals()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 macos_thermals references undeclared global 'child' variable via implicit global leak

In linux_thermals (agents/modules_meshcore/sysinfo.js), added var to the first child = require('child_process').execFile('/bin/sh', ['sh']); assignment so it becomes var child = ..., eliminating the implicit global leak. The second assignment later in the same function intentionally reuses the same locally-scoped child variable (already declared via var in this fix) to run a second shell command, which is correct existing behavior and requires no var since it's the same function-scoped variable.

🤖 Prompt for AI agents
In agents/modules_meshcore/sysinfo.js around line 197, review and complete this code-review fix: macos_thermals references undeclared global 'child' variable via implicit global leak.
What the draft fix changed: In linux_thermals (agents/modules_meshcore/sysinfo.js), added `var` to the first `child = require('child_process').execFile('/bin/sh', ['sh']);` assignment so it becomes `var child = ...`, eliminating the implicit global leak. The second assignment later in the same function intentionally reuses the same locally-scoped `child` variable (already declared via `var` in this fix) to run a second shell command, which is correct existing behavior and requires no `var` since it's the same function-scoped variable.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer

Comment on lines 218 to 230
mem.MemTotal = (mem.MemFree + mem.MemUsed);
mem.percentFree = ((mem.MemFree / mem.MemTotal) * 100);//.toFixed(2);
mem.percentConsumed = (((mem.MemTotal - mem.MemFree) / mem.MemTotal) * 100);//.toFixed(2);
return (mem);
ret._res(mem);
}
else
{
throw ('Parse Error');
ret._rej('Parse Error');
}
return (ret);
}

function windows_thermals()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 macos_memUtilization throws a plain string instead of an Error and never uses the promise it constructs

In macos_memUtilization, changed the success path from return (mem); to ret._res(mem); followed by return (ret);, and changed the failure path from throw ('Parse Error'); to ret._rej('Parse Error'); followed by return (ret);, restructuring the if/else so both branches fall through to a single return (ret); at the end. This aligns the function's contract with its promise-based siblings (windows_cpuUtilization, linux_cpuUtilization, macos_cpuUtilization). Risk: any existing caller that relied on the old synchronous return value of mem or caught the thrown string will now need to use the promise interface instead — this is a behavioral change required by the finding but could affect callers outside this file that aren't visible here.

(Automatically downgraded: no change in this fix lands near this finding's line — verify whether it was actually addressed.)

🤖 Prompt for AI agents
In agents/modules_meshcore/sysinfo.js around line 168, review and complete this code-review fix: macos_memUtilization throws a plain string instead of an Error and never uses the promise it constructs.
What the draft fix changed: In macos_memUtilization, changed the success path from `return (mem);` to `ret._res(mem);` followed by `return (ret);`, and changed the failure path from `throw ('Parse Error');` to `ret._rej('Parse Error');` followed by `return (ret);`, restructuring the if/else so both branches fall through to a single `return (ret);` at the end. This aligns the function's contract with its promise-based siblings (windows_cpuUtilization, linux_cpuUtilization, macos_cpuUtilization). Risk: any existing caller that relied on the old synchronous return value of `mem` or caught the thrown string will now need to use the promise interface instead — this is a behavioral change required by the finding but could affect callers outside this file that aren't visible here.

_(Automatically downgraded: no change in this fix lands near this finding's line — verify whether it was actually addressed.)_
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.

fix confidence: 🔴 40 low — review closely — react 👍/👎 to teach the reviewer

Comment thread pkcs7-modified.js
require('../node-forge/lib/pkcs7asn1');
require('../node-forge/lib/random');
require('../node-forge/lib/util');
require('../node-forge/lib/x509'); f

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 Stray identifier 'f' after require() call causes a syntax error

In the top try block (lines around the require chain near the top of the file), removed the stray bare identifier f that followed require('../node-forge/lib/x509');, changing it to just require('../node-forge/lib/x509');. This eliminates the syntax/reference error artifact so the try block can run to completion without being swallowed by the catch, restoring the intended relative-require fallback behavior.

🤖 Prompt for AI agents
In pkcs7-modified.js around line 30, review and complete this code-review fix: Stray identifier 'f' after require() call causes a syntax error.
What the draft fix changed: In the top `try` block (lines around the require chain near the top of the file), removed the stray bare identifier `f` that followed `require('../node-forge/lib/x509');`, changing it to just `require('../node-forge/lib/x509');`. This eliminates the syntax/reference error artifact so the try block can run to completion without being swallowed by the catch, restoring the intended relative-require fallback behavior.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 97 high — react 👍/👎 to teach the reviewer

Comment thread rdp/protocol/t125/per.js
Comment on lines 204 to 210
* @returns {type.Component} per encoded object identifier
*/
function writeObjectIdentifier(oid) {
return new type.Component([new type.UInt8(5), new type.UInt8((oid[0] << 4) & (oid[1] & 0x0f)), new type.UInt8(oid[2]), new type.UInt8(oid[3]), new type.UInt8(oid[4]), new type.UInt8(oid[5])]);
return new type.Component([new type.UInt8(5), new type.UInt8((oid[0] << 4) | (oid[1] & 0x0f)), new type.UInt8(oid[2]), new type.UInt8(oid[3]), new type.UInt8(oid[4]), new type.UInt8(oid[5])]);
}

/**

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 writeObjectIdentifier uses bitwise AND instead of OR, corrupting encoded OID byte

In writeObjectIdentifier (rdp/protocol/t125/per.js), changed (oid[0] << 4) & (oid[1] & 0x0f) to (oid[0] << 4) | (oid[1] & 0x0f) so the high nibble from oid[0] and low nibble from oid[1] are correctly combined via bitwise OR instead of being zeroed out by AND, matching the read-side logic in readObjectIdentifier.

🤖 Prompt for AI agents
In rdp/protocol/t125/per.js around line 195, review and complete this code-review fix: writeObjectIdentifier uses bitwise AND instead of OR, corrupting encoded OID byte.
What the draft fix changed: In writeObjectIdentifier (rdp/protocol/t125/per.js), changed `(oid[0] << 4) & (oid[1] & 0x0f)` to `(oid[0] << 4) | (oid[1] & 0x0f)` so the high nibble from oid[0] and low nibble from oid[1] are correctly combined via bitwise OR instead of being zeroed out by AND, matching the read-side logic in readObjectIdentifier.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer

var tokens = str.split(' - Address: ');
for (var block in tokens)
{
if (block == 0) continue;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 wifi-scanner.js leaks tokens as an implicit global (missing var/let)

Changed tokens = str.split(' - Address: '); to var tokens = str.split(' - Address: '); inside the this.child.ms.on('end', function () {...}) callback in WiFiScanner.prototype.Scan, declaring tokens as a function-local variable instead of an implicit global.

🤖 Prompt for AI agents
In agents/modules_meshcore/wifi-scanner.js around line 87, review and complete this code-review fix: wifi-scanner.js leaks `tokens` as an implicit global (missing var/let).
What the draft fix changed: Changed `tokens = str.split(' - Address: ');` to `var tokens = str.split(' - Address: ');` inside the `this.child.ms.on('end', function () {...})` callback in `WiFiScanner.prototype.Scan`, declaring `tokens` as a function-local variable instead of an implicit global.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer

Comment on lines 205 to 211
this.transport.once('data', function(s) {
self.recvServerControlCooperatePDU(s);
});
return;
}

var self = this;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 recvServerControlCooperatePDU / recvServerControlGrantedPDU / recvServerFontMapPDU register a second 'once' listener even on the mismatch branch, causing duplicate handlers

Added return; immediately after the this.transport.once('data', ...) retry registration inside the mismatch if branch in recvServerControlCooperatePDU, recvServerControlGrantedPDU, and recvServerFontMapPDU (mirroring the existing pattern in recvDemandActivePDU / recvServerSynchronizePDU). This prevents the unconditional fall-through code at the bottom of each function from registering a second once('data', ...) listener for the next state when the mismatch branch already scheduled a retry, eliminating the duplicate-handler/state-machine corruption bug described in the finding. Note: I also noticed a pre-existing unrelated typo (caps.CapsETTYPE_MULTIFRAGMENTUPDATE should be caps.CapsType.CAPSETTYPE_MULTIFRAGMENTUPDATE) in the constructor, which is outside the scope of this finding and was left as originally written in the source (I did not introduce it — it was already present in the given file and is preserved verbatim, not part of this fix).

🤖 Prompt for AI agents
In rdp/protocol/pdu/global.js around line 174, review and complete this code-review fix: recvServerControlCooperatePDU / recvServerControlGrantedPDU / recvServerFontMapPDU register a second 'once' listener even on the mismatch branch, causing duplicate handlers.
What the draft fix changed: Added `return;` immediately after the `this.transport.once('data', ...)` retry registration inside the mismatch `if` branch in `recvServerControlCooperatePDU`, `recvServerControlGrantedPDU`, and `recvServerFontMapPDU` (mirroring the existing pattern in `recvDemandActivePDU` / `recvServerSynchronizePDU`). This prevents the unconditional fall-through code at the bottom of each function from registering a second `once('data', ...)` listener for the next state when the mismatch branch already scheduled a retry, eliminating the duplicate-handler/state-machine corruption bug described in the finding. Note: I also noticed a pre-existing unrelated typo (`caps.CapsETTYPE_MULTIFRAGMENTUPDATE` should be `caps.CapsType.CAPSETTYPE_MULTIFRAGMENTUPDATE`) in the constructor, which is outside the scope of this finding and was left as originally written in the source (I did not introduce it — it was already present in the given file and is preserved verbatim, not part of this fix).
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 92 high — react 👍/👎 to teach the reviewer

Comment on lines 102 to 108
var germanpass = (abc !== '' && abc.includes('Kennwort:') && !abc.includes('Numerisches Kennwort:')); // German Password
var frenchpass = (abc !== '' && abc.includes('Mot de passe :') && !abc.includes('Mot de passe num')); // French Password
if (englishidpass || germanidpass || frenchidpass|| englishpass || germanpass || frenchpass) {
if (x + 1 >= lines.length) { continue; }
var nextline = lines[x + 1].trim();
if (x + 1 < lines.length && (nextline !== '' && (nextline.startsWith('ID:') || nextline.startsWith('ID :')) )) {
identifier = nextline.replace('ID:','').replace('ID :', '').trim();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 win-volumes.js: bitlocker recovery password parser reads lines[x+1] with no bounds check before out-of-range access

In windows_volumes, inside the manage-bde output parsing loop, added a bounds check if (x + 1 >= lines.length) { continue; } immediately before var nextline = lines[x + 1].trim();, preventing the unconditional out-of-range array access on lines[x + 1] when the marker line is the last line of output. The pre-existing x + 1 < lines.length checks on the following branches are left intact and now function correctly since nextline is only computed when the index is valid.

🤖 Prompt for AI agents
In agents/modules_meshcore/win-volumes.js around line 91, review and complete this code-review fix: win-volumes.js: bitlocker recovery password parser reads lines[x+1] with no bounds check before out-of-range access.
What the draft fix changed: In `windows_volumes`, inside the manage-bde output parsing loop, added a bounds check `if (x + 1 >= lines.length) { continue; }` immediately before `var nextline = lines[x + 1].trim();`, preventing the unconditional out-of-range array access on `lines[x + 1]` when the marker line is the last line of output. The pre-existing `x + 1 < lines.length` checks on the following branches are left intact and now function correctly since `nextline` is only computed when the index is valid.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer


// Load saved theme from local storage
const savedTheme = localStorage.getItem("theme");
if (savedTheme) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 Theme name from localStorage used to build stylesheet path with dangerous fallback to '..'

In the DOMContentLoaded handler in theme-switcher.js, replaced the encodeURIComponent-based fallback logic (which used the literal '..' for the 'default' case) with an explicit ALLOWED_THEMES allowlist (["default", "dark", "light"]) checked via .includes(); any savedTheme value not in the allowlist now safely falls back to "default" instead of being percent-encoded and used directly, and '..' is no longer referenced anywhere. Risk/unverified: the actual set of valid theme folder names on disk is not visible in this file, so the allowlist ["default", "dark", "light"] is a placeholder guess — a complete fix requires confirming the real list of theme directories shipped under styles/themes/ and updating ALLOWED_THEMES to match exactly.

🤖 Prompt for AI agents
In public/scripts/themes/theme-switcher.js around line 6, review and complete this code-review fix: Theme name from localStorage used to build stylesheet path with dangerous fallback to '..'.
What the draft fix changed: In the DOMContentLoaded handler in theme-switcher.js, replaced the encodeURIComponent-based fallback logic (which used the literal '..' for the 'default' case) with an explicit ALLOWED_THEMES allowlist (["default", "dark", "light"]) checked via `.includes()`; any savedTheme value not in the allowlist now safely falls back to "default" instead of being percent-encoded and used directly, and '..' is no longer referenced anywhere. Risk/unverified: the actual set of valid theme folder names on disk is not visible in this file, so the allowlist ["default", "dark", "light"] is a placeholder guess — a complete fix requires confirming the real list of theme directories shipped under `styles/themes/` and updating ALLOWED_THEMES to match exactly.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 65 medium — react 👍/👎 to teach the reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants