MatrixAI / Polykey-CLI

Polykey CLI - Open Source Decentralized Secret Sharing System for Zero Trust Workflows
https://polykey.com
GNU General Public License v3.0
6 stars 3 forks source link

Secrets Edit Command needs to Maintain Websocket Keepalive Timeout as long as the Editor Session is Alive #315

Open CMCDragonkai opened 3 hours ago

CMCDragonkai commented 3 hours ago

Specification

When using secrets edit, it will timeout if the editor session isn't finished fast enough. I opened up the secrets edit and waited for a while, after trying to save, it failed:

cmcdragonkai ➜ matrix-framework-13-ryzen-7040  ➜ ~/Projects/Polykey-CLI
 $ ./dist/polykey.js secrets ed nix:/nix.conf
ERROR:polykey.PolykeyClient.WebSocketClient:ErrorWebSocketConnectionKeepAliveTimeOut: WebSocket Connection reached keep-alive timeout - 
ERROR:polykey.PolykeyClient.WebSocketClient.WebSocketConnection 0:ErrorWebSocketConnectionKeepAliveTimeOut: WebSocket Connection reached keep-alive timeout - 
ErrorWebSocketConnectionNotRunning

We need to make the websocket connection alive for as long as the editor session is alive, it shouldn't fail.

That being said it's also important not to start a vault commit transaction until the editor has in fact finished writing. We don't want this to block other secret operations. Concurrent testing needs to be checked too.

Tasks

  1. Use a stream life cycle to be maintained while the editor is there, it shouldn't expire on the keep alive timeout.
  2. Test that secrets edit can work for a long running edit.
  3. Test that while the editor is open it doesn't cause blocked concurrent secrets operations.

@tegefaulkes @aryanjassal

linear[bot] commented 3 hours ago

ENG-440 Secrets Edit Command needs to Maintain Websocket Keepalive Timeout as long as the Editor Session is Alive

CMCDragonkai commented 3 hours ago

I want to point out that this message looks weird too:

INFO:polykey.PolykeyAgent.ClientService.WebSocketServer.WebSocketConnection 0:ErrorWebSocketConnectionPeer: WebSocket Connection peer error - Peer closed with code 1000

This looks like a error. But it's actually a successful close. It's considered normal closure.