Skip to content

feat(pam): add RDP CLI access and recording chunk batching#269

Open
bernie-g wants to merge 3 commits into
pam-revampfrom
feat/pam-rdp-cli-access
Open

feat(pam): add RDP CLI access and recording chunk batching#269
bernie-g wants to merge 3 commits into
pam-revampfrom
feat/pam-rdp-cli-access

Conversation

@bernie-g

@bernie-g bernie-g commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Context

Adds CLI support for PAM RDP sessions and caps recording chunk size with batched live uploads.
https://linear.app/infisical/issue/PAM-263/add-windows-account-rdp-web-and-cli

Type

  • Fix
  • Feature
  • Improvement
  • Breaking
  • Docs
  • Chore

@infisical-review-police

Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cli-269-feat-pam-add-rdp-cli-access-and-recording-chunk-batching

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

bernie-g added 2 commits June 19, 2026 13:12
- Wire Windows/RDP case in StartPAMAccess to use RDPProxyServer
- Use gateway disconnect detection so CLI exits on server-side session termination
@bernie-g bernie-g changed the base branch from main to pam-revamp June 19, 2026 19:28
@bernie-g bernie-g marked this pull request as ready for review June 19, 2026 20:35
@greptile-apps

greptile-apps Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR activates RDP/Windows PAM sessions through the unified StartPAMAccess path and refactors RDPProxyServer.handleConnection to use the shared NewDisconnectChannels/WaitForDisconnect abstraction that distinguishes gateway-side drops from normal client disconnects.

  • access.go adds startRDPProxy, wiring Windows accounts into the existing switch-dispatch the same way database accounts are handled; the function is nearly identical to startDatabaseProxy but omits the auto-launch step present in StartRDPLocalProxy.
  • rdp-proxy.go replaces the old done chan struct{} (buffer 2, both goroutines shared one channel) with separate gatewayErrCh/clientErrCh channels — a meaningful semantic change, because receiving from gatewayErrCh now triggers a full proxy shutdown via HandleGatewayDisconnect, whereas the client-disconnect path just returns. A race exists between the buffered send to gatewayErrCh and the immediately-following defer connCancel(), which can cause the select to resolve on connCtx.Done() instead and silently skip shutdown.

Confidence Score: 3/5

The RDP proxy integration is straightforward, but the refactored disconnect logic in handleConnection has a real concurrency flaw that can leave the proxy alive after the gateway terminates a session.

The gateway-disconnect race in rdp-proxy.go is not theoretical: Go's asynchronous preemption means the scheduler can context-switch between gatewayErrCh <- err and defer connCancel(), making both select cases simultaneously ready. When that happens, Go randomly chooses between them, and if connCtx.Done() wins, the proxy stays running after an admin-forced termination instead of shutting down cleanly. The rest of the change is a faithful port of the database proxy pattern and looks correct.

packages/pam/local/rdp-proxy.go — specifically the select logic change in handleConnection and how WaitForDisconnect interacts with the deferred connCancel in the gateway goroutine.

Important Files Changed

Filename Overview
packages/pam/local/access.go Enables Windows/RDP accounts in StartPAMAccess via a new startRDPProxy function that closely mirrors startDatabaseProxy; auto-launch of the RDP client is absent compared to the existing StartRDPLocalProxy entry point
packages/pam/local/rdp-proxy.go Refactors handleConnection to use NewDisconnectChannels/WaitForDisconnect, introducing a race where connCtx.Done() can be selected over gatewayErrCh and silently skip HandleGatewayDisconnect on a gateway-side drop

Reviews (1): Last reviewed commit: "fix(pam): write RDP session banner to st..." | Re-trigger Greptile

Comment thread packages/pam/local/rdp-proxy.go
Comment thread packages/pam/local/access.go
Comment thread packages/pam/local/access.go
@veria-ai

veria-ai Bot commented Jun 19, 2026

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@bernie-g bernie-g requested a review from x032205 June 19, 2026 20:46
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.

1 participant