Skip to content

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

Merged
celdrake merged 1 commit into
flightctl:mainfrom
celdrake:bugfix/EDM-4987-vm-console-resize-ctrl-d
Aug 10, 2026
Merged

EDM-4987: Do not send wrong bytes that causes the session logout#760
celdrake merged 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
@celdrake
celdrake force-pushed the bugfix/EDM-4987-vm-console-resize-ctrl-d branch from d1c0677 to ce73b70 Compare August 10, 2026 13:18
@celdrake
celdrake merged commit ae99129 into flightctl:main Aug 10, 2026
10 checks passed
@celdrake
celdrake deleted the bugfix/EDM-4987-vm-console-resize-ctrl-d branch August 10, 2026 13:51
celdrake added a commit to celdrake/flightctl-ui that referenced this pull request Aug 11, 2026
celdrake added a commit that referenced this pull request Aug 11, 2026
* Bump fast-uri from 3.1.4 to 3.1.5 (#759)

Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.4 to 3.1.5.
- [Release notes](https://github.com/fastify/fast-uri/releases)
- [Commits](fastify/fast-uri@v3.1.4...v3.1.5)

Made-with: Cursor

---
updated-dependencies:
- dependency-name: fast-uri
  dependency-version: 3.1.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit e17bc30)

* EDM-4999: Redefine which statuses allow start/stop actions (#763)

Made-with: Cursor
(cherry picked from commit a5959d8)

* EDM-4987: Do not send wrong frame that causes the session logout (#760)

Made-with: Cursor
(cherry picked from commit ae99129)

* EDM-5034: Show restart app loop warnings (#764)

Made-with: Cursor
(cherry picked from commit 51bac50)

* EDM-4888: Enable the restart action on success (#762)

Made-with: Cursor
(cherry picked from commit 0e19b12)

* EDM-4726: Explain updated behaviour for VM apps (#766)

Made-with: Cursor

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

2 participants