Skip to content

EDM-4987: Do not send wrong bytes that causes the session logout - #760

Open
celdrake wants to merge 1 commit into
flightctl:mainfrom
celdrake:bugfix/EDM-4987-vm-console-resize-ctrl-d
Open

EDM-4987: Do not send wrong bytes that causes the session logout#760
celdrake wants to merge 1 commit into
flightctl:mainfrom
celdrake:bugfix/EDM-4987-vm-console-resize-ctrl-d

Conversation

@celdrake

@celdrake celdrake commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

In useAppConsoleWebSocket, reusing msgToBytes that's designed to work for k8s channels, was incorrectly sending the "0x04" prefix which is equivalent to "Control+D" and logged out the user.

Made-with: Cursor

Summary

  • Updated shared UI WebSocket handling in libs/ui-components/.
  • Removed the Kubernetes-specific msgToBytes utility from useAppConsoleWebSocket.
  • Added Kubernetes channel framing locally in useWebSocket.
  • Prevented the incorrect 0x04 prefix that could trigger Control+D and log out the user.
  • Resize messages from the app console are no longer transmitted.

Impact

  • Affects shared UI components used by platform applications.
  • Improves WebSocket protocol correctness and user-session stability.
  • Does not change libs/types/, libs/i18n/, libs/cypress/, apps/standalone/, apps/ocp-plugin/, proxy/, packaging/, or .github/workflows/.
  • No security issue is introduced or reported.
  • No container, E2E test, Go auth proxy, or CI configuration changes are included.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The WebSocket hooks now encode regular messages with Kubernetes channel framing. Resize messages return without transmission. The unused msgToBytes utility and import were removed.

Changes

Kubernetes WebSocket channel framing

Layer / File(s) Summary
Channel framing and send behavior
libs/ui-components/src/hooks/terminalWsUtils.ts, libs/ui-components/src/hooks/useWebSocket.ts, libs/ui-components/src/hooks/useAppConsoleWebSocket.ts
useWebSocket prefixes UTF-8 payloads with the Kubernetes stream or resize channel byte. useAppConsoleWebSocket skips resize transmissions. The unused msgToBytes utility was removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: ui-components

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Hardcoded-Secrets ✅ Passed The 18 added lines contain only WebSocket framing logic; scans found no credential URLs, private keys, secret assignments, or base64 strings over 32 characters.
No-Weak-Crypto ✅ Passed The PR only changes WebSocket byte framing; its diff contains no weak algorithms, crypto APIs, custom crypto, or secret/token comparisons.
No-Injection-Vectors ✅ Passed The three-file patch only changes WebSocket byte framing and removes msgToBytes; it adds no eval/exec, dangerouslySetInnerHTML, os.system, exec.Command, or yaml.load usage.
Container-Privileges ✅ Passed The commit changes only three TypeScript hook files. No container or Kubernetes manifest contains privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, root, or allowPrivilegeEscalation:true settings.
No-Sensitive-Data-In-Logs ✅ Passed The pull request adds no logging. The only affected-hook log is pre-existing and records a generic WebSocket Event, while terminal data is delivered to the UI without logging.
Resource-Leaks ✅ Passed The patch changes only three TypeScript files under libs/ui-components and changes no Go files under proxy, so this resource-leak check is not applicable.
Unchecked-Errors ✅ Passed The PR changes only three UI TypeScript files; no files under proxy/ or any Go files changed, so this Go-specific check is not applicable.
Ai-Attribution ✅ Passed The PR and HEAD commit use the allowed Made-with: Cursor attribution. No AI Co-Authored-By trailer appears on the PR commit.
Generated-Files-Not-Hand-Edited ✅ Passed HEAD changes only three terminal WebSocket hook files; no files under the listed generated OpenAPI or English translation paths changed.
I18n-Compliance ✅ Passed The pull request changes only .ts hook files and no .tsx files; therefore it adds no unchecked user-visible JSX strings or variable-key t() calls.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the incorrect byte transmission and its session logout impact.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@celdrake
celdrake force-pushed the bugfix/EDM-4987-vm-console-resize-ctrl-d branch from 9a77ad4 to d1c0677 Compare August 6, 2026 07:36
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@celdrake celdrake changed the title EDM-4987: Do not send wrong frame that causes the session logout EDM-4987: Do not send wrong bytes that causes the session logout Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant